CSRF in JSON Requests: A Real-World Exploit on Payout Features
The payout feature accepted JSON requests without a CSRF token and with a session cookie set to SameSite=None, allowing an attacker to forge a request from a malicious site. An attacker could trick a logged-in user into submitting bank details, potentially redirecting payouts to the attacker's account.
Published on medium.com
While testing a ticket-selling website, I discovered a critical flaw in its payout feature. Users submit their bank details to receive payouts when their tickets are sold, but I found that this process is vulnerable to Cross-Site Request Forgery (CSRF).
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server did not require a CSRF token and accepted text/plain content type for a JSON endpoint, while the session cookie had SameSite=None.
Impact
An attacker could add their own bank details to a victim's payout settings, potentially redirecting future payouts to the attacker.
What the attacker needed
Victim is logged in; victim visits attacker's page
The fix
The server should require a CSRF token and set the session cookie to SameSite=Lax or Strict.
How it was found
- The attacker creates a malicious webpage with a form that posts to the payout endpoint.
- The form uses enctype text/plain to send a JSON-like body.
- The victim visits the malicious page while logged in.
- The form auto-submits, sending the victim's session cookie.
- The server accepts the request and adds the attacker's bank details.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report is about a website that lets users add bank details for payouts. The site did not check that the request came from its own pages, and the login cookie was sent even when the user visited other sites. So an attacker could make a page that silently submits a form to the payout endpoint, and the victim's browser would include their login cookie, causing the site to save the attacker's bank details.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.