Skip to content
Account takeover Write-up Intermediate

It’s all in the detail: Email leak & Account takeover thanks to WayBackMachine & extensive knowledge about the program

The unsubscribe feature exposed a user's email address when given their encoded and unencoded user IDs, and a hidden unsubscribe2 endpoint would log the attacker into the victim's account if both IDs were valid. An attacker could leak any user's email and take over their account.

zseano Follow

Published on medium.com

{{media:0}}

Sean (zseano), 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target is a community site, described here only as redacted.com. The feature at the centre of the report is the email unsubscribe flow. A user who wants to stop receiving emails is sent to an unsubscribe URL that carries two values: what looks like their user ID in plain form, and the same ID in an encoded form. When both values are valid, the page shows the email address that is about to be unsubscribed.

The researcher had spent a long time on this single program, and the write-up is built around the argument that deep familiarity with a target's assets is what turns a small information leak into account takeover.

Setup

No special accounts, roles or tool versions are given. The testing was done with Burp running while using the site normally, which is the starting advice the author gives to anyone asking where to begin.

Finding it

While using the site, the researcher noticed the unsubscribe feature took two parameters, 1 and 2. The first looked like a plain user ID, the second like an encoded one. The URL had this shape:

HTTP
https://www.redacted.com/unsubscribe?1=38384&2=BBG45345DDW34W

Checking his own profile confirmed that the 2 value was his encoded user ID, so 1 had to be the same ID unencoded. The open question was how to obtain that unencoded value for other users.

Exploitation

Step 1: leak the unencoded user ID from the messaging feature

Sending a message to a user produced a URL of this form:

HTTP
https://www.redacted.com/community/message?uid=ABC12345DDW34W

The uid parameter is the recipient's user ID in encoded form. However, when the message was sent, the page source contained that user's unencoded ID. Returning to the message URL showed the same unencoded value there as well. With both values available, the unsubscribe URL could be built for any user:

The report shows the URL shape with placeholders for the two values. This was the first bug: remote disclosure of any user's email address, without account takeover.

Step 2: find a second endpoint in an old robots.txt

The author's habit is to pull a site's /robots.txt from years ago out of the WayBackMachine, because old entries may still exist on the server. Searching those results for anything containing unsubscribe turned up unsubscribe2.

Step 3: try the same parameters on the new endpoint

Visiting /unsubscribe2?1=userid&2=encryptedid with valid values did not show an email. It simply redirected to the homepage, which at first looked like a dead end.

Step 4: notice the session change

The redirect was not a dead end. Visiting /unsubscribe2 with two valid IDs granted access to that account. Looking back at the request in Burp showed that the response just sets the session cookies and redirects. The same two values that leaked an email on /unsubscribe now also logged the visitor in as the user they belonged to.

Root cause

The design flaw is that a pair of identifiers, one plain and one encoded, is treated as sufficient proof of identity. The encoded form is not a secret: it is exposed in the messaging URL and, more importantly, the plain form is written into the page source of the messaging feature, so anyone who can message a user can collect both halves. Because /unsubscribe2 accepts the same pair and responds by setting session cookies, possession of the pair is effectively a login. The report does not describe the encoding scheme or any server-side check beyond validity of the two IDs, so why the encoded value was considered protective is not stated.

Impact

With the messaging feature alone, an attacker can obtain any user's email address by building the /unsubscribe URL from the leaked pair. With the endpoint recovered from the archived robots.txt, the same pair yields full access to that user's account, provided both IDs are valid. The report does not describe any further limits, such as whether the victim is notified or whether existing sessions are affected.

Fix

The clear implication is that an unsubscribe link should not authenticate a user, and that a user ID, encoded or not, should not be treated as a credential for session establishment.

Variants to test

  1. Pull /robots.txt for the target from the WayBackMachine and grep for words tied to account features (unsubscribe, confirm, verify, activate, reset). A positive result is an old path that still responds on the live server.
  2. On any feature that takes a user identifier, check whether the page source or a follow-up request reveals the same identifier in a second form (plain alongside encoded, or vice versa). A positive result is both forms recoverable for another user.
  3. Take any two-parameter link that displays account data and try the same parameters on sibling endpoints found in archives. A positive result is a redirect that changes your session, which you can confirm in Burp by inspecting the response.
  4. Message another account and inspect the request and response for identifiers beyond the one in the URL. A positive result is an additional identifier that maps to the same user.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

What happened, in plain words

A security researcher spent a long time testing one website (a community site, called redacted.com here). He found a small leak: the site's email unsubscribe page could show him any user's email address if he knew two numbers about that user. Then he used an old copy of the site's robots.txt file from the Wayback Machine to find a second, forgotten page. That second page used the same two numbers, but instead of just showing the email, it logged him in as that user. So the same pair of numbers that leaked an email also allowed full account takeover.

The lesson he draws is that deep familiarity with a target, and keeping notes, is what turns a minor bug into a serious one.

Sean (zseano)
Sean (zseano) From the original on medium.com

Understanding how your target works

The author's first advice to anyone who asks "How do I go looking for bugs? Where do I start?" is simple: use the site normally with Burp running and start learning and playing. Burp is a tool that sits between your browser and the website and lets you see and change every request and response. You do not need to be an expert to start; just click around and watch what happens.

