Skip to content
Account takeover Write-up Intermediate

Full ATO via custom metadata manipulation in AWS Cognito Misconfi

The password reset email link was built using an unvalidated 'subdomain' value from the Cognito ForgotPassword ClientMetadata, which was prepended to the legitimate domain. By injecting a delimiter like '?' or '/', an attacker could make the link point to their own domain, allowing them to steal the reset token and take over the victim's account.

Hazem El-Sayed Follow

Published on medium.com

Assalamu'alaikum, everyone. It’s been a long time since my last write-up.

Hazem El-Sayed, on medium.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

Impact

An attacker could steal the password reset token and take over the victim's account, as the link directed the victim to the attacker's domain.

What the attacker needed

Victim clicks the reset link; attacker can intercept the reset request

The fix

The application should validate and sanitise the ClientMetadata values, or avoid using them to construct URLs, to prevent host manipulation.

How it was found

  1. Intercept the password reset request to the ForgotPassword API operation using Burp Suite.
  2. Modify the 'subdomain' value in the ClientMetadata to include a delimiter such as '?' or '/' followed by an attacker-controlled domain.
  3. The application sends a reset email containing a link whose host is now the attacker's domain.
  4. The victim clicks the link, and the attacker captures the reset token from the request to their server.

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 forget your password, the app emails you a special link to reset it. This app built that link using a value the user could control, without checking it. An attacker could change that value so the link pointed to their own website, and when the victim clicked it, the attacker would see the secret reset code and could take over the account.

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.

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.