CSRF in Raffles Ticket Purchasing
An API endpoint for entering raffles did not check a CSRF token or validate the session identifier in the submitted form. An attacker could make an authenticated user submit a crafted form that spends the user's balance on raffle tickets.
- Fixed in 7 days
- Paid in 8 days
- Disclosed after 6 months
Description:
An API endpoint get executed with no CSRF prevention, the endpoint did not verify session_id required in the post form. An attacker can crafted malicious form (Poc), which is executed by authenticated user action leading to huge balance lost.
Poc:
<!doctype html> <html> <head> </head> <body> <form action="https://unikrn.com/apiv2/raffle/enter" method="POST" name="myForm"> <input type="hidden" name="raffle" id="raffle" value="4775"> <input type="hidden" name="tickets" id="tickets" value="1"> <input type="hidden" name="session_id" id="session_id" value=""> <input value="Submit" type="submit""> </form> </body> </html>Recommendations:
- Implementing CSRF tokens.
- Validate session_id on post form/JSON api input.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the raffle entry endpoint accepted state-changing POST requests without a CSRF token and without validating the session identifier supplied in the form.
Impact
An authenticated user could lose a large amount of account balance by submitting a crafted form.
What the attacker needed
Victim is logged in; victim visits attacker page; victim submits the form
The fix
The endpoint should require a CSRF token and validate the session identifier on POST form or JSON API input.
How it was found
- Create an HTML page containing a form that posts to the raffle entry endpoint with a raffle identifier, a ticket count and an empty session identifier.
- Get an authenticated user to open the page and submit the form.
- The endpoint processes the request without CSRF protection, entering the raffle and deducting balance.
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 report has not been written yet. The Original tab links to the source.
When you are logged in to a website, your browser automatically sends your session cookie with every request to that site. If the site does not check for a special secret token in each form submission, another website can make your browser send a request that you did not intend, such as buying raffle tickets. This is called cross-site request forgery (CSRF).
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.