Skip to content

Commit 4985328

Browse files
committed
Fix webdav upload php false positive
1 parent 8332182 commit 4985328

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

modules/exploits/multi/http/webdav_upload_php.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ def check
163163
return Exploit::CheckCode::Unknown("Target responded with unexpected HTTP status #{res.code}")
164164
end
165165

166+
correct_message = res.message == 'OK'
167+
header_url_regex = %r{^\d,\d, <http://apache.org/dav/propset/fs/\d>$}
168+
correct_header = res.headers['DAV'].match?(header_url_regex)
169+
170+
unless correct_message && correct_header
171+
print_error "Target responded with an unknown message: '#{res.message}', should be 'OK'" unless correct_message
172+
print_error "Target responded with an unknown DAV header: '#{res.headers['DAV']}', should be '#{header_url_regex}'" unless correct_header
173+
return Exploit::CheckCode::Unknown('Target responded with unexpected message and/or header')
174+
end
175+
166176
# Record results!
167177
opts, service = report_webdav_service(res, res_creds)
168178

0 commit comments

Comments
 (0)