Skip to content
IDOR Write-up Beginner

A Story of IDOR which leads to privacy violation…$$$

The application used a user-supplied numeric identifier (lead_image) to reference uploaded profile images without checking ownership. An attacker could change this parameter to another user's image ID and replace their own profile picture with the victim's image, causing a privacy violation.

amitlt.medium.com

Published on amitlt.medium.com

Cybersecurity

Amit Kumar Biswas @Amitlt2, on amitlt.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. 5 min read.

Context

This is a short write-up about an insecure direct object reference (IDOR) found in a CMS-style web application during a bug bounty engagement. The feature involved is a profile editing page that lets a user upload a display picture (DP) and submit the profile for moderator approval. The profile edit request is sent to /cms/pages/2913/edit/, and the submitted form carries a lead_image parameter that identifies the uploaded image.

The author opens with the standard definition of IDOR, quoting PortSwigger: it is an access control vulnerability that arises when an application uses user-supplied input to access objects directly, popularised by its appearance in the OWASP 2007 Top Ten. The quote also notes that IDOR is most commonly associated with horizontal privilege escalation but can also arise in relation to vertical privilege escalation.

Setup

Two accounts were used:

  1. A victim account, on which the author uploaded a display picture through the normal profile editing functionality.
  2. A second account, registered as the attacker, on which the author uploaded a different display picture.

No tools, versions or special preconditions are described beyond the two accounts and the ability to reach the profile edit page while authenticated.

Finding it

While testing the file-uploading functionality, the author noticed that submitting the profile form sent a parameter identifying the uploaded image, in the form lead_image=6109. After creating the second (attacker) account and uploading a picture there, the same parameter came back with a different value, lead_image=6110.

The parameter is a direct reference to an object (the image), supplied by the client, with no visible binding to the account that owns it.

Exploitation

Step 1: capture the victim's image identifier

Uploading a display picture on the victim account produced a submission containing lead_image=6109.

Step 2: capture the attacker's image identifier

Uploading a display picture on the attacker account produced a submission containing lead_image=6110.

Step 3: swap the identifier

As the attacker, the author changed the parameter from 6110 to 6109 and resubmitted the profile edit request. The captured request looks like this:

