Unauthenticated CSRF(User can input any value for CSRF Token)
The registration and login pages accept a user-supplied CSRF token without server-side verification, only checking its length. An attacker could bypass CSRF protection by setting an arbitrary token value.
- Disclosed after 46 hours
Hello Veris,
I believe you have implemented CSRF token on the registration for a reason. In my research, I found that a user supplied CSRF Token would be accepted and even saved in the browser cookie and will be the set token on subsequent request. This report is limited to the Register and Login page anyway.
And most importantly, there is no verification of the CSRF token on the server side because if there is, the request shouldn't go through to talk of being saved in the browser cookie. The only verification I can see is if the inserted token is more than set 32 characters.
PoC:
- Navigate to https://sandbox.veris.in/portal/register/
- Fill the form and the captcha as required
- Using a proxy tool, intercept the request (I'm using Burp Proxy)
- Change the value of
csrftokenin cookie field - Copy the same input and paste in
csrfmiddlewaretoken - Forward the request
- You'll get a 200 OK response
i.e Request made successfull
- In the next request, change the value of
csrftokento the one used recently. - You could now check the value of cookie in the browser.
- Bam! You found it.
I can provide a video proof if needed. I hope you understand
Thanks Shuaib Oladigbolu
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 server only checks the length of the submitted CSRF token and does not compare it to the token stored in the user's session.
Impact
CSRF protection on registration and login can be bypassed by supplying an arbitrary token value.
What the attacker needed
Access to the registration or login page; ability to intercept and modify requests
The fix
The server should verify that the submitted CSRF token matches the one stored in the user's session, not just check its length.
How it was found
- Navigate to the registration page and fill in the form and captcha.
- Intercept the request with a proxy tool.
- Change the csrftoken cookie value and set the same value in the csrfmiddlewaretoken field.
- Forward the request and observe a 200 OK response.
- In the next request, reuse the same token value and check the browser cookie.
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.
CSRF tokens are secret values a website puts in forms to prove a request came from its own pages, not from an attacker's site. Here the site accepted any token the user typed in, as long as it was long enough, so the protection was effectively missing.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.