Skip to content

Commit c642057

Browse files
committed
Clean up module
1 parent 205b175 commit c642057

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

lib/msf/core/db_manager/vuln.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,4 @@ def vulns(wspace=workspace)
230230
wspace.vulns
231231
}
232232
end
233-
end
233+
end

modules/auxiliary/scanner/http/host_header_injection.rb

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,60 @@
55

66
require 'msf/core'
77

8-
class Metasploit3 < Msf::Auxiliary
8+
class Metasploit4 < Msf::Auxiliary
99

1010
include Msf::Exploit::Remote::HttpClient
1111
include Msf::Auxiliary::WmapScanServer
1212
include Msf::Auxiliary::Scanner
1313

14-
def initialize(info={})
14+
def initialize(info = {})
1515
super(update_info(info,
16-
'Name' => 'HTTP Host-Header Injection Detection',
17-
'Description' => 'Checks if the host is vulnerable to Host-Header Injection',
18-
'Author' =>
16+
'Name' => 'HTTP Host Header Injection Detection',
17+
'Description' => 'Checks if the host is vulnerable to Host header injection',
18+
'Author' =>
1919
[
20-
'Jay Turla <@shipcod3>',
21-
'Medz Barao <@godflux>'
20+
'Jay Turla', # @shipcod3
21+
'Medz Barao' # @godflux
2222
],
2323
'License' => MSF_LICENSE,
24-
'References' =>
24+
'References' =>
2525
[
2626
['URL', 'http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html']
2727
]
2828
))
2929

3030
register_options(
3131
[
32-
OptString.new('TARGETHOST',[true, "The redirector target", "evil.com"]),
33-
],self.class)
32+
OptString.new('TARGETHOST', [true, 'The redirector target', 'evil.com'])
33+
], self.class)
3434
end
3535

36-
def run_host(target_host)
37-
36+
def run_host(ip)
3837
begin
39-
p = "#{datastore['TARGETHOST']}"
40-
res = send_request_raw({
38+
target_host = "#{datastore['TARGETHOST']}"
39+
res = send_request_raw(
4140
'uri' => '/',
4241
'method' => 'GET',
4342
'headers' => {
44-
'host' => p,
45-
'x-forwarded-host' => p,
43+
'Host' => target_host,
44+
'X-Forwarded-Host' => target_host
4645
}
47-
})
46+
)
4847

4948
unless res
5049
vprint_error("#{peer} did not reply to our request")
5150
return
5251
end
5352

54-
if res.headers =~ /#{p}/ || res.body =~ /#{p}/
55-
print_good("#{peer} is vulnerable to HTTP Host-Header Injection")
53+
if res.headers.include?(target_host) || res.body.include?(target_host)
54+
print_good("#{peer} is vulnerable to HTTP Host header injection")
5655
report_vuln(
57-
host: rhost,
56+
host: ip,
5857
port: rport,
5958
proto: 'tcp',
60-
sname: (ssl ? 'https' : 'http'),
61-
info: "Vulnerable to HTTP Host-Header Injection",
59+
sname: ssl ? 'https' : 'http',
60+
name: 'HTTP Host header injection',
61+
refs: self.references
6262
)
6363
else
6464
vprint_error("#{peer} returned #{res.code} #{res.message}")
@@ -67,4 +67,5 @@ def run_host(target_host)
6767
rescue ::Timeout::Error, ::Errno::EPIPE
6868
end
6969
end
70+
7071
end

0 commit comments

Comments
 (0)