Skip to content
CSRF Disclosed report Beginner

CSRF csrftoken in cookies

The application stored its CSRF token in a cookie rather than keeping it separate from session cookies. The reporter argued that if the cookie were intercepted, the CSRF token would also be exposed, weakening protection against cross-site request forgery.

promx Follow

Originally disclosed on HackerOne

  • Disclosed after 2 months

Hi,

Your web application generates CSRF token values inside cookies which is not a best practice for web applications as revelation of cookies can reveal CSRF Tokens as well. Authenticity tokens should be kept separate from cookies and should be isolated to change operations in the account only.

More description: This report tells that the CSRF tokens are present inside of the cookies value which is not a best practice and if the cookie is intercepted and compromised than the CSRF token will also be vulnerable.

This is the Captured request of edit Statement HTTP ,In this request you can see CSRF token is generating in cookies named as csrftoken

HTTP/1.1 200 OK Connection: close Server: gunicorn Date: Wed, 05 Oct 2016 23:09:42 GMT Cache-Control: no-cache X-Gratipay-Version: 1986 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Content-Type: text/html; charset=UTF-8 Set-Cookie: csrf_token=zxRkWnGq3I5bMcXDRUWuWWXjxdsO1JtZ; expires=Wed, 12 Oct 2016 23:09:42 GMT; Path=/; secure X-Xss-Protection: 1; mode=block Via: 1.1 vegur Content-Length: 400168

Regards, Promx

Attachments

gratipay.png
gratipay.png From the original on HackerOne

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

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 application reused a cookie to carry the CSRF token instead of generating a separate per-session or per-form token stored server-side.

Impact

If an attacker could intercept the cookie, they could also obtain the CSRF token, which may weaken the site's defence against forged requests.

What the attacker needed

Attacker can intercept the victim's cookie

The fix

The CSRF token should be kept separate from cookies and limited to state-changing operations.

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.

A CSRF token is a secret value a website puts in forms so it can tell a real action by the user from a forged one sent by another site. This report says the site kept that secret inside a cookie, which is a file the browser stores and sends back. If someone steals the cookie, they also get the token, so the protection is weaker.

What is CSRF?

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

More from Gratipay

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.