-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from ctflearner/DetectWeakXSSProtection
Create DetectWeakXSSProtectionHeader.bambda
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Bambda Script to Detect "Weak or Misconfigured X-XSS-Protection" Header in HTTP Response | ||
* @author ctflearner | ||
* This script checks if the HTTP response contains a weak or misconfigured "X-XSS-Protection" header. | ||
* It identifies the following cases: | ||
* 1. The header is set to "0", explicitly disabling XSS protection. | ||
* 2. The header is set to "1" (minimal protection) or includes a "report=" directive, | ||
* which may indicate insufficient or partial mitigation. | ||
* The script ensures there is a response and scans the headers for these conditions. | ||
**/ | ||
|
||
|
||
return requestResponse.hasResponse() && | ||
requestResponse.response().headers().stream() | ||
.filter(header -> header.name().equalsIgnoreCase("X-XSS-Protection")) | ||
.anyMatch(header -> { | ||
String value = header.value().trim(); | ||
return value.equals("0") || | ||
value.equals("1") || | ||
value.toLowerCase(Locale.US).contains("report="); | ||
}); |