How I found CSRF(my first bounty)
The web application used a CSRF token called form_key to protect address addition, but the server did not validate the token's presence or value. An attacker could craft a request without the token and, if a victim submitted it, add the attacker's address to the victim's account.
Infosec
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This is a write-up of a Cross-Site Request Forgery (CSRF) finding on a private Bugcrowd program. The target was an e-commerce website, and the affected feature was the part of the account area where a user adds a postal address to their profile. The form submits the address details together with a token named form_key, which was being used to protect users from CSRF attacks.
The researcher's own definition of the class, as given in the post: CSRF is an attack that forces an end user to execute unwanted actions on a web application in which they are currently authenticated.
Setup
The researcher had been invited to the private program on Bugcrowd. To test the token handling he used two accounts of his own: his main account and a second test account, which he logged into to generate the CSRF proof of concept. No specific tools, versions or browser details are given in the post.
In the demonstration, the victim was logged in to the site and clicked "Submit" on the page he was sent.
Finding it
During initial reconnaissance the researcher noticed that users can add an address to their account. He inspected the request that the address form sends and saw a token named form_key being used to protect users from CSRF.

The screenshot shows the address request with the form_key token in place, captioned as the token used to protect against CSRF attacks.
That raised the obvious question: is there any server-side validation on this token? A token that is present in the form but never checked on the server gives no protection at all, so the next step was to test whether the server would accept the request without it.
Exploitation
Step 1: Generate a PoC from the second account
He logged into his second test account and generated a CSRF PoC for the address request. This gives a page that reproduces the form submission against the target.
Step 2: Remove the token value
He then removed the token from that particular request, keeping the rest of the form intact, and prepared to send it to the victim. The resulting request looked like this:

The screenshot shows the request with the form_key value removed, captioned accordingly.
The detail he highlights is that he removed the form_key value from the PoC, not the entire input tag. He removed the form_key value from the PoC, not the entire input tag.
Step 3: Deliver to the victim and observe the result
He sent the PoC to the victim. When the victim clicked "Submit", the address was added to the victim's account, and that address was the attacker's address.

