GET vs POST CSRF Attacks
What you'll learn: How CSRF exploitation differs dramatically between GET and POST requests, and why one is far easier to exploit than the other.
The Core Difference
CSRF attacks exploit the automatic inclusion of cookies in requests, but the HTTP method used by the vulnerable endpoint drastically changes how simple the attack is to execute.
GET-based CSRF is trivially easy to exploit. Since GET requests can be triggered by simply loading a resource (image, script, iframe), an attacker can embed a malicious URL anywhere:
<!-- Victim loads attacker's page, bank transfer executes automatically -->
<img src="https://bank.com/transfer?to=attacker&amount=5000">
The browser automatically sends the victim's cookies when fetching this "image," and the damage is done. No user interaction needed beyond viewing the page.
POST-based CSRF requires more sophistication because browsers don't automatically send POST requests when loading resources. Attackers must use JavaScript or hidden forms:
<!-- Attacker page with hidden form -->
<form id="csrf" action="https://bank.com/transfer" method="POST">
<input name="to" value="attacker">
<input name="amount" value="5000">
</form>
<script>
document.getElementById('csrf').submit();
</script>
This auto-submits when the page loads, but requires the victim to actually land on the attacker's page—slightly higher barrier than a GET attack.
Why This Matters
Many developers mistakenly believe using POST "protects" against CSRF. It doesn't—it just makes exploitation slightly harder. The real protection comes from anti-CSRF tokens (which you learned previously) that validate requests came from your own forms, not attackers' pages.
GET requests for state-changing operations are especially dangerous because they violate REST principles and maximize attack surface.
Key Takeaway: GET-based CSRF is trivial to exploit via simple HTML tags; POST-based CSRF requires forms or JavaScript but is still fully exploitable. Use POST for state changes AND implement proper CSRF tokens—method alone provides no protection.