Unsubscribe any user’s e-mail notifications via IDOR
The unsubscribe link used a user ID parameter that was not checked against the logged-in user, so changing it unsubscribed any other user from email notifications. An attacker could unsubscribe arbitrary users if they knew or could obtain the victim's user ID.
Published on sagarsajeev.medium.com
In this writeup, I would like to share how I was able to unsubscribe any user from the Target website’s email notification service.
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.
Context
The target was a website that sent email notifications to its users. Every notification mail carried an unsubscribe link in the footer, and that link was the whole feature: a single GET request to the site took the recipient off the notification list. The unsubscribe endpoint took two query parameters, one of which identified the user. Changing that identifier unsubscribed another user.
The report does not name the organisation. The author describes it only as a non-profit that ran an old age home.
Setup
No accounts, roles, tools or versions are described. The report does not describe the tools used. The unsubscribe link arrives in a normal email, and the user ID could be obtained from the site itself. The attack requires learning a victim's user ID, which the report shows was possible through a separate API issue.
Finding it
The starting point was the unsubscribe link in the footer of a notification mail. It looked like this:
https://target.com/unsubscribe?u=9x0xxx98xx5cxx5xx71&id=123456
Two parameters mattered:
uis described as a timestamp encoded in base64. The author was not sure what it was for, suggesting it might log the time the action was initiated. Changing it did not appear to have any significant impact, but it had to be present: without it the request returned status code 400.idis the user ID. This is the parameter that decides whose subscription is cancelled.
The link carries the user identifier in the query string, so the obvious question is what happens when the identifier belongs to someone else. The second half of the problem is knowing another user's ID, and the report notes that an API call leaked it: visiting the target user's profile returned the user ID. The author chained the two issues and reported them together.
Exploitation
Step 1: obtain the victim's user ID
Visit the victim's profile page. The API call behind the profile leaked the user ID.
Step 2: rewrite the unsubscribe link
Take the original link and replace id with the victim's user ID, leaving u as it was:
https://target.com/unsubscribe?u=9x0xxx98xx5cxx5xx71&id=654321
Step 3: send the request
Forward the modified request. The victim is unsubscribed from the website's email notification service. No confirmation, token check or ownership check is described as standing in the way.
Root cause
Changing the id parameter to another user's ID unsubscribed that user, which points to a missing ownership check. This is a classic insecure direct object reference: the object (a subscription) is addressed by a user-supplied identifier, and authorisation is missing. The u parameter is described as a base64 timestamp whose purpose the author was unsure of; it was required for the request to be accepted, but manipulating it had no significant effect.
Impact
An attacker who knows a user ID can unsubscribe that user from the site's email notifications, one request per victim. The author advises finding a way to get other users' IDs, warning that otherwise the report would likely be closed or rewarded with a low bounty.
Fix
The fix that follows from the root cause is to stop treating the id parameter as proof of identity: bind the unsubscribe action to a value the requester cannot forge for another user, such as a per-recipient token, and verify on the server that the subscription being cancelled belongs to the requester before acting.
Variants to test
- Swap the user identifier in any unsubscribe, preferences or notification-settings link and see whether the action applies to the other account. A positive result is the victim's setting changing.
- Check whether the profile or account API returns the user ID of the profile being viewed. A positive result is an identifier in the response that matches the
idused by the unsubscribe endpoint, which turns the IDOR into a practical attack. - Try the same identifier swap on other mail-footer actions, such as notification preferences or digest settings. A positive result is any state change on another user's account.
Timeline
| Event | Date |
|---|---|
| Submitted | 18-08-2022 |
| Accepted | 22-08-2022 |
| Rewarded | not dated in the report |
The company offered a $200 bounty. Because it was a non-profit running an old age home, the author decided not to accept it.