The screenshot shows the attacker's address present in the victim's account after the submission.
That confirmed his suspicion: there was no server-side validation on the form_key token. The application accepted the address change even though the anti-CSRF token carried no valid value.
Root cause
The address form includes a form_key token, but the server does not validate it. The presence of the token in the form is therefore cosmetic: an attacker who controls the submitted page can drop the value and the server processes the request. Because the request is a state-changing action performed with the victim's ambient session, the browser attaches the victim's authentication automatically, and nothing else in the request proves the submission came from the site's own form.
The post does not describe the server-side code, so the exact reason the check is missing (for example a validation routine that is skipped or never called for this endpoint) is not stated; the observable fact is that no server-side validation of the token took place.
Impact
An attacker can make an authenticated victim add the attacker's address to the victim's account without the victim's intent. The victim only has to click "Submit" on the attacker's page. The attacker's address was added to the victim's account, a change to the victim's stored data. The post does not go further than describing the address being added; it does not describe any follow-on abuse such as orders being redirected.
The report was triaged as P3 and paid a $500 bounty.
Fix
The post does not say what the vendor changed. The fix implied by the finding is server-side validation of form_key on the address submission: reject the request when the token is missing, empty or does not match the value bound to the user's session, rather than relying on the token merely being present in the form.
Variants to test
- Empty the token value, keep the field. As here, submit the form with the anti-CSRF parameter present but with an empty value. A positive result is the action succeeding and the change appearing on the victim account.
- Remove the parameter entirely. Drop the token parameter from the body. A positive result is the server processing the request without it.
- Substitute a token from another session. Send a
form_keygenerated for a different account. A positive result is acceptance, which shows the token is not bound to the session. - Replay an old token. Reuse a token captured earlier from the same account after it should have expired. A positive result is acceptance after the expected lifetime.
- Try other state-changing forms. Apply the same removal test to other account forms (profile details, saved addresses, preferences). A positive result is any of them accepting a submission with a missing or invalid token.
Timeline
| Event | Date |
|---|---|
| Issue reported | 06 Nov 2019 |
| Triaged as P3 | 09 Nov 2019 |
| Bounty received | 05 Jan 2020 |
The lesson the author draws is simple: whenever you come across a CSRF token, check whether the server actually validates it.
What happened, in plain words
A security researcher found a bug on an online shopping website. The bug let an attacker add their own address to someone else's account. The victim only had to click one button on a page the attacker sent them. The researcher reported it, it was triaged as P3, and he was paid $500. It was his first ever bug bounty.
The bug belongs to a family called Cross-Site Request Forgery, or CSRF. The researcher's own definition, from his post, is this: CSRF is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated.
That sentence is dense, so let's unpack it before going further.
- A web application is a website that does things for you, not just shows text. A shop where you can save an address, place an order or change a password is a web application.
- Authenticated means the site knows who you are, because you logged in. When you log in, the site gives your browser a small piece of data (usually a cookie) that it checks on every later request. As long as that cookie is there, the site treats requests as coming from you.
- An unwanted action is something the site does on your behalf that you did not mean to do: change your address, change your email, place an order.
The trick of CSRF is that your browser automatically attaches your login cookie to every request sent to that site, no matter which page told the browser to send it. So if an attacker can make your browser send a request to the shop, the shop sees a perfectly normal, logged-in request from you. It cannot tell that you never intended it.
A useful everyday comparison: imagine a bank where the teller knows you by sight and never asks for ID again. If someone hands you a withdrawal slip already filled in and you hand it to the teller without reading it, the teller pays out, because to them it is you asking. CSRF is that pre-filled slip.
The setup
The researcher had been invited to a private program on Bugcrowd. Bugcrowd is a platform where companies invite security researchers to test their systems and pay for valid findings. A private program is one you can only join by invitation, not one open to everyone.
The target was an e-commerce website, meaning an online shop.
To test safely, he used two accounts of his own: his main account and a second test account. This is standard practice. He used his main account and a second test account.
No specific tools, software versions or browser details are mentioned in the post.
There is one condition the attack depends on: the victim must be logged in to the shop in the browser that opens the attacker's page, and must interact with that page. In this case, interact means clicking a button labelled "Submit".
Finding it
During his first look around the site, which researchers call reconnaissance (or recon), the researcher noticed that users can add a postal address to their account. That is a normal shop feature: you save where your orders should be delivered.
He inspected the request that the address form sends. A request is the message your browser sends to a website when you do something, for example when you press a button. You can see these messages in your browser's developer tools, which are built into every modern browser.
In that request he saw a token named form_key. A token here is a long random-looking value that the site puts into a form and expects back when the form is submitted. The idea is that only the site's own pages know the current token for your session, so a page from somewhere else cannot produce a valid one. It is like a cloakroom ticket: the attendant only hands back your coat if you show the matching ticket.

The screenshot shows the address request with the form_key token in place, captioned as the token used to protect against CSRF attacks.
Seeing the token raised the obvious question: does the server actually check it? This is the heart of the whole finding. A token that appears in the form but is never verified on the server gives no protection at all. It is a lock painted on a door. The only way to know is to send a request without a valid token and see whether the server still does the job.
Exploitation
Step 1: Generate a PoC from the second account
He logged into his second test account and generated a CSRF PoC. PoC stands for proof of concept: a small demonstration that proves the bug is real rather than theoretical. In CSRF testing, a PoC is usually a simple web page that contains a hidden form pre-filled with the request you want the victim's browser to send, plus a button to submit it. When the victim opens the page and clicks, their browser sends the request to the shop with their own login cookie attached.
Step 2: Remove the token value
He then removed the token from that particular request, keeping the rest of the form intact, and prepared to send it to the victim. The resulting request looked like this:

The screenshot shows the request with the form_key value removed, captioned accordingly.
The detail he highlights is that he removed the form_key value from the PoC, not the entire input tag. An input tag is the piece of a web form that holds one field, for example the box where you type your street name. Removing the whole tag would delete the field. Removing only the value leaves the field present but empty. He removed the form_key value from the PoC, not the entire input tag. It is a cleaner test: if the server accepts it, the problem is specifically that it does not check the token.
Step 3: Deliver to the victim and observe the result
He sent the PoC page to the victim. When the victim clicked "Submit", the address was added to the victim's account, and that address was the attacker's address.

