Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check capability to override the HTTP method. #213

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions other/httpMethodOverrideCapability.bcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
metadata:
language: v2-beta
name: "HTTP method override capability detected"
description: "Check for the support for a request parameter or a request header allowing to override the HTTP method."
author: "Dominique Righetto"
tags: "active"

define:
test_method = "OPTIONS"

# To prevent causing any trouble on the target app then only apply the check on GET requests
# Sources:
# https://github.com/PortSwigger/param-miner/blob/master/resources/headers
# https://github.com/PortSwigger/param-miner/blob/master/resources/params
# https://owasp.org/www-project-web-security-testing-guide/stable/4-Web_Application_Security_Testing/02-Configuration_and_Deployment_Management_Testing/06-Test_HTTP_Methods
# https://www.sidechannel.blog/en/http-method-override-what-it-is-and-how-a-pentester-can-use-it/
given path then
if {base.request.method} is "GET" then
send request called checkOverrideSupport:
appending headers:
"x-method-override": `{test_method}`,
"x-http-method-override": `{test_method}`,
"x-http-method": `{test_method}`,
"request-method": `{test_method}`
appending queries:
`method={test_method}`,
`_method={test_method}`

if {checkOverrideSupport.response.headers} matches "(?i)allow:\s+[A-Z,]+" then
report issue:
severity: info
confidence: firm
detail: "Endpoints support a hidden parameter/header, allowing to override the HTTP method effectively used to handle the HTTP requests."
remediation: "Remove the support for the hidden request parameters/headers."
end if
end if
Loading