CORS Attack
ow HTTP Headers
Access-Control-Allow: * or <origin> or null
Access-Control-Credentials:
if Access Access-Control-Credentials: true
is Vulnerable CORS
POS (if data json use Content-Type = application/json)
I will try to find this vuln Uing Burpsuit Come with me!
in this request allow credentials if
Testing For CORS Vulnerabilities
remove/add a domain or like attckerlocalhost
Map the application • Test the application for dynamic generation • Does it reflect the user-supplied ACAO header? • Does it only validate on the start/end of a specific string? • Does it allow the null origin? * or yourdoamin,com • Does it restrict the protocol? HTTP or https | 80,8080 or any think • Does it allow credentials?
Click exploit B000000000M!
Mitigation
1. restrict Allowed Origins
Access-control-Allow-Origin: https://example.com
2. Limit HTTP Methods
Access-control-Allow-Methods: GET, POST
3. Control Allowed Header
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true
Validate Input and Origin
Content security Policy (CSP)
Content-Security-Policy: default-src 'self'; script-src 'self' https://example.com
Last updated