CSRF in generating a new Personal Key
The personal key regeneration endpoint on the staging site accepted a cross-site form submission without a CSRF token, so a crafted page could force a logged-in user to generate a new personal key. The attacker could then use the newly displayed key to log in as the victim, while the victim's old key became invalid.
- Triaged in 5 days
- Disclosed after 3 months
Hello team, I would like to report a CSRF which would allow an attacker to change a user's personal key.
Vulnerable URL- staging.login.gov
POC-
Use the following HTML form for performing the CSRF attack-
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://staging.login.gov/manage/personal_key">
<input type="hidden" name="resend" value="true" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
This will redirect you to https://staging.login.gov/manage/personal_key?resend=true and we can use the key on the screen to login as the old key will be rendered invalid.
PS- The user doesn't have to click on continue on the above page. The key would be changed either way. You can logout and login and test the new key and you will be successfully logged into the account.
IMPACT- This will pretty much deny a user to login to his system who has "his device stolen or accounts hacked" as mentioned by your policy.
FIX- Add a CSRF token while submitting the form.
Let me know if you need anything else.
Best regards, Streaak2
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 personal key regeneration endpoint accepted state-changing requests without verifying a CSRF token or otherwise confirming the request originated from the site.
Impact
An attacker could deny a victim access to their account by generating a new personal key, which the report notes matters most for users whose device was stolen or accounts were hacked.
What the attacker needed
Victim is logged in; victim visits attacker-controlled page
How it was found
- Host an HTML page containing a form that posts to the personal key endpoint with the resend parameter set.
- Get a logged-in victim to load that page, which submits the form automatically or via a button.
- The site generates a new personal key and shows it on the page.
- Use the displayed key to log in as the victim, since the old key is now invalid.
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 personal key is a backup code for signing in. The site changed it on form submission without checking the request came from its own pages, so a malicious site could submit the form for a logged-in visitor and the new key would be shown.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.