The author closes by inviting readers to follow him on LinkedIn and Twitter and to read his other write-ups on Medium.
What happened, in plain words
A website sent email notifications to its users. At the bottom of every one of those emails there was a small link that said something like "unsubscribe". Clicking it told the website: please stop sending me these emails.
That link contained a number that identified the person. If you changed the number to somebody else's, the website unsubscribed that other person instead.
This kind of mistake has a name: IDOR, short for Insecure Direct Object Reference. In everyday terms, imagine a cloakroom where you hand in your coat and get a ticket with the number 12. If the attendant gives back whatever coat matches the number on the ticket you show, without checking that the ticket is yours, then anyone who writes 13 on a scrap of paper can walk off with coat number 13. The number is a "direct reference" to an object (a coat, or here a subscription), and the check that the ticket belongs to you is missing. That is insecure.
The author of this write-up, Sagar Sajeev, found this on a real website, reported it, and the company accepted it. The company was a non-profit that ran an old age home. It offered a $200 bounty (a reward paid to people who report security problems responsibly), but the author decided not to accept the money because of what the organisation did.
Before going further, a few words that will come up constantly:
- Website / web server: the computer on the internet that answers when your browser asks for a page.
- URL: the address you type in the browser, like
https://target.com/unsubscribe?.... Everything after the?is called the query string, and it is made of parameters written asname=valuepairs joined by&. - GET request: the simplest kind of request a browser makes. It means "give me this thing". When you click a link, your browser sends a GET request to the address in the link, including everything after the
?. - API: a way for one piece of software to ask another for data, without a human clicking anything. Think of it as a serving hatch in a restaurant kitchen: you do not walk into the kitchen, you pass a request through the hatch and get a plate back. Websites use APIs behind the scenes to fetch things like a user's profile information.
- User ID: a number or short code that the website uses internally to tell users apart. It is not usually your username; it is more like your customer number in a shop's database.
- Base64: a way of writing data using only ordinary letters, digits and a couple of symbols, so it can travel safely inside a URL or an email. It is not encryption: anyone can decode it back. Think of it as a different alphabet for the same sentence, not a locked box.
- Status code: a three-digit number the server sends back with every response.
200means "here you go, all fine".400means "your request was malformed, I cannot understand it". - Bug bounty: a programme where a company pays researchers for telling them about security problems, instead of punishing them.
The setup
The report does not name the organisation, and it does not describe any special tools, accounts or software versions. The report does not describe the tools used. That is worth stressing for a beginner: this bug was not found with an expensive scanner. It was found by reading a link carefully and asking "what happens if I change this number?".
The attack requires that the attacker can learn another person's user ID. The report shows that this was possible on the same website through a separate issue, which the author combined with the unsubscribe bug and reported together.
Finding it
The starting point was the unsubscribe link at the bottom (the footer) of a notification email. It looked like this:
https://target.com/unsubscribe?u=9x0xxx98xx5cxx5xx71&id=123456
Line by line, in plain words:
https://target.comis the website's address.target.comis a placeholder the author uses instead of the real domain./unsubscribeis the page (more precisely, the endpoint) that performs the unsubscribe action. An endpoint is simply a specific address on a server that does one particular job.?marks the start of the query string, the extra information being passed to that endpoint.u=9x0xxx98xx5cxx5xx71is the first parameter. The author explains that this value is just a timestamp (a date and time, recorded as a number) encoded in base64. He was not sure what it was for, and guessed it might record the moment the unsubscribe was started, perhaps for logging. Changing it did not seem to have any significant effect, but it had to be present: if it was missing, the server answered with status code 400, meaning the request was rejected as malformed.&separates the parameters.id=123456is the second parameter, and it is the user ID. This is the important one: it tells the server whose subscription should be cancelled.
So the whole feature is a single request with the user's identifier sitting in the URL in plain sight. That raises the obvious question: what happens if the identifier belongs to somebody else? The second half of the problem is knowing another user's ID, and the report notes that an API call leaked it: when you visited a user's profile page, the API behind that page returned the user ID. The author chained the two issues together and reported them as one finding.
Exploitation
Step 1: obtain the victim's user ID
Visit the victim's profile page. The API call that loads the profile leaked the user ID.
Why this step matters: without a victim's ID, the attacker has nothing to put in the id parameter. The whole attack depends on being able to learn that number.
Step 2: rewrite the unsubscribe link
Take the original link and replace id with the victim's user ID, leaving u exactly as it was:
https://target.com/unsubscribe?u=9x0xxx98xx5cxx5xx71&id=654321
Line by line:
- The address and the endpoint
/unsubscribeare unchanged. u=9x0xxx98xx5cxx5xx71is the same base64 timestamp as before. It is kept because the server rejects the request with status code 400 if it is missing, and because changing it had no significant effect anyway.id=654321is now the victim's user ID instead of the attacker's own. This single change is the entire attack.
The next step answers that question.
Step 3: send the request
Forward the modified request. The victim is unsubscribed from the website's email notification service. The report describes no confirmation step, no token check and no ownership check standing in the way: the server simply did what the number told it to do.
Why it worked
Changing the id parameter to another user's ID unsubscribed that user, which points to a missing ownership check. That is the classic insecure direct object reference: the object (a subscription) is addressed by a value the user supplies, and the authorisation check is missing. In the cloakroom comparison, the attendant never asks whether the ticket is yours.
The u parameter is described as a base64 timestamp whose purpose the author was unsure of; it was required for the request to be accepted, but manipulating it had no significant effect.
What the impact was
An attacker who knows a user ID can unsubscribe that user from the site's email notifications, with one request per victim. The report describes no other effect: no data is read, no account is taken over, and the action is limited to the notification subscription. The author advises finding a way to get other users' IDs, warning that otherwise the report would likely be closed or rewarded with a low bounty.
How to fix it
The fix that follows from the root cause is to stop treating the id parameter as proof of identity. Instead, bind the unsubscribe action to a value the requester cannot forge for another user, such as a per-recipient token (a long random string unique to each email recipient), and verify on the server that the subscription being cancelled belongs to the requester before acting.
Things to try yourself
These are variations on the same idea, useful when you are learning:
- Swap the user identifier in any unsubscribe, preferences or notification-settings link and see whether the action applies to the other account. A positive result is the victim's setting changing.
- Check whether the profile or account API returns the user ID of the profile being viewed. A positive result is an identifier in the response that matches the
idused by the unsubscribe endpoint, which turns the IDOR into a practical attack. - Try the same identifier swap on other mail-footer actions, such as notification preferences or digest settings. A positive result is any state change on another user's account.
Timeline
| Event | Date |
|---|---|
| Submitted | 18-08-2022 |
| Accepted | 22-08-2022 |
| Rewarded | not dated in the report |
The company offered a $200 bounty. Because it was a non-profit running an old age home, the author decided not to accept it.