As you gain experience, you expand to other tools that discover subdomains (other parts of the same company's site) and common files. But the first step is always to understand how the site works by using it.

While testing this site, the researcher noticed the unsubscribe feature. The unsubscribe page took two parameters, called 1 and 2. The URL for that page had two parameters, called 1 and 2. Parameter is just a name-value pair in a URL after the ? sign; for example, ?name=value. Here, 1 looked like a plain number (a user ID), and 2 looked like a scrambled version of the same number. If both were valid, the page showed the email address that was about to be unsubscribed.

Here is the URL shape he saw:

HTTP
https://www.redacted.com/unsubscribe?1=38384&2=BBG45345DDW34W

This is the URL he saw. https:// means the connection is encrypted. www.redacted.com is the site. /unsubscribe is the page. After the ?, 1=38384 means parameter 1 has the value 38384, and & separates it from 2=BBG45345DDW34W, which is parameter 2 with an encoded-looking value.

He went to his own profile and confirmed that the 2 value was indeed his encoded user ID. So 1 must be the same ID in plain form. The question was: how do you get the plain ID for other users?

First interesting bug found relating to user id leak

This first bug did not lead to account takeover, but it did let anyone leak any user's email address remotely.

When you send a message to another user on the site, the URL of the message page looks like this:

HTTP
https://www.redacted.com/community/message?uid=ABC12345DDW34W

Here, /community/message is the messaging page, and uid is a parameter holding the recipient's user ID in encoded form. That is straightforward: the site uses the encoded ID to know who you are messaging.

But when he actually sent a message, the page source (the HTML code behind the page, which you can view with "View Source" in your browser) contained that user's unencoded ID. He went back to the message URL and saw the unencoded value there as well. So both the plain and the encoded ID were available for any user you can message.

Now all he had to do was collect both values, then visit the unsubscribe URL with the victim's plain ID in 1 and encoded ID in 2. The page would show that user's email address. The URL looked like this:

In this example, here is a placeholder for the two values you collected. The first here is the plain user ID, the second is the encoded user ID. Visiting that URL with a victim's values displayed their email address. That was bug one: remote disclosure of any user's email address, without account takeover.

Where else can it be used?

The author has a habit: he always uses the Wayback Machine (a free archive of old web pages) to look at a site's /robots.txt file from years ago. robots.txt is a file that tells search engines which pages they may or may not crawl; it often lists paths that the site owner wanted to keep out of search results, which makes it interesting to attackers. Old entries may still exist on the server even if they are no longer linked anywhere.

He searched the archived robots.txt for anything containing the word "unsubscribe". He found unsubscribe2.

Excited, he quickly visited /unsubscribe2?1=userid&2=encryptedid with valid values. Here userid and encryptedid are placeholders for the two values. But he was simply redirected to the homepage. A redirect is when the server tells your browser to go to a different page; it looked like a dead end.

But wait….. i’m logged into my other account?

It was not a dead end. It turned out that visiting /unsubscribe2 with two valid IDs granted access to that account. Looking back at the request in Burp, he could see that the response just sets the session cookies and redirects. A cookie is a small piece of data that a website stores in your browser; a session cookie is what keeps you logged in. The response sets the session cookies and redirects, so the site now thinks you are that user.

So now the same two values that leaked an email on /unsubscribe also logged the visitor in as the user they belonged to. That is account takeover: you can access someone else's account without knowing their password.

When hunting, write NOTES.

He wrote "NOTES" in big letters for a reason. Writing notes while testing is extremely useful, especially if you spend a lot of time on one program. When a new feature is released, or if you spot certain values in certain places, you can instantly know what you are looking at. This is also why he started BugBountyNotes, a platform for researchers to write and share notes.

He also believes programs should build strong relationships with researchers: the more engaging and welcoming a program is, the more researchers will stay and keep poking. The longer they spend, the more the bug impact rises as they understand the assets more.

Looking back at some of the bugs he has found, he surprises himself: "How did I think to try that?" Then he reads his notes and it makes sense.

Image for post
How I generally feel sometimes heh :D From the original on medium.com

How I generally feel sometimes heh :D

Glossary

  • Burp: A tool that sits between your browser and a website, letting you see and modify the requests and responses.
  • Parameter: A name-value pair in a URL after the ?, like ?name=value.
  • User ID: A number or string that uniquely identifies a user account.
  • Encoded: Converted into a different form, often to hide the original value; here it looked like a scrambled version of the user ID.
  • Page source: The HTML code that makes up a web page, which you can view in your browser.
  • Wayback Machine: A free archive of old web pages, useful for finding pages that no longer exist.
  • robots.txt: A file that tells search engines which pages they may crawl; it often lists paths the owner wanted to keep out of search results.
  • Redirect: When the server tells your browser to go to a different page.
  • Cookie: A small piece of data stored in your browser by a website.
  • Session cookie: A cookie that keeps you logged in.
  • Set-Cookie: An HTTP response header that tells the browser to store a cookie.
  • Account takeover: Gaining access to someone else's account without their permission.
  • Bug bounty program: A program where companies reward researchers for finding and reporting security bugs.
  • Subdomain: A part of a larger domain, like blog.example.com under example.com.
  • HTTP request: A message your browser sends to a server asking for a page or action.
  • HTTP response: The server's reply to a request.

More by zseano

View all

10 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.