Security feature created to selectively relax the SOP restrictions and enable controlled access to resources from different domains.
Prevent CORS Misconfigurations :
Access-Control-Allow-Origin : indicates all domains are allowed, or a comma-separated list of domains , value * OR comma-separated list of domains.Access-Control-Allow-Credentials : determines whether the domain allows for passing credentials — such as cookies or authorization headers in the cross-origin requests , value true{allow passing credenitals in the requests } , false { Disallow passing in the requests }.HTTP Request :
Origin : < attacker.com >
if these reflected in Response :
Access-Control-Allow-Origin: <attacker.com>
Access-Control-Allow-Credentials : true this vulnerable