A logged-in user visits a malicious page, and the browser silently submits a password-change request to the user's portal. Which control BEST prevents this?
Show the answer
Correct answerA. A unique anti-forgery token validated on each state-changing request
AWhy this is right: A secret per-request token that a third-party page cannot supply lets the server reject forged requests.
BWhy not this: Path canonicalization blocks directory traversal, not cross-site request forgery.
CWhy not this: Parameterized queries stop SQL injection, not requests forged through the user's browser.
DWhy not this: Stack canaries detect buffer overflows, which are not involved in a forged browser request.
This is cross-site request forgery: the browser sends a request the user never intended. A unique anti-forgery token the attacker's page cannot know lets the server reject forged requests. Parameterized queries stop injection, which this attack does not use.