일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Redux
- blockchain
- HTML
- 기준
- bitcoin
- middleware
- nextJS
- solidity
- Ethereum
- web
- evm
- CSS
- REACT
- API
- typeScript
- useState
- concept
- 삶
- graphQL
- express.js
- SSR
- built in object
- JavaScript
- CLASS
- Interface
- Props
- node.js
- hardhat
- error
- tailwindcss
- Today
- Total
ReasonJun
CSRF (Cross-Site Request Forgery) 본문
CSRF, which stands for Cross-Site Request Forgery, is a type of security vulnerability that exploits the trust a web application has in a user's browser. It occurs when an attacker tricks a victim into performing an unintended action on a web application without their knowledge or consent.
In a CSRF attack, the attacker crafts a malicious website or email that contains a specially-crafted request to the targeted web application. This request typically includes the victim's authentication cookies or session information, as their browser automatically includes them with each request to the application's domain.
When the victim accesses the attacker's website or clicks on a malicious link, the browser unknowingly sends the request to the targeted web application, authenticating it with the victim's credentials. As a result, the web application processes the request, assuming it came from the legitimate user, and performs the unintended action.
For example, imagine a banking website that allows users to transfer funds by submitting a form with the destination account and the amount. An attacker could construct a malicious webpage with a hidden form that automatically submits a transfer request to the banking website when loaded in the victim's browser. If the victim is authenticated on the banking website and visits the malicious page, the transfer request will be executed, potentially transferring funds to the attacker's account.
To prevent CSRF attacks, web applications employ various countermeasures:
- CSRF Tokens: Web applications can generate and include unique tokens in each form or request to verify the legitimacy of the request. The token is typically stored as a session or user-specific value and must be included in the request for it to be considered valid. Attackers cannot retrieve or forge these tokens, making their malicious requests ineffective.
- SameSite Cookies: Setting the SameSite attribute for cookies helps mitigate CSRF attacks. By specifying "SameSite=Strict" or "SameSite=Lax" for cookies, the browser ensures that cookies are not sent on cross-origin requests, reducing the risk of CSRF attacks.
- Referer Header Checking: The server can examine the Referer header of the incoming requests to verify that they originate from the same domain. However, this approach is not foolproof as the Referer header can be manipulated or omitted by certain browser settings.
- CAPTCHAs: Including CAPTCHAs (Completely Automated Public Turing test to tell Computers and Humans Apart) in critical forms can prevent automated CSRF attacks by requiring users to solve a challenge to prove they are human.
- Logout CSRF Protection: Implementing proper logout mechanisms can protect against CSRF attacks aimed at tricking users into unknowingly logging out of a web application.
It's important for developers to implement a combination of these countermeasures and follow secure coding practices to mitigate CSRF vulnerabilities in their web applications. Additionally, users should be cautious when clicking on unfamiliar links or accessing websites with a lower level of trust, as this reduces the risk of falling victim to CSRF attacks.
more technical
https://owasp.org/www-community/attacks/csrf
'Frontend > Network' 카테고리의 다른 글
CSR (Client-Side Rendering) vs SSR (Server-Side Rendering) (0) | 2023.06.16 |
---|---|
REST (Representational State Transfer) API (Application Programming Interface) (0) | 2023.06.16 |
XSS (0) | 2023.06.16 |
CORS (Cross-Origin Resource Sharing) (0) | 2023.06.16 |
SSL / TLS / HTTPS (0) | 2023.06.15 |