CSRF Vulnerability - Principles and defense

CSRF vulnerability principle

  •  CSRF (Cross Site Request Forgery, CSRF) is a network attack, also referred to as "One Click Attack" or Session Riding, often abbreviated as CSRF or XSRF.
  •  CSRF vulnerability because the web application when the user performs a sensitive operation, such as modifying account password, an account is added, transfers, etc., form no check or token values ​​referer http request header, resulting malicious attackers using the normal user ( cookie) to complete the attack.
  • The course of a CSRF attack, the victim needs to be done in two steps in order:
  • 1. Log in to trusted sites A, and generates Cookie locally.
  • 2. A period of survival in a cookie, visit dangerous websites B.

CSRF high-risk trigger point

  • Forum for the exchange
  • User Center
  • Inquiry
  • Transaction Management
  • Backstage management

CSRF vulnerabilities harm

  • 1, CSRF vulnerabilities could cause the victim to post a message in the forum without the knowledge of, subscribe to mailing lists, online shopping or stock trading, or change the user name or password. For all web application firewall-protected, CSRF attacks can bypass the firewall attack web applications.
  • 2, CSRF vulnerabilities such as XSS vulnerability can also be used in combination to further increase the vulnerability of the harm.
  • 3, forged HTTP requests unauthorized operation:
  •      Tampering, steal user important data on the target site.
  •      Unauthorized user to perform harmful actions on the reputation or assets, such as: the spread of harmful information, consumption.
  •      If the attack site administrator by using the social workers, etc., would endanger the security of the site itself.
  • 4, as another attack vector of auxiliary methods of attack, such as with XSS.
  • 5, CSRF worms spread.

Vulnerabilities defensive approach

  • Referer validation
  • Token validation
  • Increase CAPTCHA

to sum up

  • CSRF攻击的核心是伪造请求,识别这种的攻击的重点就是判断当前操作是否伪造;通过在当前页面生成随机Token,后端业务逻辑在处理操作时,应该先校验Token的有效性,然后才能处理业务流程。尤其在核心业务中,采用Token+Referer的组合进行操作验证;采用验证码校验操作是因为攻击者无法预知验证码的值,进而无法构造有效的攻击;但毫无疑问,验证码会一定程度地影响用户体验,所以我们要在安全和用户体验之间找到一个平衡点。
发布了43 篇原创文章 · 获赞 145 · 访问量 5387

Guess you like

Origin blog.csdn.net/cldimd/article/details/105007957