CSRF: Cross-Site Request Forgery
A booby-trapped site or message can make your browser act for you on a service where you are logged in. Here is the mechanism and the defenses.
In 30 seconds
- Where it happens
- On most web services without CSRF protection, when you open a booby-trapped link or page in the same browser1.
- What the attacker wants
- To trigger an action that changes something, such as a transfer or a password change1.
- The reflex
- Log out of a service when you have finished using it2.
- Where the flaw comes from
- From the application, not from the user2.
What it is
CSRF (Cross-Site Request Forgery) is an attack that forces a user to perform unwanted actions on a web application where they are already authenticated1. The attacker does not need the victim's password: the attacker makes the victim's browser act.
For an employee, the typical scenario is simple. A mailbox or a banking site is open in a tab. A link received by e-mail or instant messaging leads to another page, and that page triggers, in the background, a request to the service that is still logged in1.
Straight answers
Does CSRF steal my password?
No, not as such. The attack borrows the victim's identity and rights to carry out an action in their place1. It targets actions that change the state of the service, such as changing the e-mail address or the password, or buying something. Forcing the victim to view data gives the attacker no benefit, because the victim receives the response, not the attacker1.
Why does the service obey a request I did not make?
Because it cannot tell it apart from a legitimate request. For most sites, browser requests automatically include the credentials associated with the site, such as the session cookie1. If the user is authenticated, the site therefore has no way to separate the forged request from the genuine one1. The CWE describes the weakness this way: the application does not verify, or cannot verify, that a request was intentionally provided by the user who sent it5.
Am I protected if the service uses HTTPS?
No. According to OWASP, HTTPS alone does not protect against CSRF, even though it remains a prerequisite for the other measures to be reliable1.
Does the problem come from me or from the application?
From the application. Microsoft says so plainly: CSRF vulnerabilities are fundamentally a problem of the web application, not of the end user2. The user's actions only limit exposure: logging out when finished and regularly clearing the browser's cookies2.
1Inside the attacker's head1 min
The attacker starts by spotting a request that changes something on a service, then builds an address or a script that reproduces it with their own values. OWASP gives the example of a fictional bank: the legitimate request transfers 100 dollars to a beneficiary, and the attacker replaces the beneficiary with themselves and raises the amount1.
What remains is to get the victim to load that request while logged in. Two methods are cited: an unsolicited e-mail with HTML content, or a trap placed on pages the victim is likely to visit while using their online service1.
The attack can also be stored on the vulnerable site itself, for example in a field that accepts HTML. It then becomes more likely: the victim is more willing to view a page of the site than an arbitrary page on the Internet, and is necessarily already logged in there1.
2What you see on screen1 min
Often, nothing. The booby-trapped link can be disguised as an ordinary link, with text such as "see my photos". It can also take the form of a fake image of zero size: if it appears in an e-mail, the victim sees nothing, but the browser still sends the request, with no visual sign that the operation took place1.
Neutralized illustration, not a real address.
Disguised link: displayed text "See my photos", hidden address
hxxp://banque[.]exemple[.]invalid/virement?dest=[attacker's account]&montant=[high]
Variant: invisible image in an e-mail, loaded without a click.If the service expects a POST request, the attacker can host on their site a form with hidden fields. The victim believes it does something else and clicks, or else a script sends it automatically when the page loads1. In both cases, the page displayed is ordinary and the action takes place elsewhere.
3Under the hoodIT teams2 min
The mechanism rests on normal browser behavior. Browsers store the cookies issued by an application, including the session cookies of authenticated users, and they send all of a domain's cookies with every request, whatever way that request originated in the browser2. Cookies are not the only thing at issue: Basic and Digest authentication are also vulnerable, because the browser automatically resends the credentials until the end of the session2.
Several defense ideas do not work, according to OWASP1:
- a secret cookie, since all cookies are sent with every request;
- accepting only POST requests, since a hidden form is enough to forge one;
- multi-step transactions, as long as the attacker can predict each step;
- checking the Referer header alone, because it can be forged, and it is sometimes absent for privacy reasons.
The recommended protections, on the application side, are as follows.
- First check whether the framework already offers CSRF protection, and use it. Failing that, add anti-CSRF tokens to all requests that change state and validate them on the server side3. Without a token, the attacker cannot build a valid request3.
- For stateless software, use a double-submit cookie, preferably signed3.
- Set the SameSite attribute on session cookies3. With the strict value, the browser does not send the cookie on cross-site requests, even when following an ordinary link. With lax, it sends it for a link followed from another site but withholds it on methods exposed to CSRF such as POST4. With none, no protection is offered4.
- Check the origin with standard headers, notably Sec-Fetch-Site, supported by all major browsers since March 20233.
- Do not use GET requests for operations that change state3.
These measures have limits. SameSite=Lax lets top-level navigation GET requests through: an endpoint that changes state via GET remains vulnerable2. Older browsers may not enforce SameSite2. And an XSS flaw can bypass all anti-CSRF protections; the Samy worm, for example, used an XMLHttpRequest to obtain the CSRF token and forge requests13. The default behavior of SameSite varies: in December 2024, lax was the default in Chrome, Edge and Opera, but in no version of Firefox or Safari, hence the advice to set it explicitly4.
4Case filesReal cases1 min
2008: the uTorrent exploit
OWASP cites, as a real example of a CSRF attack against an application working through GET requests, an exploit targeting uTorrent dating from 2008. It was used on a large scale to download malware1. The source says no more: neither the number of victims nor the means of distribution.
Flaws cataloged by the CWE (identifiers from 2004 to 2009)
CWE-352 gives a selected list of observed examples, which is not exhaustive5. Several rely on a simple URL in an img tag: CVE-2004-1703 and CVE-2004-1995 allow user accounts to be added, CVE-2004-1842 allows gaining administrator privileges5. Others affect administration itself: CVE-2009-3520 allows the administrator's password to be changed, and CVE-2009-3759 allows changing passwords or shutting down a virtual machine from a web interface5.
Fact sheet
- Identifier
- CP-053
- Wing
- 1. Attacks and techniques
- Brain skill
- Understanding Hacking Mechanics (understand_hacking)
- Brain reflex
- cr-018
- Diagram
- G3 · System & Protocol Anatomy
- Languages
- de, en, fr
- Sources
- 5 sources checked on 3 November 2026
Sources5 sources
- OWASP, “Cross Site Request Forgery (CSRF) | OWASP Foundation”. https://community.owasp.org/attacks/csrf (accessed 3 November 2026)
- Microsoft, “Prevent Cross-Site Request Forgery (XSRF/CSRF) attacks in ASP.NET Core”. https://learn.microsoft.com/en-us/aspnet/core/security/anti-request-forgery?view=aspnetcore-10.0 (accessed 3 November 2026)
- OWASP, “Cross-Site Request Forgery Prevention - OWASP Cheat Sheet Series”. https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html (accessed 3 November 2026)
- OWASP, “SameSite | OWASP Foundation”. https://community.owasp.org/SameSite (accessed 3 November 2026)
- MITRE, “CWE - CWE-352: Cross-Site Request Forgery (5.0)”. https://cwe.mitre.org/data/definitions/352.html (accessed 3 November 2026)
Cite this article
Brain, “CSRF: Cross-Site Request Forgery”, Cyberpedia, 2026. https:/
BibTeX
@misc{brain_cp053_en_2026,
author = {Brain},
title = {CSRF: Cross-Site Request Forgery},
year = {2026},
howpublished = {Cyberpedia},
url = {https://startbrain.io/cyberpedia/en/articles/csrf-cross-site-request-forgery/},
note = {CC BY 4.0}
}