Cross Site Request Forgery is one of the most common form of attack by online spammers and scammers. Exploicity of this attack is bit complex, it’s prevalence is common.
But CSRF attacks can be predicted easily and their impact is moderate.
In this scenario we are having an Attacker, User, Attacker’s and Target server. Attacker can share the malicious link to user’s through Multiple ways.
Link sharing can be done through Social Media, Email and with many of different ways. Once the User click’s on the link, then the link goes to the attackers webserver.
Now the request from attackers server also carries the Embedded Malicious request, which causes the user browser to issue a request to the target website.
Entire process of CSRF is to get the authenticated user, who is already authenticated to the target website. So that’s one of the condition normally need to meet for successful CSRF.
Cross Site Request Forgery
In this scenario we are having an user transferring money on a banking website, now the user login to bank and to make Authenticate money transfer request.
The request should be like this HTTP POST http://bank.com/transfer, once the request processed then in-order to persist the user state server will sent an Authcookie : 86GHTR.
Being the post request there is a request body which consist of Target Account number : 7895457898054 and where the money Amount : 100000 is to transfer.
Now the attacker can forge this request and he is the rub with CSRF, if the attacker can trick the user’s browser in making this request when I may be able to successfully execute a CSRF request.
So now does an attacker execute that: Attacker already aware of the HTTP post path, they look at the bank and tell what’s the URL that you need to post to transfer money.
They already aware of the fields, so they only require the URL and request body, because if they get the user to make a request to that part with the request body.
Then the Auth Cookie will be sent automatically with the request which browsers normally do, send any cookie with the request valid for a target domain.
Cross Site Request Forgery Defenses
- CSRF is exploited if we use predictable patterns.
- Employ Anti-forgery tokens, add randomness to the request.
- Valid request should not originate externally.
- The referrer should be in each header requests.
- Native browser defenses.
- Fraud detection patterns.