Security testing-CSRF attacks and defenses

Source: Internet
Author: User

CSRF (Cross-site request forgery cross-site requests forgery)

Although it sounds like a cross-site script (XSS), it is very different from XSS and is almost at odds with the way it is attacked. XSS leverages trusted users within the site, while CSRF leverages trusted sites by disguising requests from trusted users.

Trust Site A, rogue site B, user C

Attack Flow:

1. Premise: User C logs on to site A and site A will generate cookies in the user's local browser

2. User C in the case of login, access to malicious site B--B will secretly send a request to the user C

3. According to the request of B, user C's browser takes a cookie to access a

4. A cannot judge the source, the request of B will be processed according to User C's permission

How to Defend:

Important scenarios: such as payment, transfer, change of password, modification of personal information, etc.

First, verify the Refer field in the Refer:http request, you need to determine the source
Second, add token: Each request generates a token

Security testing-CSRF attacks and defenses

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.