Skip to content

Commit 3a550ae

Browse files
committed
Landing rapid7#1863 - Fixed a bug in the HSTS module around null headers
2 parents ff08fed + ea7805d commit 3a550ae

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

modules/auxiliary/scanner/http/http_hsts.rb

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,22 @@ def run_host(ip)
3535
'method' => 'GET',
3636
}, 25)
3737

38-
hsts = res.headers['Strict-Transport-Security']
39-
40-
if res and hsts
41-
print_good("#{ip}:#{rport} - Strict-Transport-Security:#{hsts}")
42-
report_note({
43-
:data => hsts,
44-
:type => "hsts.data",
45-
:host => ip,
46-
:port => rport
47-
})
38+
if res
39+
hsts = res.headers['Strict-Transport-Security']
40+
41+
if hsts
42+
print_good("#{ip}:#{rport} - Strict-Transport-Security:#{hsts}")
43+
report_note({
44+
:data => hsts,
45+
:type => "hsts.data",
46+
:host => ip,
47+
:port => rport
48+
})
49+
else
50+
print_error("#{ip}:#{rport} No HSTS found.")
51+
end
4852
else
49-
print_error("#{ip}:#{rport} No HSTS found.")
53+
print_error("#{ip}:#{rport} No headers were returned.")
5054
end
5155

5256
rescue ::Timeout::Error, ::Errno::EPIPE

0 commit comments

Comments
 (0)