Web Security · Middle · Question 25 of 75
How can checking the Origin header help against CSRF?
- 1Because the
Originheader contains the user's password - ✓Correct answer: Browsers set it on cross-site POSTs, so the server can reject state-changing requests from unknown origins
- 3Because attackers can't send requests without cookies
Explanation
Browser JavaScript can't forge Origin. Treat a missing header carefully, and combine the check with SameSite cookies or tokens.