Skip to content
CSRF Disclosed report Beginner

No CSRF protection when adding an item to cart

A state-changing POST request lacked CSRF protection, so an attacker could trick a logged-in user into triggering it unknowingly.

themarkib0x0 Follow

Originally disclosed on HackerOne

  • Disclosed after 4 months

Summary by the program

The given report highlights a security vulnerability in a web application. Specifically, a state-changing POST request to "██████" lacks proper authentication, making it susceptible to Cross-Site Request Forgery (CSRF) attacks. This means that an attacker could manipulate users into unknowingly and involuntarily triggering sensitive actions on the website. The absence of proper authentication opens up the possibility of unauthorized and malicious exploitation of the web application.

The original report as published on HackerOne, by themarkib0x0. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What the report shows

The report concerns a state-changing POST request to a redacted endpoint. The researcher reported that the state-changing POST request used for this action, whose endpoint is redacted in the disclosed text as ██████, lacks proper authentication. The report says the request lacks proper authentication and classifies the issue as CSRF.

The report itself is short and consists of a program summary rather than a step-by-step walkthrough. What it states is:

  1. Adding an item to the cart is performed with a POST request to the redacted endpoint.
  2. That request lacks proper authentication.
  3. As a result, an attacker could manipulate a logged-in user into unknowingly and involuntarily triggering the action.

The program's summary describes the absence of proper authentication as opening the possibility of unauthorised and malicious exploitation of the application. The report does not include the raw request, any payload, or a reproduction sequence, so there is nothing further to reproduce here.

The platform records the issue as low severity with a CVSS score of 3.8, weakness class Cross-Site Request Forgery (CSRF), disclosed on 30 January 2024. No bounty amount is recorded. The report does not describe a fix.

Root cause

The report points to a state-changing POST endpoint that lacks proper authentication. The report frames this as missing authentication on the request. The report says an attacker could manipulate users into triggering the action unknowingly.

Impact

Keeping to the report's own hedging, an attacker could manipulate users into unknowingly and involuntarily triggering sensitive actions on the site. The report does not go further than that: it does not describe price manipulation, cart takeover, or any downstream effect, and it does not claim that the issue was demonstrated against a live victim. The platform records the issue as low severity.

How this kind of bug works

Browsers attach cookies to requests based on the destination, not the origin of the page that caused the request. If a user is logged in to a site and then visits a malicious page, that page can submit a form or fire a request to the site, and the browser will include the user's session cookie. The server sees a valid session and performs the action. Nothing in the request tells the server whether the user intended it.

CSRF defences work by adding something the attacker's page cannot supply:

  • Anti-CSRF tokens: a per-session or per-request random value embedded in forms and checked server-side. A cross-site page cannot read the token, so it cannot forge a valid request.
  • SameSite cookies: marking the session cookie SameSite=Lax or Strict stops it being sent on cross-site subrequests, which blocks most classic CSRF.
  • Origin and Referer checks: rejecting state-changing requests whose Origin header does not match the application.
  • Custom headers: requiring a header that cannot be set cross-origin without a CORS preflight, which the target will not approve.
  • Re-authentication: requiring the password or a fresh confirmation for sensitive actions.

APIs that rely purely on cookies and accept simple form-encoded or JSON bodies without any of the above are the usual candidates.

How to test for it

  1. Identify state-changing requests: anything that creates, updates or deletes data, or changes account settings. Watch the proxy history while using the feature normally.
  2. Note how the request is authenticated. If it relies only on a cookie and carries no token parameter, no custom header and no origin check, it is a candidate.
  3. Check the cookie's SameSite attribute. If it is Lax or Strict, classic cross-site form submission will not carry it, and the attack surface narrows considerably.
  4. Build a proof of concept on a separate origin: an HTML page that submits an equivalent form to the endpoint, or a fetch with the appropriate content type. Host it on a different domain from the target.
  5. Log in as a test user, visit the attacker page, then check the target application to see whether the action occurred.
  6. Confirm the server does not validate Origin or Referer by sending the request with those headers absent or set to a foreign origin.

A positive result is a state change on the target that the victim did not initiate, observed in the application's own UI or API. Common false positives:

  • The endpoint returns success but performs no change.
  • The action is idempotent or harmless, such as a logout, which programs often treat as out of scope.
  • The cookie is SameSite=Lax and the request is a cross-site POST, so the browser never sends the session and the test only appears to work because you were already authenticated in the same tab.
  • A token is present but you removed it manually; the server may reject requests without it even though the UI does not show one.
  • CORS misconfigurations that let you read responses are a different bug class and should be reported separately.

