Cross Site Request Forgery ( CSRF ) is a type of website exploit carried out by issuing unauthorized commands from a trusted website user. CSRF exploits a website’s trust for a particular user's browser, as opposed to cross-site scripting, which exploits the user’s trust for a website.
A CSRF usually uses a browser's "GET" command as the exploit point.
CSR forgers use HTML tags such as "IMG" to inject commands into a
specific website. A particular user of that website is then used as a
host and an unwitting accomplice. Often the website does not know that
it is under attack, since a legitimate user is sending the commands. The
attacker might issue a request to transfer funds to another account.
e.g
amanvera send some html having below img. unforunately at that time both user (poonm & amanvera) are login to their bank(i.e yourbank). whenever poonam execute the html code send by amanverma. following img src will execute self, and tranfer money from poonam to amanverma account.
<img src="http://www.yourbank.com/transfer?from=poonam&to=amanverma&amount=1000000">
A CSRF attack is hard to execute because a number of things have to happen in order for it to succeed:
e.g
amanvera send some html having below img. unforunately at that time both user (poonm & amanvera) are login to their bank(i.e yourbank). whenever poonam execute the html code send by amanverma. following img src will execute self, and tranfer money from poonam to amanverma account.
<img src="http://www.yourbank.com/transfer?from=poonam&to=amanverma&amount=1000000">
A CSRF attack is hard to execute because a number of things have to happen in order for it to succeed:
- The attacker must target either a website that does not check the referrer header (HTTP_REFERER) or a user/victim with a browser or plug-in bug that allows referrer spoofing (which is rare).
- The attacker must locate a form submission at the target website, which must be capable of something like changing the victim's email address login credentials or doing money transfers.
- The attacker must determine the correct values for all of the form's or URL's inputs. If any of them are required to be secret values or IDs that the attacker cannot accurately guess, the attack will fail.
- The attacker must lure the user/victim to a Web page with malicious code while the victim is logged in to the target site.