CSRF

Cross Site Request Forgery (aka: XSRF or Sea-Surf)

CSRF happens when an adversary can get a targets browser to make an unexpected request to another site (cross-site). The goal is to have the request made, be linked in some way to the victim who triggered it. Typically through already authenticated sessions that they are holding.

In targeted attacks you will want to do some research on what sites the victim frequents. Otherwise non-targeted "wide net" attacks for popular sites will have the best success.

Things to look for:

  • GET editing data

  • Insecure web frameworks

GET editing data:

If we see a GET request editing data rather than just reading data then this is a good candidate for a CSRF attack. To abuse these request in CSRF we need to utilize HTML to force the victim browser to make the request. This is typically done with either an <img> tag or a hidden form on our attack.site.

Insecure Web Frameworks:

Many web frameworks only add CSRF protections to POST requests and not GET requests since they expect developers to not modify data with GETs. Added features like CORS can also open up holes in areas that may have previously been secured with ant-csrf tokens. Some of the frameworks that (at the time of writing) have vulnerable GETs are:

  • Ruby on Rails

  • Django

  • Asp.NET

  • Ajax

  • Node

  • Angular

GET <img>:

The following is an example of a line of HTML code that we would plant in our website that the user is visiting. This would then try to load an image at the following location which is a GET request to have the user follow us. If they are authenticated on the site then they will have passed their cookies along with the GET request and followed our profile.

<img src="https://somesocial.site/ourprofile?network=follow">

POST hidden form:

Last updated

Was this helpful?