Skip to content

Commit

Permalink
Merge pull request #207 from righettod/add_cors
Browse files Browse the repository at this point in the history
Propose check to detect misconfiguration for CORS credentials requested.
  • Loading branch information
Hannah-PortSwigger authored May 13, 2024
2 parents 4dd9a93 + e133133 commit e32801d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions other/corsCredentialedRequestsMisconfiguration.bcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
metadata:
language: v2-beta
name: "Invalid CORS configuration for credentialed requests detected"
description: "Checks for a broken CORS configuration case: Credentialed requests and wildcards."
author: "Dominique Righetto"
tags: "passive", "informative"

# The server must not specify the "*" wildcard for the Access-Control-Allow-Origin response-header value, but must instead specify an explicit origin
# Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#requests_with_credentials
given response then
if {latest.response.headers} matches "(?i)Access-Control-Allow-Origin:\s+\*" and
{latest.response.headers} matches "(?i)Access-Control-Allow-Credentials:\s+true" then
report issue:
severity: info
confidence: firm
detail: "Credentialed CORS requests cannot used wildcards origins."
remediation: "Specify an explicit allow origin. Refer to the Mozilla CORS documentation for technical details: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#requests_with_credentials"
end if

0 comments on commit e32801d

Please sign in to comment.