I am trying out some sample code from an Auth0 blog post, Prevent Cross-Site Request Forgery (CSRF) Attacks.
There are two servers being setup, a vulnerable site at localhost:3000
and the attacker's site at localhost:4000
. The attacker's site makes a POST
request to the vulnerable site using a hidden form, and the vulnerable site accepts the attacker's data.
I checked the attackers POST request, and the origin and the referer headers are both localhost:4000
. Since it is making a request to localhost:3000
, why doesn't the browser throw a CORS error?
The localhost:3000
server does not implement any kind of CORS policy.
The sample code is in the repo https://github.com/auth0-blog/csrf-sample-app.git.