HTTP
POST /cms/pages/2913/edit/ HTTP/2
Host: Redacted.com
Cookie: {Your’s Cookie}
User-Agent: {Your’s Info}
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/avif, image/webp, */*;q=0.8
Accept-Language: en-US, en; q=0.5
Accept-Encoding: gzip, deflate
Referer: https://Vulnerable.Redacted.com/cms/pages/2913/edit/
Content-Type: application/x-www-from-urlencoded
Content-Length: 240
Origin: https://Vulnerable.Redacted.com
Upgraded-insecure-Request: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: 71
Te: trailers

csrfmiddlewaretoken=anaiamamidw9292992 nnenfunenfnenfue93nnn&next=&slug=Attacker+profile&lead_image=6109&bio=&Location=&website=&action-submit=Submit+to+Moderators+approval

The important parts:

  • The request goes to the profile edit endpoint /cms/pages/2913/edit/ on the vulnerable host, authenticated with the attacker's own session cookie.
  • The body is form-encoded and includes a csrfmiddlewaretoken, so the request is a legitimate, CSRF-protected submission made from the attacker's own browser session.
  • slug=Attacker+profile and the other profile fields (bio, Location, website) belong to the attacker; only lead_image was changed.
  • lead_image=6109 now points at the victim's image instead of the attacker's own 6110.
  • action-submit=Submit+to+Moderators+approval submits the profile for moderator approval.

Step 4: observe the result

After the swap, the attacker's display picture was replaced with the victim's display picture. The author reports this as a successful change: the attacker's DP became the victim's DP.

Root cause

The application accepts a client-supplied lead_image identifier and uses it to set the image associated with the profile being edited, without checking that the referenced image belongs to the authenticated user. Because the identifier is a client-supplied number, a user can try another user's identifier and attach that image to their own profile.

The request still carried a valid csrfmiddlewaretoken, so the anti-CSRF defence was working as intended; it protects against cross-site forgery, not against an authenticated user deliberately referencing someone else's object. The missing control is an authorisation check on the object reference itself, likely at the point where the server resolves lead_image to an image record.

Impact

An authenticated attacker can take another user's uploaded image and use it as their own display picture. The author frames this as a privacy violation: the victim's picture is pulled into the attacker's profile. The report does not describe any further consequences, such as access to the original file, metadata, or other users' data beyond the image itself.

Fix

The report states only that the bug was reported and that its status is fixed. It does not describe the change that was made. The control that would address the issue is a server-side ownership check: when resolving lead_image, verify that the referenced image belongs to the authenticated user before associating it with the profile, and reject the request otherwise.

Variants to test

  1. Sequential object identifiers in profile or content forms. Look for numeric parameters such as image, avatar, attachment or media IDs in edit forms. A positive result is that submitting another user's ID changes your profile or content to reference their object.
  2. Identifier swap on upload endpoints. Upload a file as user A, note the returned ID, then upload or submit as user B with A's ID. A positive result is B's record pointing at A's file.
  3. Cross-account references in approval workflows. Where a submission goes to moderators, check whether referenced objects are re-validated at approval time. A positive result is the swapped reference surviving moderation and appearing publicly.
  4. Enumeration of adjacent IDs. Walk IDs around your own (for example, one lower and one higher) and check whether the application returns or accepts objects you do not own. A positive result is any object belonging to another account being accepted or disclosed.
  5. Removing or duplicating the parameter. Try omitting lead_image or sending it twice to see how the server resolves the reference. A positive result is the server falling back to another user's object or accepting the last value without an ownership check.

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. 17 min read.

What happened, in plain words

A website let people upload a picture to use as their profile photo. Behind the scenes, the profile form sent a simple number identifying the uploaded picture. When you saved your profile, your browser sent that number back to the website to say "use picture number 6109 as my photo".

The researcher noticed the numbers differed: their first account's picture was number 6109, and a second account's picture was number 6110. So they tried a simple trick: while logged in as the second account, they told the website to use picture number 6109 instead of their own 6110. The website did it without asking whether that picture belonged to them. The second account's profile photo became the first account's photo.

That is the whole bug. It is called an IDOR (insecure direct object reference): the website trusts a number that the user's browser sends, and uses it to pick a thing (here, an image) without checking that the user is allowed to use that thing. The researcher reported it, and the report says the status is fixed.

The idea behind it: what an IDOR is

Before the story, a quick word on the term. An access control system is the part of a website that decides who is allowed to do what: which pages you can see, which records you can edit, which files you can download. When access control is missing or wrong, people can reach things they should not.

An IDOR is one specific kind of access-control mistake. It happens when a website uses something the user's browser sends (a number, a name, a code) to look up a record directly, and does not check that this particular user is allowed to touch that record. The researcher quotes PortSwigger's definition, which says IDOR is a type of access control vulnerability that arises when an application uses user-supplied input to access objects directly, that the term was popularised by its appearance in the OWASP 2007 Top Ten, and that IDOR is most commonly associated with horizontal privilege escalation but can also arise in relation to vertical privilege escalation.

Two of those phrases deserve a plain explanation:

  • Horizontal privilege escalation means moving sideways: you are a normal user, and you reach another normal user's data. Same level, different person. That is what happened here: one account reached another account's picture.
  • Vertical privilege escalation means moving upwards: you are a normal user, and you reach something reserved for administrators or moderators. Higher level.

An everyday comparison: imagine a hotel where the receptionist hands you a key labelled "room 6109" and never checks that you are the guest in 6109. If the keys are numbered in order, you can simply ask for the key to the room next door. Nothing is hacked in a dramatic sense; the lock works, but nobody asked whether the key was yours to take.

The setup: two accounts

The researcher used two accounts on the same website:

  1. A victim account. On this account, they uploaded a display picture through the normal profile editing feature, exactly as any ordinary user would.
  2. A second account, registered as the attacker. On this account, they uploaded a different display picture.

That is the entire setup. No special tools, no software versions and no preconditions are described beyond having two accounts and being able to open the profile edit page while logged in.

A note on the words victim and attacker here: both accounts belong to the researcher. "Victim" just means the account whose data is being reached without permission, and "attacker" means the account doing the reaching. In a real attack these would be two different people.

What the feature does

The feature is a profile editing page in what the report calls a CMS-style web application. CMS stands for content management system: software that lets people create and edit content (pages, profiles, articles) through a web interface rather than by writing code. Think of it as the back office of a website.

The page lives at a path of the form /cms/pages/2913/edit/. A path (or URL path) is the part of a web address after the site name that points at a particular page, a bit like a folder path on your computer. The path ends in edit, which suggests an editing view.

The submitted form contains a display picture (the report abbreviates this as DP), profile fields such as bio, location and website, and a submit action for moderator approval.

When the form is submitted, the browser sends a parameter called lead_image that identifies the uploaded image. A parameter is a named value sent along with a request, like a labelled field on a paper form: the label is the name (lead_image) and the value is what you wrote in it (6109).

Finding it: the numbers that count up

While testing the file-uploading functionality, the researcher noticed that submitting the profile form sent a parameter identifying the uploaded image, in the form lead_image=6109.

Then they created the second (attacker) account and uploaded a picture there. The same parameter came back with a different value: lead_image=6110.

Why does this matter? Two things stood out:

  1. The values are close together: 6109, then 6110. A nearby number is easy to try.
  2. The value is a plain integer rather than a long random string.

Together, this made lead_image an obvious candidate for tampering. It is a direct reference to an object (the image), supplied by the client (the browser), with no visible binding to the account that owns it. In other words: the browser says "use image 6109", and nothing in the request ties that number to the person sending it.

A comparison: a cloakroom that gives out tickets numbered 1, 2, 3 in order. If you are handed ticket 42, you can guess that ticket 41 belongs to the person who came just before you. If the cloakroom never checks the ticket against your face, you can hand in 41 and walk away with their coat.

Exploitation, step by step

Step 1: capture the victim's image identifier

Uploading a display picture on the victim account produced a submission containing lead_image=6109. The researcher noted this number down. This is the identifier of the victim's image: the thing we want to reach.

Why this step: to know the target. You cannot swap in a number you have not seen.

Step 2: capture the attacker's image identifier

Uploading a display picture on the attacker account produced a submission containing lead_image=6110. This is the attacker's own image identifier: the thing the website expects from this account.

Why this step: to have a baseline. You now know what a normal, legitimate request from the attacker account looks like, so you can change exactly one thing and see what happens.

Step 3: swap the identifier

As the attacker, the researcher changed the parameter from 6110 to 6109 and resubmitted the profile edit request. The captured request looks like this:

HTTP
POST /cms/pages/2913/edit/ HTTP/2
Host: Redacted.com
Cookie: {Your’s Cookie}
User-Agent: {Your’s Info}
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/avif, image/webp, */*;q=0.8
Accept-Language: en-US, en; q=0.5
Accept-Encoding: gzip, deflate
Referer: https://Vulnerable.Redacted.com/cms/pages/2913/edit/
Content-Type: application/x-www-from-urlencoded
Content-Length: 240
Origin: https://Vulnerable.Redacted.com
Upgraded-insecure-Request: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: 71
Te: trailers

