Bypass trustedOrigins Protection leads to ATO
The trustedOrigins validation in the Better-Auth library could be bypassed with crafted relative URLs, so the callbackURL and redirectTo parameters accepted attacker-controlled destinations. An attacker could use this open redirect to send a victim's password reset token to their own server and take over the account.
castilho.sh
Published on castilho.sh
Like starting recon scripts from scratch from time to time just because we feel like it, I decided to do that for my blog and its design in general. While looking to showcase websites from UI libraries because, why reinvent the wheel when we can just copy paste components from UI libraries, I found a company named…
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could steal password reset tokens and take over accounts, though the text notes the first patch was insufficient and a further bypass remained possible.
What the attacker needed
Victim clicks the reset link; attacker knows victim email; library uses trustedOrigins config
The fix
The check was patched to reject values containing a double slash, but the text says that patch was still bypassable, so a proper fix should resolve the URL and compare its parsed origin against the trusted list.
How it was found
- The attacker submits a password reset request for the victim's email with a crafted redirectTo value.
- The victim receives the reset email and clicks the link.
- The victim is redirected to the attacker's site with the reset token in the URL.
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 write-up has not been written yet. The Original tab links to the source.
When you log in or reset a password, the site often sends you back to a page afterwards, and it checks that the destination is on an approved list. The check could be fooled by a link that looks like a local path but actually points to another website. That let an attacker send the victim to their own site with the secret reset token attached, which is enough to take over the account.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.