Unauthenticated IDOR in Marketing Consent Management: From Enumerable IDs to Unauthorized Subscription Changes
The application exposed unauthenticated endpoints for reading and updating marketing subscription preferences, authorising actions solely by predictable list and recipient identifiers. An attacker could enumerate neighbouring recipient records, read their consent status, and change it in either direction, including re-subscribing users who had opted out.
Published on medium.com
Bug Bounty
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 marketing subscription preference service. It exposed two server-side endpoints, one for reading a recipient's subscription state and one for writing it. Both took a list identifier and a recipient identifier, and neither required a login. That is normal for unsubscribe links: forcing a user to authenticate before opting out would be poor design, so the interesting question is not why the endpoints were unauthenticated but what authorised a recipient-specific action.
In this case the answer was the identifiers themselves. The recipient identifiers were densely allocated and predictable, so knowing one valid value was enough to discover its neighbours, read their consent state and change it in either direction. The result was an unauthenticated authorisation flaw affecting both the confidentiality and integrity of marketing consent.
Setup
The functionality consisted of two simple server-side endpoints. Conceptually:
GET /preferences/getPOST /preferences/update
Both accepted values resembling:
listIdrecipientId
The read endpoint returned a subscription state such as:
{ "status": "opted-in"}
or:
{ "status": "opted-out"}
The write endpoint modified that state. No session, bearer token, signed token, CSRF token or one-time capability was involved in the requests described.
Finding it
At first glance the design could be completely intentional. Marketing unsubscribe links are commonly built to work without a login. The first question therefore was not why the endpoint was unauthenticated, but what exactly authorised the recipient-specific action.
Authentication asks who you are. Authorisation asks whether you are allowed to access this object. Many unsubscribe systems intentionally have no authentication, but that does not mean authorisation should also be absent. A secure unauthenticated preference link normally carries an unguessable capability, for example:
https://example.com/unsubscribe?[redacted]
or a signed value:
recipient=12345signature=HMAC(recipient || list || expiry)
Possession of the unguessable token is the authorisation. In the vulnerable design the server effectively used:
listId + recipientId
as the authorisation mechanism, which is dangerous when those identifiers are predictable.
Exploitation
Step 1: request without authentication
The simplest possible request was sent without any credential:
curl 'https:
The report shows the command truncated at that point. The point of the test is what the server does when the request carries none of the following:
session cookieBearer tokensigned tokenCSRF tokenone-time capability
If a recipient-specific state comes back anyway, the authorisation model needs close inspection. The key question is whether knowledge of the object identifier alone is sufficient to access the object, which is a classic IDOR indicator.
Step 2: compare valid and invalid objects
Differential testing is the fastest way to map an IDOR surface. A known-valid identifier and an obviously invalid one were compared:
recipientId = known-validrecipientId = obviously-invalid
A valid one returned:
{ "status": "opted-in"}
while the invalid one returned:
{ "error": "Recipient not found"}
The endpoint is therefore an oracle: an attacker can tell an existing recipient from a non-existing one. That matters even when the identifier's meaning is opaque, because the application itself reveals whether a value is valid.
Step 3: test identifier predictability
Not every numeric identifier is practically enumerable, so the next question was how identifiers are allocated. Nearby values were tried:
N-3N-2N-1NN+1N+2N+3
Patterns were looked for, for example:
5000001 → valid5000002 → valid5000003 → missing5000004 → valid5000005 → valid
When a large share of nearby identifiers resolve to real records, the identifier behaves like a sequence or a densely allocated block. A single leaked identifier stops being one object and becomes a pivot into a neighbourhood of objects.
Step 4: measure enumeration density
Identifier density is a useful concept here. Probing 100 values around a valid identifier gives a rough measure:
1 / 100 = low density
versus:
60 / 100 = high density
High density means an attacker needs very little information to discover more objects. This holds even for numerically large identifiers: a 12-digit ID can still be weak if allocation is sequential. A large number is not the same as high entropy. For example:
834729483720834729483721834729483722
may look complicated but contain effectively no meaningful randomness.
Step 5: look for identifier seeds in public sources
A valid identifier has to come from somewhere. Public historical sources are worth checking for supposedly secret identifiers, including:
search enginesweb archivesold emailscached pagesJavaScript bundlesanalytics URLsmarketing linkspublic HTML
Developers often assume nobody knows a valid recipient ID. If old preference links were archived, indexed, shared or leaked, that assumption collapses, and with sequential identifiers a single valid seed is enough. The methodology is to find one legitimate identifier, understand the allocation pattern and measure neighbouring validity, rather than brute-forcing the whole keyspace.
Step 6: find the write endpoint
Read access is only half the story. The read endpoint exposed subscription status, which already has some confidentiality impact, but the next question is whether the same object can be modified. Sibling endpoints were looked for using common naming patterns:
getputupdatesavesetchangeeditpreferencesstatustoggle
The write endpoint took the same recipient identifiers:
POST /preferences/update
with a body of the form:
listId=...recipientId=...status=...
Still with no authentication or signed capability. That turned the issue from an unauthorised object read into an unauthorised object read plus write.
Step 7: understand the write semantics
Before changing anything, the behaviour of the endpoint was established. Some APIs accept a desired state directly:
status=opted-out
and set it. Others take the current state and toggle it:
current = opted-insubmitted = opted-inresult = opted-out
That is unusual but important. The parameter should never be assumed to mean desired state; what the backend actually does has to be verified, otherwise testing can cause unintended persistent changes.
Step 8: flip and restore
For state that belongs to a user, a safe testing pattern is read, change, verify, restore, verify restoration:
T0: read → opted-inT1: write → change stateT2: read → opted-outT3: write → restoreT4: read → opted-in
This produces strong evidence with minimal impact and proves three things: the object is writable, the change is real and the change is reversible. Each transition should be documented clearly.
Step 9: build an authorisation matrix
An access-control bug is easier to reason about in a matrix:
| Action | Authentication required | Object authorisation | Result |
|---|---|---|---|
| Read consent state | No | None | Vulnerable |
| Change consent state | No | None | Vulnerable |
| Restore state | No | None | Vulnerable |
| Enumerate object existence | No | None | Vulnerable |
This separates authentication from object-level authorisation, which is exactly where many IDORs hide.
Root cause
The root cause can be summarised as:
predictable object identifier+identifier treated as authorization+no capability token=IDOR
The backend effectively asks:
Does this recipient exist?
instead of:
Is this requester authorized to act on this recipient?
Existence is not authorisation. Nothing in the request flow, such as a signature or capability token, provided authorisation.
Impact
An unauthenticated attacker who knows or guesses one valid identifier could potentially discover neighbouring recipients, determine whether each is opted in or opted out, and change that state. Because the write endpoint accepted both directions, the impact runs two ways.
Direction 1, forced unsubscribe, changes opted-in to opted-out, with potential impact of reduced campaign reach, lost marketing engagement, loss of legitimate subscribers and business disruption.
Direction 2, forced resubscribe, changes opted-out to opted-in, with potential impact of users receiving communications they withdrew consent for, consent records becoming unreliable, support and compliance burden, and reputational impact. The second direction is particularly sensitive because the application is altering a recorded expression of user consent.
The endpoint did not expose email addresses, names, phone numbers, addresses or credentials, and the report does not claim account takeover, email disclosure, password access, payment access or arbitrary PII extraction. The confidentiality impact is limited to subscription state; the integrity impact is unauthorised modification of consent state. It is still meaningful because the company relies on that data to decide whether marketing communications should be sent. The report frames it as low confidentiality impact, meaningful integrity impact, practical enumeration and no authentication.
On regulatory impact, the report is deliberately careful: unauthorised modification of marketing consent may create privacy, compliance or consent-management risk because the organisation can no longer trust that the stored preference reflects the user's actual choice. That is a technical statement, not a legal determination.
Fix
A robust fix combines several controls.
- Use a signed or random capability token. The token should cover:
recipientIdlistIdexpirysignature
where:
signature = HMAC(secret, recipientId || listId || expiry)
Requests without a valid signature should be rejected.
-
Use high-entropy identifiers where possible, such as UUIDv4 or a random 128-bit token, instead of sequential IDs for externally exposed recipient actions. Random identifiers make enumeration much harder, but they are not a replacement for proper authorisation when sensitive writes are involved.
-
Restrict bidirectional state changes. An endpoint built for one-click unsubscribe should not necessarily let the same unauthenticated capability re-subscribe a user. Separate unsubscribe from subscribe and apply stronger authorisation to the latter.
-
Add rate limiting and detection as defence in depth, monitoring sequential recipient IDs, high error rates, rapid list switching and large request volumes. Rate limiting reduces enumeration but does not repair broken authorisation, since an attacker may rotate IPs, slow down, distribute requests or reuse leaked identifiers. The primary fix remains requiring valid per-recipient authorisation.
-
Bind tokens to the action. A token issued for unsubscribe should not automatically authorise subscribe or changes to email preferences. A token should ideally be bound to recipient, list, action and expiry where appropriate.
Variants to test
- Remove authentication from any object-specific endpoint. Try the request without cookies, Authorization headers, CSRF tokens and session headers, and see whether the operation still works. A positive result is a recipient-specific response with no credential.
- Change the object identifier, for example
12345 → 12346, and see whether another valid object comes back. A positive result is a different real record. - Test invalid identifiers such as
01999999999999and look for differential responses. A positive result is a distinguishable "not found" versus a real state, which gives an enumeration oracle. - Measure predictability over a small neighbouring range,
N-10 → N+10, without mass enumeration unless explicitly permitted. A positive result is a high proportion of valid neighbours. - Search for related endpoints. If
getPreferenceexists, look forsetPreference,updatePreference,savePreferenceanddeletePreference. A positive result is a write endpoint sharing the same broken authorisation model. - Identify the actual authorisation mechanism: is there a signature, a capability token, a session, ownership validation, or is the ID itself trusted? A positive result is an endpoint where the ID alone is the only thing checked.
- Test writes safely, using your own object where possible, and if program rules allow testing on another object, modify only one and restore it immediately. A positive result is a verified state change that can be reversed.
- Verify the change by re-reading the state rather than trusting a success message. A positive result is a read that reflects the write.
- Determine scope: how many lists, tenants and object types are affected, and how predictable are the identifiers. A positive result is the same mistake across multiple datasets.
The same pattern appears in unsubscribe systems, password-reset workflows, invoice viewers, file-sharing links, booking systems, support tickets, surveys, loyalty programs, order tracking, event registrations and document portals. The principle is simple: an identifier tells the server which object you want, and it should not by itself prove that you are allowed to access it.
What happened, in plain words
A company ran a service that stores whether each person on a mailing list wants to receive marketing email. Each person's choice is stored as a small record: opted in, or opted out. The service had two doors into that data: one door to look at a person's choice, and one door to change it. Neither door asked for a password or a login.
That is not automatically wrong. When you click "unsubscribe" at the bottom of a marketing email, you expect it to work without signing in first. Forcing people to create an account just to stop receiving email would be bad design. So the interesting question is not "why is there no login?" but "what, exactly, proves to the server that this particular request is allowed to touch this particular person's record?"
In this service, the answer was: nothing except the numbers in the request. Each record was identified by a list number and a recipient number, and those numbers were handed out in a dense, predictable sequence. If you knew one real recipient number, you could try the numbers next to it and find more real people. You could then read whether each of them was opted in or opted out, and you could change that choice in either direction: unsubscribe someone who wanted email, or resubscribe someone who had explicitly opted out.
That is the whole story. No passwords were stolen, no email addresses were exposed. But a stranger on the internet, with no account at all, could read and rewrite the company's record of what people had consented to.
The two doors, and what they took
The functionality was two simple server-side endpoints. An endpoint is just a specific address on a web server that does one job, like a counter in a shop: you go to this counter to ask a question, to that counter to hand something in. When your browser loads a page, it is talking to endpoints; when a mobile app shows you data, it is talking to endpoints too. The collection of endpoints a service offers is sometimes called its API (Application Programming Interface), which is a fancy name for "the set of addresses and rules for talking to this system programmatically".
Conceptually, the two endpoints were:
GET /preferences/getPOST /preferences/update
Line by line:
GET /preferences/getis a request that asks the server to get (read) something.GETis the verb used when you only want to retrieve information, never to change it./preferences/getis the path, the address of that particular counter.POST /preferences/updateis a request that asks the server to update something.POSTis the verb normally used when you are sending data that will change something on the server.
Both endpoints accepted two values that looked like this:
listIdrecipientId
Line by line:
listIdis the identifier of a mailing list. A company might have several lists: a newsletter, a product announcements list, a events list. Each gets a number.recipientIdis the identifier of one person on that list. Each person gets a number.
An identifier (often shortened to ID) is just a label the system uses internally to refer to a thing. It is not necessarily meaningful to you; it is the system's way of saying "that one, not this one". Think of a cloakroom ticket: the number on the ticket is not your name, it is just how the attendant finds your coat.
The read endpoint answered with a subscription state, something like:
{ "status": "opted-in"}
or:
{ "status": "opted-out"}
Line by line:
- The curly braces
{ }enclose a JSON object, which is a common way for computers to exchange structured data. JSON (JavaScript Object Notation) is just text formatted as labelled values. "status"is the label (the key)."opted-in"or"opted-out"is the value: this person currently wants marketing email, or does not.
So the read endpoint tells you one fact about one person: their current choice. The write endpoint changes that fact. Neither of them, in the requests described, involved a session, a bearer token, a signed token, a CSRF token or a one-time capability. Those terms all mean roughly "some proof that you are allowed to be here", and we will unpack them as we go.
Why "no login" is not the bug
At first glance the design could be completely intentional. Marketing unsubscribe links are commonly built to work without a login. So the first question was not why the endpoint was unauthenticated, but what exactly authorised the recipient-specific action.
Two words get confused constantly, and the whole article hinges on the difference.
- Authentication asks: who are you? Logging in with a username and password is authentication. Showing a passport at a border is authentication.
- Authorisation asks: are you allowed to do this particular thing to this particular object? Having a passport proves who you are; it does not prove you are allowed into a specific building's server room.
Many unsubscribe systems intentionally have no authentication. That does not mean authorisation should also be absent. A secure unauthenticated preference link normally carries an unguessable capability, for example:
https://example.com/unsubscribe?[redacted]
Line by line:
https://example.com/unsubscribeis the address of the unsubscribe page.- `?[redacted] is a query parameter: extra information appended to the address after a question mark. Here it carries a token, a long random-looking string.
A token in this context is a secret value that acts like a key. If you have the key, you can open the door; if you do not, you cannot. The point is that the key is unguessable: nobody can produce it by trying numbers in order. Possession of the token is the authorisation. The server does not need to know who you are; it only needs to see that you hold the right key.
Another common form is a signed value:
recipient=12345signature=HMAC(recipient || list || expiry)
Line by line:
recipient=12345says which recipient this is about.[redacted] || list || expiry)is a cryptographic stamp computed over the recipient, the list and an expiry time. HMAC is a standard way of producing a stamp using a secret key that only the server knows. The||symbol means "joined together".- Because only the server knows the secret key, nobody else can produce a valid stamp for a recipient they made up. If someone changes
12345to12346, the stamp no longer matches, and the server rejects the request.
In the vulnerable design, the server effectively used:
listId + recipientId
as the authorisation mechanism. In other words, the only thing you had to know was the list number and the recipient number. That is dangerous when those numbers are predictable, because then anyone can produce them.
Step 1: ask without any credentials
The simplest possible request was sent without any credential:
curl 'https:
The report shows the command truncated at that point, so we cannot see the full address. What matters is what the command is doing.
curlis a command-line tool for making web requests. You give it a URL and it fetches the response, much like a browser, but without drawing a page. It is useful for testing because you can see exactly what was sent and what came back.- The single quotes around the URL are shell syntax that keeps the address together as one piece.
The point of the test is what the server does when the request carries none of the following:
session cookieBearer tokensigned tokenCSRF tokenone-time capability
Line by line, these are all forms of proof that a request is allowed:
- session cookie: a cookie is a small piece of data your browser stores for a website and sends back with every request to that site. A session cookie is a cookie that identifies your logged-in session, like a wristband at an event that proves you already checked in. If the request has no session cookie, the server cannot know who you are.
- Bearer token: a token sent in a request header (a small labelled field attached to the request) that says "the bearer of this token is authorised". It is like a ticket you show at the door.
- signed token: a token with a cryptographic stamp, as described above, so it cannot be forged or altered.
- CSRF token: CSRF stands for Cross-Site Request Forgery, an attack where a malicious site tricks your browser into sending a request to another site using your existing login. A CSRF token is a random value the real site's pages include in forms, so that a request forged from elsewhere will not have it. It is a check that the request came from the site's own pages.
- one-time capability: a value that works once and then is useless, like a single-use ticket.
If a recipient-specific state comes back anyway, the authorisation model needs close inspection. The key question is whether knowledge of the object identifier alone is sufficient to access the object. That is a classic IDOR indicator.
IDOR stands for Insecure Direct Object Reference. It means the application lets you refer to an object directly by its identifier, and does not check whether you are allowed to touch that object. Imagine a hotel where room keys are numbered 101, 102, 103 and the front desk hands you key 101 but never checks that you are the guest in 101. You could walk to 102 and try the key. The identifier is the only thing standing between you and someone else's room.
Step 2: compare a real number with a fake one
Differential testing means sending two requests that differ in one detail and comparing the answers. It is the fastest way to map an IDOR surface, because the difference in the responses tells you what the server is checking.
A known-valid identifier and an obviously invalid one can be compared:
recipientId = known-validrecipientId = obviously-invalid
Line by line:
recipientId = known-validmeans a recipient number that is known to exist, for example one taken from a real unsubscribe link.recipientId = obviously-invalidmeans a number that is very unlikely to exist, such as a huge number or one with an unusual shape.
A valid one returned:
{ "status": "opted-in"}
while the invalid one returned:
{ "error": "Recipient not found"}
Line by line:
- The first response is the same JSON object as before: this recipient exists and is opted in.
- The second response is a different JSON object with an
"error"key and the message"Recipient not found". The server is telling you, in plain words, that no such recipient exists.
The endpoint is therefore an oracle. In security, an oracle is any behaviour that answers a question you were not supposed to be able to ask. Here the question is "does recipient number X exist?" and the server answers it every time. An attacker can tell an existing recipient from a non-existing one. That matters even when the identifier's meaning is opaque, because the application itself reveals whether a value is valid. You do not need to understand what the number means; you only need to know whether the server says yes or no.
Step 3: are the numbers predictable?
Not every numeric identifier is practically enumerable. Enumerable means you can walk through the possible values one by one and find the real ones, like trying every house number on a street. If the numbers are random and huge, walking through them is hopeless. If they are handed out in order, walking through them is easy.
So the next question was how identifiers are allocated. Nearby values can be tried:
N-3N-2N-1NN+1N+2N+3
Line by line:
Nstands for a known valid identifier.N-3,N-2,N-1are the three numbers just below it.N+1,N+2,N+3are the three numbers just above it.
This is the equivalent of standing at house number 50 and checking 47, 48, 49, 51, 52, 53 to see whether the street is fully built up or mostly empty.
Patterns were looked for, for example:
5000001 → valid5000002 → valid5000003 → missing5000004 → valid5000005 → valid
Line by line:
5000001 → validmeans recipient 5000001 exists.5000002 → validmeans the next one exists too.5000003 → missingmeans that one does not exist.5000004 → validand5000005 → validmean the sequence continues.
When a large share of nearby identifiers resolve to real records, the identifier behaves like a sequence or a densely allocated block. A single leaked identifier stops being one object and becomes a pivot into a neighbourhood of objects. In plain terms: if you find one real customer number, you can probably find many more just by counting up and down.
Step 4: how dense is the neighbourhood?
Identifier density is a useful concept here. Probing 100 values around a valid identifier gives a rough measure:
1 / 100 = low density
versus:
60 / 100 = high density
Line by line:
1 / 100 = low densitymeans only one of the hundred numbers you tried was real. The numbers are sparse; guessing more is hard.60 / 100 = high densitymeans sixty of the hundred were real. The numbers are packed together; guessing more is easy.
High density means an attacker needs very little information to discover more objects. This holds even for numerically large identifiers: a 12-digit ID can still be weak if allocation is sequential. A large number is not the same as high entropy. Entropy here means unpredictability: how much genuine randomness is in the value. A long number that simply counts upwards has almost none, because the next value is obvious. For example:
834729483720834729483721834729483722
Line by line:
834729483720is one identifier.834729483721is the next one, differing only in the last digit.834729483722is the one after that.
These may look complicated because they are long, but they contain effectively no meaningful randomness. Anyone who sees one can guess the next. It is like a password that is long but is just the word "password" repeated: length is not the same as strength.
Step 5: where would a real number come from?
A valid identifier has to come from somewhere. Public historical sources are worth checking for supposedly secret identifiers, including:
search enginesweb archivesold emailscached pagesJavaScript bundlesanalytics URLsmarketing linkspublic HTML
Line by line, these are places where a real identifier might have been left lying around:
- search engines: a page containing a preference link may have been indexed by Google or another search engine.
- web archives: services that keep old copies of web pages, so a link that has since been removed may still be visible.
- old emails: marketing emails sent years ago may still sit in inboxes, containing unsubscribe links with real identifiers.
- cached pages: copies of pages stored by search engines or other services.
- JavaScript bundles: the code files a website sends to your browser. They sometimes contain example identifiers or configuration values.
- analytics URLs: addresses recorded by analytics tools, which may include links users clicked.
- marketing links: links in campaigns, newsletters and social posts.
- public HTML: the raw source of public web pages.
Developers often assume nobody knows a valid recipient ID. If old preference links were archived, indexed, shared or leaked, that assumption collapses, and with sequential identifiers a single valid seed is enough. A seed here means one real value to start from. The methodology is to find one legitimate identifier, understand the allocation pattern and measure neighbouring validity, rather than brute-forcing the whole keyspace. Brute-forcing means trying every possible value until one works; it is slow and noisy, and you rarely need it when the numbers are sequential.
Step 6: can the same record be changed?
Read access is only half the story. The read endpoint exposed subscription status, which already has some confidentiality impact. Confidentiality means keeping data secret from people who should not see it. But the next question is whether the same object can be modified. Integrity means keeping data correct and unaltered by people who should not change it. A read-only bug leaks information; a write bug lets an attacker change reality.
Sibling endpoints were looked for using common naming patterns:
getputupdatesavesetchangeeditpreferencesstatustoggle
Line by line, these are words developers commonly use in endpoint names:
getandputare standard HTTP verbs for reading and replacing.update,save,set,change,editall suggest writing.preferencesandstatussuggest the kind of data involved.togglesuggests flipping a value between two states.
Guessing sibling names is like trying the doors next to the one you found: if there is a room for reading, there is often a room for writing next door.
The write endpoint took the same recipient identifiers:
POST /preferences/update
with a body of the form:
listId=...recipientId=...status=...
Line by line:
POST /preferences/updateis the write endpoint, as before.- The body is the part of a request that carries data, separate from the address. When you fill in a form and press submit, the values you typed travel in the body.
listId=...,recipientId=...,status=...are the three values being sent: which list, which recipient, and what status to set.
Still with no authentication or signed capability. That turned the issue from an unauthorised object read into an unauthorised object read plus write. In other words, the same missing check applied to both doors.
Step 7: what does the write actually do?
Before changing anything, determine how the endpoint behaves. This is important because a parameter's name does not always match its effect. Some APIs accept a desired state directly:
status=opted-out
Line by line:
status=opted-outmeans "set this recipient's status to opted out". The value you send is the value you want.
Others take the current state and toggle it:
current = opted-insubmitted = opted-inresult = opted-out
Line by line:
current = opted-inmeans the recipient is currently opted in.submitted = opted-inmeans you sent the valueopted-in.result = opted-outmeans the server flipped it to the opposite.
That is unusual but important. The parameter should never be assumed to mean desired state; what the backend actually does has to be verified, otherwise testing can cause unintended persistent changes. Persistent means the change sticks around after your request ends, affecting real users. If you assume status=opted-out means "opt out" but the server actually toggles, you might accidentally opt someone back in.
Step 8: change it, then put it back
For state that belongs to a user, a safe testing pattern is read, change, verify, restore, verify restoration.
T0: read → opted-inT1: write → change stateT2: read → opted-outT3: write → restoreT4: read → opted-in
Line by line:
T0: read → opted-inmeans at time zero you read the state and it is opted in.T1: write → change statemeans you send a write to change it.T2: read → opted-outmeans you read again and confirm it actually changed.T3: write → restoremeans you send a write to put it back.T4: read → opted-inmeans you read once more and confirm it is back to the original.
This produces strong evidence with minimal impact and proves three things: the object is writable, the change is real and the change is reversible. It is the digital equivalent of opening someone's door, noting that it opened, and closing it again, rather than leaving it open. Each transition should be documented clearly, so the person reading your report can follow exactly what you did.
Step 9: put it in a table
An access-control bug is easier to reason about in a matrix. A matrix here just means a table that crosses actions against checks:
| Action | Authentication required | Object authorisation | Result |
|---|---|---|---|
| Read consent state | No | None | Vulnerable |
| Change consent state | No | None | Vulnerable |
| Restore state | No | None | Vulnerable |
| Enumerate object existence | No | None | Vulnerable |
Line by line:
- The first column lists what you can do: read the state, change it, restore it, or find out whether an object exists.
- The second column asks whether a login is required. In every row the answer is no.
- The third column asks whether the server checks that you are allowed to touch this specific object. In every row the answer is none.
- The fourth column records the conclusion: each row is vulnerable.
This separates authentication from object-level authorisation, which is exactly where many IDORs hide. The table makes the gap visible: the server is not asking "who are you?" and it is also not asking "are you allowed to touch this one?".
The root cause, in one line
The root cause can be summarised as:
predictable object identifier+identifier treated as authorization+no capability token=IDOR
Line by line:
predictable object identifiermeans the numbers are easy to guess.identifier treated as authorizationmeans the server accepts the number itself as proof that you are allowed.no capability tokenmeans there is no secret key or stamp that would be hard to forge.= IDORmeans the combination produces an Insecure Direct Object Reference.
The backend effectively asks:
Does this recipient exist?
instead of:
Is this requester authorized to act on this recipient?
Line by line:
Does this recipient exist?is a question about the data. It can be answered by anyone who can look up a number.Is this requester authorized to act on this recipient?is a question about the person making the request. It requires checking a credential, a token or an ownership record.
Existence is not authorisation. Nothing in the request flow, such as a signature or capability token, provided authorisation.
What an attacker could actually do
An unauthenticated attacker who knows or guesses one valid identifier could potentially discover neighbouring recipients, determine whether each is opted in or opted out, and change that state. Because the write endpoint accepted both directions, the impact runs two ways.
Direction 1, forced unsubscribe, changes opted-in to opted-out. The potential impact is reduced campaign reach, lost marketing engagement, loss of legitimate subscribers and business disruption. In plain terms: people who wanted to hear from the company stop hearing from it, and the company's numbers quietly drop.
Direction 2, forced resubscribe, changes opted-out to opted-in. The potential impact is users receiving communications they withdrew consent for, consent records becoming unreliable, support and compliance burden, and reputational impact. The second direction is particularly sensitive because the application is altering a recorded expression of user consent. Someone who deliberately said "stop emailing me" is now recorded as having said "keep emailing me".
The endpoint did not expose email addresses, names, phone numbers, addresses or credentials, and the report does not claim account takeover, email disclosure, password access, payment access or arbitrary PII extraction. PII stands for Personally Identifiable Information: data that identifies a specific person, such as a name or email address. The confidentiality impact is limited to subscription state; the integrity impact is unauthorised modification of consent state. It is still meaningful because the company relies on that data to decide whether marketing communications should be sent. The report frames it as low confidentiality impact, meaningful integrity impact, practical enumeration and no authentication.
On regulatory impact, the report is deliberately careful: unauthorised modification of marketing consent may create privacy, compliance or consent-management risk because the organisation can no longer trust that the stored preference reflects the user's actual choice. That is a technical statement, not a legal determination. In other words, a security researcher can say "this data may now be wrong and that has legal consequences for you", without pretending to be a lawyer who has ruled on the law.
How to fix it
A robust fix combines several controls.
- Use a signed or random capability token. The token should cover:
recipientIdlistIdexpirysignature
where:
signature = HMAC(secret, recipientId || listId || expiry)
Line by line:
recipientId,listId,expiryare the values the token is tied to: which recipient, which list, and when the token stops working.signature = HMAC(secret, recipientId || listId || expiry)means the stamp is computed from those values plus a secret key only the server knows.||means "joined together".
Requests without a valid signature should be rejected. If someone changes the recipient number, the signature no longer matches, and the server refuses.
-
Use high-entropy identifiers where possible, such as UUIDv4 or a random 128-bit token, instead of sequential IDs for externally exposed recipient actions. A UUIDv4 is a randomly generated identifier, long enough that guessing one is impractical. Random identifiers make enumeration much harder, but they are not a replacement for proper authorisation when sensitive writes are involved. A random number is harder to guess, but if the server still accepts any valid-looking number without checking permission, the underlying flaw remains.
-
Restrict bidirectional state changes. An endpoint built for one-click unsubscribe should not necessarily let the same unauthenticated capability re-subscribe a user. Separate unsubscribe from subscribe and apply stronger authorisation to the latter. In plain terms: the door marked "leave" should not also be the door marked "join".
-
Add rate limiting and detection as defence in depth. Rate limiting means refusing to answer too many requests from the same source in a short time, like a bouncer who lets one person in per minute. Defence in depth means layering several protections so that if one fails, another still helps. Monitor sequential recipient IDs, high error rates, rapid list switching and large request volumes. Rate limiting reduces enumeration but does not repair broken authorisation, since an attacker may rotate IPs, slow down, distribute requests or reuse leaked identifiers. An IP address is the numeric address your internet connection uses; rotating IPs means switching between different connections to look like different visitors. The primary fix remains requiring valid per-recipient authorisation.
-
Bind tokens to the action. A token issued for unsubscribe should not automatically authorise subscribe or changes to email preferences. A token should ideally be bound to recipient, list, action and expiry where appropriate. Binding means the token says not just "this recipient" but "this recipient, this list, this action, until this time". A ticket for the cinema should not get you into the concert next door.
A checklist you can reuse
- Remove authentication from any object-specific endpoint. Try the request without cookies, Authorization headers, CSRF tokens and session headers, and see whether the operation still works. A positive result is a recipient-specific response with no credential. An Authorization header is a labelled field in a request where credentials are normally placed.
- Change the object identifier, for example
12345 → 12346, and see whether another valid object comes back. A positive result is a different real record. - Test invalid identifiers such as
01999999999999and look for differential responses. A positive result is a distinguishable "not found" versus a real state, which gives an enumeration oracle. - Measure predictability over a small neighbouring range,
N-10 → N+10, without mass enumeration unless explicitly permitted. A positive result is a high proportion of valid neighbours. Mass enumeration means testing thousands of values; it is noisy and can affect real users, so it needs permission. - Search for related endpoints. If
getPreferenceexists, look forsetPreference,updatePreference,savePreferenceanddeletePreference. A positive result is a write endpoint sharing the same broken authorisation model. - Identify the actual authorisation mechanism: is there a signature, a capability token, a session, ownership validation, or is the ID itself trusted? A positive result is an endpoint where the ID alone is the only thing checked.
- Test writes safely, using your own object where possible, and if program rules allow testing on another object, modify only one and restore it immediately. A positive result is a verified state change that can be reversed.
- Verify the change by re-reading the state rather than trusting a success message. A positive result is a read that reflects the write. A success message can be a lie; the stored data cannot.
- Determine scope: how many lists, tenants and object types are affected, and how predictable are the identifiers. A tenant here means a separate customer organisation sharing the same system. A positive result is the same mistake across multiple datasets.
The same pattern appears in unsubscribe systems, password-reset workflows, invoice viewers, file-sharing links, booking systems, support tickets, surveys, loyalty programs, order tracking, event registrations and document portals. The principle is simple: an identifier tells the server which object you want, and it should not by itself prove that you are allowed to access it.
Glossary
- API: the set of addresses and rules a service offers for talking to it programmatically.
- Authentication: proving who you are, for example by logging in.
- Authorisation: deciding whether a given person is allowed to do a specific thing to a specific object.
- Authorization header: a labelled field in a web request where credentials such as tokens are normally sent.
- Bearer token: a token sent with a request that grants access to whoever holds it.
- Body: the part of a web request that carries data, separate from the address.
- Brute-forcing: trying every possible value until one works.
- Capability token: a secret value that grants permission to perform a specific action, like a key.
- Confidentiality: keeping data secret from people who should not see it.
- Cookie: a small piece of data a browser stores for a site and sends back with later requests.
- CSRF (Cross-Site Request Forgery): an attack that tricks a browser into sending a request to a site using the user's existing login.
- CSRF token: a random value included in a site's own forms so that forged requests from elsewhere fail.
- curl: a command-line tool for making web requests and seeing the responses.
- Defence in depth: layering several protections so that if one fails, another still helps.
- Differential testing: sending two requests that differ in one detail and comparing the responses.
- Endpoint: a specific address on a server that performs one job.
- Entropy: the amount of genuine unpredictability in a value.
- Enumerable: able to be walked through value by value to find the real ones.
- GET: the HTTP verb used to retrieve information without changing it.
- HMAC: a standard way of producing a cryptographic stamp using a secret key.
- Identifier (ID): a label a system uses internally to refer to a thing.
- Identifier density: the proportion of nearby identifiers that correspond to real records.
- IDOR (Insecure Direct Object Reference): a flaw where an application lets you refer to an object by its identifier without checking that you are allowed to access it.
- Integrity: keeping data correct and unaltered by people who should not change it.
- IP address: the numeric address an internet connection uses.
- JSON (JavaScript Object Notation): a common text format for structured data, made of labelled values.
- Matrix: a table crossing actions against checks.
- Oracle: any behaviour that answers a question the requester was not supposed to be able to ask.
- Persistent: a change that sticks around after the request ends.
- PII (Personally Identifiable Information): data that identifies a specific person.
- POST: the HTTP verb normally used when sending data that changes something on the server.
- Query parameter: extra information appended to a URL after a question mark.
- Rate limiting: refusing to answer too many requests from the same source in a short time.
- Seed: one real value used as a starting point for further discovery.
- Session cookie: a cookie that identifies a logged-in session.
- Signed token: a token carrying a cryptographic stamp so it cannot be forged or altered.
- Tenant: a separate customer organisation sharing the same system.
- Token: a secret value that acts like a key granting access.
- UUIDv4: a randomly generated identifier long enough that guessing one is impractical.