The author closes by inviting readers to follow him on LinkedIn and Twitter and to read his other write-ups on Medium.
Glossary
- API: a way for software to request data or actions from another system, usually without a human clicking anything; think of a serving hatch between two programs.
- Base64: an encoding that rewrites data using ordinary characters so it can travel in URLs or emails; it is reversible by anyone and is not encryption.
- Bug bounty: a programme that pays researchers for responsibly reporting security problems.
- Cookie: a small piece of data a browser stores for a website, used to remember who you are between requests.
- Endpoint: a specific address on a server that performs one particular action, such as
/unsubscribe. - Enumeration: systematically trying many values (for example many user IDs) to discover which ones exist.
- Footer: the bottom section of an email or web page.
- GET request: the basic request a browser sends when you click a link or load a page, asking the server to return something.
- IDOR (Insecure Direct Object Reference): a flaw where a program uses a value supplied by the user to point at a record, and does not check that the user is allowed to access that record.
- Parameter: a
name=valuepair in a URL's query string, used to pass information to the server. - Query string: the part of a URL after the
?, containing parameters separated by&. - Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
- Status code: a three-digit number in a server's response, such as 200 (success) or 400 (bad request).
- Timestamp: a date and time recorded as a number.
- Token: a value, often a long random string, used to prove identity or permission; here, a per-recipient value that cannot be guessed for another user.
- User ID: the internal number or code a website uses to identify a user.
- Vulnerability: a weakness in software that someone could abuse to do something the owner did not intend.