The screenshot shows the attacker's address present in the victim's account after the submission.
That confirmed his suspicion: there was no server-side validation on the form_key token. Server-side validation means the website's own computer, the server, checks the data before acting on it. The browser can be made to send anything by anyone, so checks done in the browser are worthless for security. Only the server's check counts, and here there was none. The shop accepted the address change even though the anti-CSRF token carried no valid value.
Why it worked
The address form includes a form_key token, but the server does not validate it. The presence of the token in the form is therefore cosmetic: an attacker who controls the submitted page can simply drop the value, or by the same logic supply any value, and the server processes the request anyway.
Because the request is a state-changing action performed with the victim's existing session, the browser attaches the victim's authentication automatically. Nothing else in the request proves the submission came from the site's own form. The shop has no way to tell the difference between the victim filling in the form themselves and the victim's browser being told to send it by an attacker's page.
The post does not describe the server-side code, so the exact reason the check is missing is not stated. The observable fact is that no server-side validation of the token took place.
What an attacker could do with it
An attacker can make a logged-in victim add the attacker's address to the victim's account without the victim's intent. The victim only has to click "Submit" on the attacker's page.
The attacker's address was added to the victim's account. So an attacker-supplied address on a victim's account is a meaningful change to the victim's stored data. The post does not go further than describing the address being added; it does not describe any follow-on abuse such as orders being redirected.
The report was triaged as P3 and paid a $500 bounty. Triaged means the company reviewed the report and accepted it as a real issue. P3 is the priority rating the report was triaged as.
The fix
The post does not say what the vendor changed. The fix implied by the finding is server-side validation of form_key on the address submission: reject the request when the token is missing, empty or does not match the value bound to the user's session, rather than relying on the token merely being present in the form.
In plain terms: the server should compare the token it receives with the token it issued to that user, and refuse the request if they do not match. A blank token should fail. A token from someone else's account should fail. A token that has expired should fail.
Other things worth trying
Once you know a token is not checked, the same idea can be tried in several variations. Each one is a small experiment with a clear pass or fail result.
- Empty the token value, keep the field. As here, submit the form with the anti-CSRF parameter present but with an empty value. A positive result is the action succeeding and the change appearing on the victim account.
- Remove the parameter entirely. Drop the token parameter from the body of the request. A positive result is the server processing the request without it.
- Substitute a token from another session. Send a
form_keygenerated for a different account. A positive result is acceptance, which shows the token is not bound to the session. - Replay an old token. Reuse a token captured earlier from the same account after it should have expired. A positive result is acceptance after the expected lifetime.
- Try other state-changing forms. Apply the same removal test to other account forms, such as profile details, saved addresses or preferences. A positive result is any of them accepting a submission with a missing or invalid token.
Timeline
| Event | Date |
|---|---|
| Issue reported | 06 Nov 2019 |
| Triaged as P3 | 09 Nov 2019 |
| Bounty received | 05 Jan 2020 |
The lesson the author draws is simple: whenever you come across a CSRF token, check whether the server actually validates it.
Glossary
- API: a way for one piece of software to talk to another, sending requests and getting responses back. Websites use them internally to fetch and save data.
- Authenticated: the site knows who you are because you have logged in and it recognises your session.
- Browser developer tools: the built-in panel in a browser that lets you inspect the requests a page sends and the responses it receives.
- Bug bounty: a scheme where a company pays security researchers for reporting valid vulnerabilities in its systems.
- Bugcrowd: a platform that hosts bug bounty and private testing programs for companies.
- Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests, typically after you log in.
- CSRF (Cross-Site Request Forgery): an attack that forces a logged-in user to perform an action on a site they are authenticated to, without intending to.
- CSRF PoC: a proof-of-concept page that reproduces a request so a tester can show that a CSRF issue is real.
- E-commerce website: an online shop.
- Form: the part of a web page with fields you fill in and a button you press to send them.
- form_key: the name of the anti-CSRF token used by the address form in this report.
- Input tag: the piece of a web form that holds a single field and its value.
- P3: a priority rating used by the program, generally in the middle of the severity scale.
- PoC (proof of concept): a small demonstration that proves a bug is real rather than theoretical.
- Private program: a bug bounty program you can only join by invitation.
- Reconnaissance (recon): the exploratory phase of testing, where you look around a site to see what features it has and how they behave.
- Request: the message a browser sends to a website when you do something on it.
- Server: the computer that runs the website and decides what to do with each request.
- Server-side validation: checking data on the server before acting on it. Checks done in the browser can be bypassed, so only server-side checks provide real protection.
- Session: the period during which a site remembers you as logged in, identified by a cookie or similar value.
- State-changing action: anything that alters stored data, such as saving an address, changing a password or placing an order.
- Token: a random value a site puts into a form and expects back, used to prove the submission came from the site's own page.
- Triaged: reviewed and accepted by the company as a valid issue.