csrfmiddlewaretoken=anaiamamidw9292992 nnenfunenfnenfue93nnn&next=&slug=Attacker+profile&lead_image=6109&bio=&Location=&website=&action-submit=Submit+to+Moderators+approval

This is an HTTP request: the message your browser sends to a web server to ask it to do something. It has two parts: a set of headers (the lines at the top, which are metadata about the request) and a body (the content after the blank line, which here is the form data).

Line by line, in plain words:

  • POST /cms/pages/2913/edit/ HTTP/2: this is the request line. POST is the method, meaning "I am sending data to be processed" (as opposed to GET, which just asks for a page). /cms/pages/2913/edit/ is the path being targeted: the edit page for page record 2913. HTTP/2 is the version of the protocol being spoken, the language browsers and servers use to talk to each other.
  • Host: Redacted.com: which website this request is for. One server can host many sites, so the request names the one it wants. The real name has been replaced with Redacted.com to keep the target private.
  • Cookie: {Your’s Cookie}: the cookie is a small piece of data your browser stores for a site and sends back with every request. It is how the site recognises you between page loads. Here it is a placeholder: the researcher's own session cookie would go here. A session cookie is the specific cookie that proves you are logged in, like a wristband at an event. If someone else had your cookie, they could act as you, which is why it is never shared in a report.
  • User-Agent: {Your’s Info}: tells the server what browser and operating system you are using. Again a placeholder.
  • Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/avif, image/webp, */*;q=0.8: tells the server which kinds of content the browser can handle, and roughly how much it prefers each. The q=0.9 and q=0.8 are preference weights; */* means "anything else is fine too".
  • Accept-Language: en-US, en; q=0.5: which languages the browser prefers, here US English first, then generic English.
  • Accept-Encoding: gzip, deflate: which compression formats the browser can decompress. Compression makes responses smaller and faster.
  • Referer: https://Vulnerable.Redacted.com/cms/pages/2913/edit/: the page the browser was on when it sent this request. (Yes, it is spelled Referer, a historical misspelling that stuck.)
  • Content-Type: application/x-www-from-urlencoded: tells the server how the body is formatted. This value says the body is form data encoded in the usual way, with name=value pairs joined by &. (The value as written in the report contains from rather than form; that is how it appears in the captured request.)
  • Content-Length: 240: the size of the body in bytes, so the server knows how much to read.
  • Origin: https://Vulnerable.Redacted.com: which site the request originates from. Servers use this for security checks, for example to spot requests coming from another site.
  • Upgraded-insecure-Request: 1: a header as captured in the report. Its meaning is not explained in the report.
  • Sec-Fetch-Dest: document, Sec-Fetch-Mode: navigate, Sec-Fetch-Site: same-origin, Sec-Fetch-User: 71: a group of headers modern browsers add automatically to describe the context of a request. Dest: document means the result is meant to be shown as a page; Mode: navigate means this is a top-level navigation (like clicking a link or submitting a form); Site: same-origin means the request is going to the same site the page came from. Sec-Fetch-User: 71 is as captured in the report; the usual value for this header is ?1, and the report does not explain the value shown.
  • Te: trailers: tells the server the browser can accept trailing headers, an optional extra part of some responses.
  • The blank line separates headers from body.
  • The body: csrfmiddlewaretoken=anaiamamidw9292992 nnenfunenfnenfue93nnn&next=&slug=Attacker+profile&lead_image=6109&bio=&Location=&website=&action-submit=Submit+to+Moderators+approval. This is the form data, as name=value pairs joined by &. In plain words:
    • csrfmiddlewaretoken=...: a 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 while you are logged in there. To defend against it, the site puts a secret, unpredictable value into each form and checks it when the form comes back. If the value is missing or wrong, the request is rejected. The presence of this token means the request is a legitimate, CSRF-protected submission made from the attacker's own browser session, not a forged one from another site.
    • next=: an empty field, probably where to go after submitting.
    • slug=Attacker+profile: the profile's short name. In form encoding, + stands for a space, so this reads "Attacker profile".
    • lead_image=6109: the swapped identifier. This now points at the victim's image instead of the attacker's own 6110. This is the one and only change from the legitimate request.
    • bio=, Location=, website=: the other profile fields, left empty. They belong to the attacker.
    • action-submit=Submit+to+Moderators+approval: which button was pressed, here the one that submits the profile for moderator approval.

