@@ -65,18 +65,25 @@ def find_canary_uri
65
65
vprint_status ( "#{ peer } locating suitable canary URI" )
66
66
0 . upto ( 4 ) do
67
67
canary = '/' + Rex ::Text . rand_text_alpha ( 16 )
68
- res = send_request_cgi ( 'uri' => normalize_uri ( canary ) , 'method' => 'GET' )
68
+ res = send_request_raw ( 'uri' => normalize_uri ( canary ) , 'method' => 'GET' , 'headers' => headers )
69
69
# in most cases, the canary URI will not exist and will return a 404, but if everything under
70
70
# TARGETURI is protected by auth, that may be fine too
71
71
return canary if res . code == 401 || res . code == 404
72
72
end
73
73
nil
74
74
end
75
75
76
+ def headers
77
+ {
78
+ 'Referer' => datastore [ 'SSL' ] ? 'https' : 'http' + "://#{ rhost } :#{ rport } "
79
+ }
80
+ end
81
+
76
82
def requires_auth?
77
- res = send_request_cgi (
83
+ res = send_request_raw (
78
84
'uri' => normalize_uri ( target_uri . path . to_s ) ,
79
- 'method' => 'GET'
85
+ 'method' => 'GET' ,
86
+ 'headers' => headers
80
87
)
81
88
return false unless res
82
89
@@ -101,10 +108,10 @@ def test_misfortune
101
108
102
109
# Make a request containing a malicious cookie with the canary value.
103
110
# If that canary shows up in the *body*, they are vulnerable
104
- res = send_request_cgi (
111
+ res = send_request_raw (
105
112
'uri' => normalize_uri ( target_uri . path . to_s ) ,
106
113
'method' => 'GET' ,
107
- 'headers' => { 'Cookie' => "C107373883=#{ canary } " }
114
+ 'headers' => headers . merge ( 'Cookie' => "C107373883=#{ canary } " )
108
115
)
109
116
110
117
unless res
0 commit comments