GHSL-2024-109_GHSL-2024-111: Reflected Cross-Site Scripting (XSS) vulnerabilities in habitica
The login, registration and home pages of Habitica passed a user-supplied redirectTo parameter to window.location.href after an incorrect sanitisation step, so a javascript: URL could run in the victim's session. An attacker could send a crafted link and, once the victim logged in or registered, read the stored API key and take over the account.
Multiple reflected XSS vulnerabilities exist in the registration and login forms of habitica, giving the attacker control of the victim’s account when a victim registers or logins with a specially crafted link.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
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 sanitizeRedirect function did not block javascript: URLs, and the home page did not sanitise the parameter at all before assigning it to window.location.href.
Impact
An attacker could execute arbitrary JavaScript in the victim's session and may be able to access the victim's account via their user id and API key.
What the attacker needed
Victim clicks a crafted link; victim logs in or registers
The fix
The vulnerabilities were fixed by correcting the redirect sanitisation in the affected components.
How it was found
- Craft a link to the login, register or static home page with a redirectTo value containing JavaScript.
- Send the link to a victim.
- The victim logs in or registers through the link.
- The page assigns the unsanitised redirectTo value to window.location.href.
- The JavaScript runs in the victim's session and can read the stored API key.
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 log in to a website, it sometimes sends you to another page afterwards using a value from the link you clicked. Here that value was not checked properly, so a link could contain JavaScript code instead of a normal web address. The browser then ran that code as if it came from Habitica, letting the attacker read the victim's login details.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.