当前位置:网站首页>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
边栏推荐
- Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
- Help change the socket position of PCB part
- Why should we do feature normalization / standardization?
- DriveSeg:动态驾驶场景分割数据集
- Go home early today
- PyTorch中在反向传播前为什么要手动将梯度清零?
- 2022.02.11
- Latex image rotates with title
- Ego planner code parsing Bspline_ Optimizer section (1)
- Smart wax therapy machine based on STM32 and smart cloud
猜你喜欢

235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
![leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]](/img/d4/cbbaec40119be6cb5594899e348261.png)
leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]

application

Think of new ways

leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】
![[optics] vortex generation based on MATLAB [including Matlab source code 1927]](/img/9b/b7f462e2ecbff0cee35e7de5c80cf7.jpg)
[optics] vortex generation based on MATLAB [including Matlab source code 1927]

Does SQL always report foreign key errors when creating tables?
![[leetcode] [SQL] notes](/img/8d/160a03b9176b8ccd8d52f59d4bb47f.png)
[leetcode] [SQL] notes

【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁

Ctrip will implement a 3+2 work system in March, with 3 days on duty and 2 days at home every week
随机推荐
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)
Free year-end report summary template Welfare Collection
Zhengda futures news: soaring oil prices may continue to push up global inflation
Yolov3 network model building
Ego planner code parsing Bspline_ Optimizer section (2)
The earliest record
Day_ 18 IO stream system
知其然,而知其所以然,JS 对象创建与继承【汇总梳理】
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
Find the median of two positive arrays
Scrape crawler framework
Why should the gradient be manually cleared before back propagation in pytorch?
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
What does a really excellent CTO look like in my eyes
Typescript configuration
Record: solve the problem that MySQL is not an internal or external command environment variable
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
Simulation scheduling problem of SystemVerilog (1)
How to read the source code [debug and observe the source code]