The important parts, restated:

  • The request goes to the profile edit endpoint /cms/pages/2913/edit/ on the vulnerable host, authenticated with the attacker's own session cookie.
  • The body is form-encoded and includes a csrfmiddlewaretoken, so the request is a legitimate, CSRF-protected submission made from the attacker's own browser session.
  • slug=Attacker+profile and the other profile fields (bio, Location, website) belong to the attacker; only lead_image was changed.
  • lead_image=6109 now points at the victim's image instead of the attacker's own 6110.
  • action-submit=Submit+to+Moderators+approval submits the profile for moderator approval.

Why this step: to test the hypothesis. If the server checks ownership, the request should be rejected or the image should stay the attacker's. If it does not check, the attacker's profile will end up pointing at the victim's image.

Step 4: observe the result

After the swap, the attacker's display picture was replaced with the victim's display picture. The researcher reports this as a successful change: the attacker's DP became the victim's DP.

Why this step: to confirm the bug is real and not just a number that the server ignores. The visible change on the profile is the proof.

Why it worked: the root cause

The application accepts a client-supplied lead_image identifier and uses it to set the image associated with the profile being edited, without checking that the referenced image belongs to the authenticated user. Because the identifier is a client-supplied number, a user can try another user's identifier and attach that image to their own profile.

Enumerate means to walk through values one by one, trying nearby numbers to find ones that belong to other people.

