Skip to content

Commit 01fc69b

Browse files
committed
Merge branch 'mandreko-http_hsts'
2 parents bc63ee9 + 61a74bf commit 01fc69b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# Framework web site for more information on licensing and terms of use.
5+
# http://metasploit.com/framework/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Auxiliary
11+
12+
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Auxiliary::Scanner
14+
15+
def initialize(info={})
16+
super(update_info(info,
17+
'Name' => 'HTTP Strict Transport Security (HSTS) Detection',
18+
'Description' => %q{
19+
Display HTTP Strict Transport Security (HSTS) information about each system.
20+
},
21+
'Author' => 'Matt "hostess" Andreko <mandreko[at]accuvant.com>',
22+
'License' => MSF_LICENSE
23+
))
24+
25+
register_options([
26+
OptBool.new('SSL', [ true, "Negotiate SSL for outgoing connections", true]),
27+
Opt::RPORT(443)
28+
])
29+
end
30+
31+
def run_host(ip)
32+
begin
33+
res = send_request_cgi({
34+
'uri' => '/',
35+
'method' => 'GET',
36+
}, 25)
37+
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+
})
48+
else
49+
print_error("#{ip}:#{rport} No HSTS found.")
50+
end
51+
52+
rescue ::Timeout::Error, ::Errno::EPIPE
53+
end
54+
end
55+
56+
end

0 commit comments

Comments
 (0)