How it is fixed

  • Require a synchroniser or double-submit anti-CSRF token on every state-changing request and validate it server-side.
  • Set session cookies with SameSite=Lax or Strict, and Secure where appropriate.
  • Validate the Origin header, falling back to Referer, and reject requests from unexpected origins.
  • For JSON APIs, require a custom header or a content type that triggers a preflight, and reject requests that fail it.
  • Require re-authentication for high-impact actions.

Hunting notes

CSRF tends to hide in older parts of an application: cart and checkout flows, profile and email change forms, address books, notification preferences, and any endpoint that predates a framework-wide token. Look for endpoints that accept form-encoded POSTs, endpoints where the token parameter is optional, and JSON APIs that accept text/plain bodies. Recon signals include session cookies without SameSite, forms in the HTML with no hidden token field, and JavaScript that builds requests without a token header.

To get a report accepted, show a concrete state change caused by a cross-origin request from a page you control, with the before and after state visible in the application. Keep the impact realistic: describe exactly what the forged action does and avoid claiming consequences the demonstration does not show. If the action is low value, expect a low severity.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

This report is about a state-changing POST request that lacks proper authentication, which the report classifies as CSRF.

Let us start from the beginning. A web application is a program you use through your browser, such as an online shop.

Under the hood, clicking that button makes your browser send a request to the server. A request is simply a message your browser posts to a computer somewhere else, asking it to do something or to send something back. When you load a page, the request asks for content. A state-changing request asks the server to change something. Requests that change data are called state-changing requests, and this one uses a method called POST, which is the usual way browsers submit forms and send data that should not simply be fetched by loading a link.

The researcher reported that this POST request, whose address (the endpoint) is blacked out in the disclosed text as ██████, lacks proper authentication. Authentication here means proving that a request really comes from the person it claims to come from, and that the person meant to make it. The report classifies the problem as Cross-Site Request Forgery, or CSRF.

To understand CSRF, you need to know what a cookie is. When you log in to a site, the server sends your browser a small piece of data, the session cookie, which the browser stores and attaches to every later request to that same site. It works like a wristband at an event: you show your ticket once, get the band, and after that the staff let you in and out without asking for the ticket again. The server sees the cookie and knows which account is asking.

The catch is that browsers decide whether to attach the cookie based on where the request is going, not on which page caused it. In general, a malicious page can make your browser send a request to a site you are logged in to, and the browser attaches your session cookie.

The report's summary puts it this way: an attacker could manipulate users into unknowingly and involuntarily triggering sensitive actions on the website, and the absence of proper authentication opens the possibility of unauthorised and malicious exploitation of the application.

That is the whole of what the report states. It does not include the raw request, any payload, or a reproduction sequence, so there is nothing further to reproduce here. The platform records the issue as low severity with a CVSS score of 3.8, weakness class Cross-Site Request Forgery (CSRF), disclosed on 30 January 2024. No bounty amount is recorded, and the report does not describe a fix.

The platform records the issue as low severity. The report does not describe price manipulation, cart takeover or any downstream effect, and it does not claim the issue was demonstrated against a live victim. A single low-value state change fits a low rating.

In general, how this kind of bug works

The root cause is a state-changing endpoint that identifies the user only by the cookie the browser sends automatically, with no per-request proof that the request came from the application's own pages. The report says the request lacks proper authentication.

CSRF defences work by requiring something the attacker's page cannot supply:

  • Anti-CSRF tokens: a random value, per session or per request, embedded in forms and checked on the server. A page on another site cannot read the token, so it cannot forge a valid request.
  • SameSite cookies: marking the session cookie SameSite=Lax or Strict stops it being sent on cross-site subrequests, which blocks most classic CSRF.
  • Origin and Referer checks: rejecting state-changing requests whose Origin header does not match the application.
  • Custom headers: requiring a header that cannot be set cross-origin without a CORS preflight, which the target will not approve.
  • Re-authentication: asking for the password or a fresh confirmation before sensitive actions.

APIs that rely purely on cookies and accept simple form-encoded or JSON bodies without any of the above are the usual candidates.

