csrf_token cookie don't have the flag "HttpOnly"
The csrf_token cookie lacks the HttpOnly flag, which the program says is intentional for AJAX calls. An attacker could only exploit this if they already have XSS, and even then the flag would not prevent token theft.
- Disclosed after 5 months
Summary by the program
As the researcher @kuskumar pointed out, the cookie csrf_token doesn't have the HttpOnly flag. While it is often seen as bad practice to leave cookies without this flag (since they are likely to be stolen via XSS), our session cookie has this flag set, making impersonation harder. Regarding csrf_token, the flag is intentionally not set, so that we can pass the cookie automatically with our numerous AJAX calls.
This CSRF mitigation method is often misunderstood and we get a lot of reports regarding it. It has been borrowed from Django, and this subject has been discussed on their bug tracker and on other various places. We suggest taking a look at our current CSRF implementation, too. Even with the flag, in the case of a XSS (and a CSP bypass), since the attacker will already have access to the context of the current domain, nothing will prevent them from fetching a page with a form and looking for the csrf_token in the source.
Furthermore, for hardening purposes, we plan to add a password validation for sensitive actions (it has already been reported—please don't create any duplicate).
If you ever manage to create a full and working PoC demonstrating account takeover without any method related to ~ phishing (self-XSS, developer console…) as a direct consequence of the non-presence of the HttpOnly flag on csrf_token (read here "It would not have been possible with the flag / it's possible only because the flag is set"), open another report and we'll be glad to offer the highest bounty under our policy (and @nashe_ will double it (in Bitcoins) from his pocket 👌).
Thanks for making Gratipay a safer place!
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 csrf_token cookie is intentionally set without HttpOnly so that client-side AJAX calls can read it.
Impact
The missing flag could only matter if an attacker already has XSS, and even then the flag would not stop token theft; the program says no account takeover is possible from this alone.
What the attacker needed
Attacker already has XSS; attacker can bypass CSP
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.
HttpOnly is a cookie setting that stops JavaScript from reading the cookie. The report says this cookie is missing that setting, but the site's session cookie does have it. The site explains that the missing flag is on purpose and that an attacker would need another bug (like cross-site scripting) to abuse it.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.