Skip to content
Account takeover Write-up Intermediate

有缺陷的重設密碼機制如何演變成帳號奪取漏洞?以 Matters 為例

The password reset flow let the client control the redirect URL and the code strength, so omitting the redirect URL produced a weak six-digit code. Because old codes were not invalidated, an attacker could create many valid codes and brute-force one within the five-minute window, then reset the victim's password and take over the account.

tech-blog.cymetrics.io

Published on tech-blog.cymetrics.io

重設密碼是幾乎所有網站都有的機制,最常見的是透過 email 寄送一個重設密碼的連結,點進去連結以後就可以幫這個帳號設定新的密碼。這個機制雖然常見,卻有一些關於安� �性的小細節要注意。

The author, on tech-blog.cymetrics.io

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 reset code's strength was chosen by whether a client-supplied redirect URL was present, old codes were never invalidated, and the rate limit trusted a client-supplied forwarding header.

What the attacker needed

Victim has an account; attacker can send many requests; attacker can forge X-Forwarded-For; attack within five-minute window

The fix

The text says Matters later invalidated old codes and increased the weak code's base, and recommends choosing code strength by type, keeping the redirect URL server-side, and not trusting a client-supplied forwarding header for rate limiting.

How it was found

  1. Send a password reset request and intercept it.
  2. Change the redirect URL to an attacker-controlled address and observe the emailed link now starts with that address.
  3. Remove the redirect URL parameter so the generated code becomes a six-digit number.
  4. Send many reset requests so many valid codes exist at once, because old codes are not discarded.
  5. Guess codes against the verification endpoint, bypassing the rate limit by forging the forwarding header.
  6. Use a guessed code to set a new password and log in as the victim.

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 a password, a site emails you a link with a secret code. This site let the person asking for the reset choose both where the link pointed and how strong the secret code was, and it kept every old code alive. An attacker could therefore create many weak codes and guess one, then set a new password and 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.

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.