How to test for it

  1. Identify state-changing requests: anything that creates, updates or deletes data, or changes account settings. Watch the proxy history while using the feature normally. A proxy is a tool that sits between your browser and the site and records every request and response, like a logbook of the conversation.
  2. Note how the request is authenticated. If it relies only on a cookie and carries no token parameter, no custom header and no origin check, it is a candidate.
  3. Check the cookie's SameSite attribute. If it is Lax or Strict, classic cross-site form submission will not carry it, and the attack surface narrows considerably.
  4. Build a proof of concept on a separate origin: an HTML page that submits an equivalent form to the endpoint, or a fetch with the appropriate content type. Host it on a different domain from the target. A proof of concept is a small, harmless demonstration that the bug is real.
  5. Log in as a test user, visit the attacker page, then check the target application to see whether the action occurred.
  6. Confirm the server does not validate Origin or Referer by sending the request with those headers absent or set to a foreign origin. These two headers are notes the browser adds to a request saying which page it came from.

A positive result is a state change on the target that the victim did not initiate, observed in the application's own interface or API. Common false positives:

  • The endpoint returns success but performs no change.
  • The action is idempotent or harmless, such as a logout, which programs often treat as out of scope.
  • The cookie is SameSite=Lax and the request is a cross-site POST, so the browser never sends the session and the test only appears to work because you were already authenticated in the same tab.
  • A token is present but you removed it manually; the server may reject requests without it even though the interface does not show one.
  • CORS misconfigurations that let you read responses are a different bug class and should be reported separately.

How it is fixed

  • Require a synchroniser or double-submit anti-CSRF token on every state-changing request and validate it on the server.
  • Set session cookies with SameSite=Lax or Strict, and Secure where appropriate.
  • Validate the Origin header, falling back to Referer, and reject requests from unexpected origins.
  • For JSON APIs, require a custom header or a content type that triggers a preflight, and reject requests that fail it.
  • Require re-authentication for high-impact actions.

Where to look

CSRF tends to hide in older parts of an application: cart and checkout flows, profile and email change forms, address books, notification preferences, and any endpoint that predates a framework-wide token. Look for endpoints that accept form-encoded POSTs, endpoints where the token parameter is optional, and JSON APIs that accept text/plain bodies. Signals to watch for include session cookies without SameSite, forms in the HTML with no hidden token field, and JavaScript that builds requests without a token header.

To get a report accepted, show a concrete state change caused by a cross-origin request from a page you control, with the before and after state visible in the application. Keep the impact realistic: describe exactly what the forged action does and avoid claiming consequences the demonstration does not show. If the action is low value, expect a low severity.

Glossary

  • Web application: a program you use through a browser, such as an online shop.
  • Request: a message your browser sends to a server asking it to do something or return something.
  • State-changing request: a request that creates, updates or deletes data rather than just reading it.
  • POST: the HTTP method browsers typically use to submit forms and send data that changes something.
  • Endpoint: the address a request is sent to.
  • Authentication: proving that a request comes from the person it claims to, and that the person meant to make it.
  • Cookie: a small piece of data a site stores in your browser, used here to keep you logged in between requests.
  • Session cookie: the cookie that identifies your logged-in session to the server.
  • CSRF (Cross-Site Request Forgery): a weakness where another website can make your browser send a request to a site you are logged in to, and the site acts on it as if you had asked.
  • CVSS score: a standard numeric rating of how severe a vulnerability is.
  • Severity: the overall seriousness rating given to an issue, here low.
  • Anti-CSRF token: a random value placed in forms and checked by the server, which another site cannot read or guess.
  • SameSite: a cookie setting that controls whether the cookie is sent on requests caused by other sites.
  • Origin header: a note the browser adds to a request saying which site the request came from.
  • Referer header: a note the browser adds saying which page linked to or triggered the request.
  • CORS: the browser rules that decide whether a page on one site may read responses from another site.
  • Preflight: an automatic check the browser sends before certain cross-site requests, which the target must approve.
  • Proxy: a tool that sits between your browser and a site and records the requests and responses.
  • Proof of concept: a small, harmless demonstration showing that a bug is real.
  • Idempotent: an action that gives the same result whether performed once or many times.
  • False positive: a test result that looks like a bug but is not one.

More by themarkib0x0

View all

3 more disclosed reports, best first.

More from Mars

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.