The request still carried a valid csrfmiddlewaretoken, so the anti-CSRF defence was working as intended. This is worth pausing on, because it is a common point of confusion: CSRF protection and authorisation are different things. CSRF protection answers "did this request really come from our own site, sent by the user's own browser?" It does not answer "is this user allowed to touch this particular record?" Here the first question was answered correctly (yes, a real form submission from the attacker's browser), and the second question was never asked. The missing control is an authorisation check on the object reference itself, likely at the point where the server resolves lead_image to an image record.

A comparison: a building where the front door checks that you have a valid key card (CSRF), but the individual office doors have no locks at all (authorisation). You get in legitimately, then walk into any office you like.

What an attacker could do with it

An authenticated attacker can take another user's uploaded image and use it as their own display picture. The researcher frames this as a privacy violation: the victim's picture, presumably intended to be shown only in the context the victim chose, is pulled into the attacker's profile.

In plain terms: the victim's photo ended up as the attacker's display picture.

The report does not describe any further consequences, such as access to the original file, metadata, or other users' data beyond the image itself.

The fix

The report states only that the bug was reported and that its status is fixed.

The control that would address the issue is a server-side ownership check: when resolving lead_image, verify that the referenced image belongs to the authenticated user before associating it with the profile, and reject the request otherwise. Server-side means the check happens on the server, not in the browser. Checks done in the browser can be bypassed, because the attacker controls the browser; checks done on the server cannot.

A comparison: the cloakroom attendant now looks at the ticket and at your face, and only hands over the coat if the ticket matches you.

Variants to test

If you want to look for similar bugs yourself, these are the patterns worth trying. Each one lists what to look for and what a positive result looks like.

  1. Sequential object identifiers in profile or content forms. Look for numeric parameters such as image, avatar, attachment or media IDs in edit forms. A positive result is that submitting another user's ID changes your profile or content to reference their object.
  2. Identifier swap on upload endpoints. Upload a file as user A, note the returned ID, then upload or submit as user B with A's ID. A positive result is B's record pointing at A's file.
  3. Cross-account references in approval workflows. Where a submission goes to moderators, check whether referenced objects are re-validated at approval time. A positive result is the swapped reference surviving moderation and appearing publicly.
  4. Enumeration of adjacent IDs. Walk IDs around your own (for example, one lower and one higher) and check whether the application returns or accepts objects you do not own. A positive result is any object belonging to another account being accepted or disclosed.
  5. Removing or duplicating the parameter. Try omitting lead_image or sending it twice to see how the server resolves the reference. A positive result is the server falling back to another user's object or accepting the last value without an ownership check.

Glossary

  • Access control: the part of a system that decides who is allowed to do what.
  • Attacker account: in this report, the account used to try to reach another account's data. Both accounts belonged to the researcher.
  • Authorisation check: a check that a specific user is allowed to perform a specific action on a specific record.
  • Body: the part of an HTTP request that carries data, such as form fields.
  • Bug bounty: a programme where organisations reward people for finding and reporting security bugs responsibly.
  • Client: the software on the user's side, usually the browser, which sends requests to a server.
  • CMS (content management system): software for creating and editing website content through a web interface.
  • Cookie: a small piece of data a site stores in your browser and receives back with each request, used to recognise you.
  • CSRF (cross-site request forgery): an attack where a malicious site tricks your logged-in browser into sending a request to another site.
  • CSRF token (csrfmiddlewaretoken): a secret, unpredictable value placed in a form and checked by the server to prove the submission came from the site's own pages.
  • Display picture (DP): the image shown next to a user's name on their profile.
  • Endpoint: a specific address on a server that accepts requests, such as a particular page or form handler.
  • Enumeration: walking through values one by one (for example, sequential IDs) to find ones that belong to other people.
  • Form encoding (application/x-www-form-urlencoded): the standard way of packing form fields into a request body as name=value pairs joined by &.
  • Headers: the metadata lines at the top of an HTTP request or response.
  • Horizontal privilege escalation: reaching another user's data at the same privilege level as your own.
  • Host: the website name a request is addressed to.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • HTTP/2: a version of HTTP.
  • IDOR (insecure direct object reference): an access-control bug where the application uses user-supplied input to access an object directly without checking the user is allowed to.
  • Moderator approval: a review step where a human checks a submission before it goes live.
  • OWASP Top Ten: a well-known list of the most common web application security risks.
  • Parameter: a named value sent with a request, like a labelled field on a form.
  • Path: the part of a URL after the site name that points at a particular page or resource.
  • POST: an HTTP method used to send data to the server for processing.
  • Privacy violation: exposing or misusing data a person expected to stay within a particular context.
  • Referer: a header telling the server which page the request came from.
  • Request: the message a browser sends to a server asking it to do something.
  • Root cause: the underlying reason a bug exists, as opposed to its visible symptom.
  • Sequential identifier: an ID that counts up by one each time, making it easy to guess neighbouring values.
  • Server-side: happening on the server, where the user cannot tamper with it.
  • Session cookie: the cookie that proves you are logged in.
  • Slug: a short, URL-friendly name for a record, such as a profile name.
  • User-Agent: a header describing the browser and operating system making the request.
  • Vertical privilege escalation: reaching data or actions reserved for a higher privilege level, such as administrators.
  • Victim account: in this report, the account whose data was reached without permission.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.