Skip to content
Account takeover Write-up Intermediate

Account Takeover via improper input validation

The share endpoint's uri parameter was appended directly to an API hostname, allowing an attacker to redirect requests to a domain they control. The victim's JWT token was then sent to that domain and logged, enabling full account takeover.

admin Follow

Published on gauravnarwani.com

In the following post, input invalidation caused requests to be manipulated to completely take over any account. There are many different ways to takeover any account, but such a case is rarely observed.

admin, on gauravnarwani.com

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

Root cause

Likely the application concatenated the user-supplied uri value directly onto the API hostname without validating or whitelisting it, so a leading dot changed the host to an attacker-controlled domain.

Impact

An attacker could obtain the victim's JWT token and gain complete access to the victim's account, performing any action on their behalf.

What the attacker needed

Victim clicks a link; attacker controls a domain; victim has an active session

The fix

The application should validate and whitelist the uri parameter so that only expected relative paths are accepted, rejecting any input that could alter the host.

How it was found

  1. The attacker crafts a malicious link and hosts a subdomain to receive the request.
  2. The attacker sends the link to the victim.
  3. The victim visits the link, causing a request with the victim's token to be sent to the attacker's subdomain.
  4. The token is stored in a log file that the attacker can access and use to take over the account.

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.

The website had a share feature that built a link to another service by sticking user input onto the end of a web address. Because it did not check that input, an attacker could make the address point to their own server. When a victim opened the link, their login token was sent to the attacker's server, letting the attacker log in as the victim.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by admin

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.