当前位置:网站首页>Web Security (VIII) what is CSRF attack? Why can token prevent csdf attacks?
Web Security (VIII) what is CSRF attack? Why can token prevent csdf attacks?
2022-07-03 19:08:00 【jinyangjie0】
CSRF Attack Overview
**CSRF(Cross Site Request Forgery)** yes Cross-site request forgery .
Cookie There is an expiration time , In the meantime ,Cookie It's stored on the client side , When you visit the same website again , The browser will automatically HTTP The request will automatically bring the information of the website user after logging in Cookie
CSRF The attack takes advantage of this , Borrow the user's Cookie, To perform operations that are not intended by the user .
for instance :
Xiao Ming logs in to an online bank , He came to the post area of online banking , See a post with a link below it “ Scientific financial management , The annual profit rate is over ten thousand ”, Xiaozhuang opens this link curiously , It turned out that I had less accounts 10000 element . This is the case ? It turns out that the hacker hid a request in the link , This request directly used Xiao Ming's identity to send a transfer request to the bank , Through your Cookie Make a request to the bank .
<a src=http://www.mybank.com/Transfer?bankId=11&money=10000> Scientific financial management , The annual profit rate is over ten thousand </>
So simple use Cookie, Will receive CSRF attack .
Then why Token Can prevent CSDF Attack ?
token The rule of verification is , Server slave request body (POST) Or request parameters (GET) Get the setting in token, And then Cookie Medium token Compare , The request is executed only after it is consistent .
and CSRF The attack just borrowed Cookie, Can't get Cookie Information in , So we can't get Cookie Medium token, You can't send a request in POST perhaps GET Set in token, When sending a request to the server ,token Verification failed , Then the request will not be processed .
therefore ,token Can prevent CSRF attack .
CSRF Protection strategy
CSRF Usually from a third-party website , The attacked website can't prevent the attack , Only by enhancing your website for CSRF To improve safety .
CSRF There are two characteristics :
- CSRF( Usually ) Occurs in third party domain names .
- CSRF The attacker can't get Cookie Etc , Just use .
For these two points , We can specifically develop protection strategies , as follows :
- Block access to unknown domains
- Homology detection , That is, forbid foreign domains directly ( Or untrusted domain names ) Make a request to us .
- Samesite Cookie, In order to solve this problem from the source ,Google A draft was drawn up to improve HTTP agreement , That's for Set-Cookie New response header Samesite attribute , It's used to mark this Cookie It's a “ Same station Cookie”, Same station Cookie Only as the first party Cookie, Not as a third party Cookie.
- When submitting, it is required to attach the information of this domain
- CSRF Token
- double Cookie verification
边栏推荐
- Compose LazyColumn 顶部添加控件
- Getting started with JDBC
- User identity used by startup script and login script in group policy
- Free year-end report summary template Welfare Collection
- Random numbers in a long range, is that right- Random number in long range, is this the way?
- 平淡的生活里除了有扎破皮肤的刺,还有那些原本让你魂牵梦绕的诗与远方
- 235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
- 利用可视化结果,点击出现对应的句子
- How to design a high concurrency system
- Help change the socket position of PCB part
猜你喜欢

2020 intermediate financial management (escort class)

Summary of composition materials for 2020 high-frequency examination center of educational resources

Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)

【光学】基于matlab介电常数计算【含Matlab源码 1926期】

Nous avons fait une plateforme intelligente de règlement de détail

Su embedded training - Day10

Recommend a simple browser tab

01. Preparation for automated office (free guidance, only three steps)
![[leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult](/img/8d/0e515af6c17971ddf461e3f3b87c30.png)
[leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult

22.2.14 -- station B login with code -for circular list form - 'no attribute' - 'needs to be in path selenium screenshot deviation -crop clipping error -bytesio(), etc
随机推荐
Bad mentality leads to different results
Common PostgreSQL commands
【LeetCode】【SQL】刷题笔记
【数学建模】基于matlab船舶三自由度MMG模型【含Matlab源码 1925期】
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
Find the median of two positive arrays
Ego planner code parsing Bspline_ Optimizer section (3)
知其然,而知其所以然,JS 对象创建与继承【汇总梳理】
22.2.14 -- station B login with code -for circular list form - 'no attribute' - 'needs to be in path selenium screenshot deviation -crop clipping error -bytesio(), etc
Summary of composition materials for 2020 high-frequency examination center of educational resources
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
Using the visualization results, click to appear the corresponding sentence
[leetcode周赛]第300场——6110. 网格图中递增路径的数目-较难
Streaming media server (16) -- figure out the difference between live broadcast and on-demand
Zero length array
Why should we do feature normalization / standardization?
leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】
[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
Analyse du Code du planificateur ego bspline Section Optimizer (1)
Scrapy爬虫框架