Prerequisites:
-
An attacker must construct a page that is hosted on the attacking server, which when clicked on/browsed to, will send a POST request to the victim web server.
-
The attacker ideally needs knowledge of the target website to to do this because many applications won’t accept the request they receive if it’s not properly constructed or does not contain all the expected data. An attacker ideally needs an account on the target site to know what such a request needs to contain.
Attack Steps:
-
The user logs into the target website
-
Target website assigns user a cookie, which is stored in their browser and automatically returned to the application in each subsequent request to identify the user
-
The attacker tricks the user into clicking on a link to the malicious page hosted on the attacker’s server.
-
Attacker’s server returns malicious page (described above in prerequisite) to user’s browser
-
User’s browser interprets malicious page and is instructed to send the maliciously-crafted request to target server (which, because the user is already logged into, is sent through their authenticated session). This causes the data change within the user’s session. This might lead to the user’s email address being changed, so that attacker can then reset their password, other data being changed, XSS code being planted and stored within the user’s profile, which executes every time user either logs in or visits certain page. Can also be used to modify/create new users if administrator account is targeted.
CSRF PoC can be generated in burp but does not automatically submit the request when loaded in the browser - within the