Cross-site request forgery attack

The attacker forges the HTTP request of the target user, and then sends the request to a website with CSRF vulnerability. After the website executes the request, a cross-site request forgery attack is triggered.

The attacker uses a hidden HTTP connection to let the target user click the link without noticing. Since the user clicked by himself, and he is a legitimate user with legal rights, the target user can execute a specific HTTP in the website. link, so as to achieve the attacker's purpose.

It is different from the XSS attack method. XSS exploits vulnerabilities to affect users in the site, and the attack target is users in the same site, while CSRF affects the interests of the victim users in the Web system by disguising as the victim user and sending malicious requests.

E.g:

When purchasing a product on a shopping website, http://www.shop.com/buy.php?item=watch&num=100 is used. The item parameter determines what item to buy, and the num parameter determines the quantity to be purchased. method to send the link to the target user, then if the target user accidentally visits, the number of purchases will become 100

Prevention method

  • Check the source of the page
  • Check for built-in hidden variables
  • Use POST, don't use GET, and don't use $_REQUEST directly for handling variables

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325520977&siteId=291194637