当前位置:网站首页>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
边栏推荐
- Ego planner code parsing Bspline_ Optimizer section (1)
- Briefly describe the quantitative analysis system of services
- 我們做了一個智能零售結算平臺
- Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
- Add control at the top of compose lazycolumn
- [mathematical modeling] ship three degree of freedom MMG model based on MATLAB [including Matlab source code 1925]
- Thinking about festivals
- 组策略中开机脚本与登录脚本所使用的用户身份
- Analysis of dart JSON encoder and decoder
- KINGS
猜你喜欢
![[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]](/img/fc/00835b95537cf889588502a3d13bc9.png)
[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]

leetcode:11. 盛最多水的容器【雙指針 + 貪心 + 去除最短板】

In addition to the prickles that pierce your skin, there are poems and distant places that originally haunt you in plain life

Smart wax therapy machine based on STM32 and smart cloud

SQL injection for Web Security (1)

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

VLAN experiment

记录在模拟器中运行flutter时报的错
![[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time](/img/06/5a37e2dca9711f8322b657581c3d75.png)
[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time

235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
随机推荐
Ego planner code parsing Bspline_ Optimizer section (1)
What does a really excellent CTO look like in my eyes
EGO Planner代码解析bspline_optimizer部分(3)
Pan for in-depth understanding of the attention mechanism in CV
Ego planner code parsing Bspline_ Optimizer section (2)
High concurrency architecture cache
Why should the gradient be manually cleared before back propagation in pytorch?
Processing of user input parameters in shell script
EGO Planner代碼解析bspline_optimizer部分(1)
VLAN experiment
A green plug-in that allows you to stay focused, live and work hard
东数西算拉动千亿产业,敢啃“硬骨头”的存储厂商才更有机会
Day_ 18 IO stream system
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
Ctrip will implement a 3+2 work system in March, with 3 days on duty and 2 days at home every week
The way to treat feelings
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
Database creation, addition, deletion, modification and query
FBI warning: some people use AI to disguise themselves as others for remote interview
【光学】基于matlab介电常数计算【含Matlab源码 1926期】