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

Propose check to detect misconfiguration for CORS credentials requested. #207

Merged
merged 1 commit into from
May 13, 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
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
Loading