Skip to content
IDOR Write-up Beginner

First Writeup: Broken Authentication and IDOR | by Ma7mood Bakr

Uploaded student documents were stored at predictable URLs containing the student ID, and the server served them without any authentication. An attacker could change the ID in the URL to view other students' personal photos, national IDs and birth certificates.

ma7moodbakr.medium.com

Published on ma7moodbakr.medium.com

Bug Bounty

Mahmood Bakr, on ma7moodbakr.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 subdomain of a university domain, which the author refers to as sub.redacted.edu.eg. It hosts an e-learning system where students follow up on their activities such as homework and exams. The system also has a page where students upload sensitive documents: National ID, Birth Certificate and Personal Photo.

The author's interest was in that upload page, since upload functionality tends to offer many things to test.

Setup

The write-up does not describe any particular account setup beyond the author acting as a student with an ID number, nor does it list tool versions. The tools used were BurpSuite to intercept the upload request, and manual review of the JavaScript files and the source code of the upload page.

Finding it

The first attempts were aimed at getting code execution or script execution through the upload. The author tried uploading a PHP file and an SVG file carrying an XSS payload. Neither was accepted: the server accepts only jpg, jpeg and png files.

The author then uploaded a personal photo and intercepted the request in BurpSuite. Nothing in the request looked unusual, and the photo was uploaded normally.

Rather than stopping there, the author looked into the JavaScript files and the source code of the upload page. That review revealed the path under which the uploaded photo was stored:

Text
https://sub.redacted.edu.eg/photos/students/1161422/avatar/thum.jpg

The path contains the author's own ID number, 1161422. That is the observation that made the storage location interesting: the identifier of the student is part of the URL, which means the URL is a direct reference to a per-student object.

Exploitation

Step 1: Change the identifier in the storage path

The author changed the ID number in the path from 1161422 to 1161400 and requested the resulting URL:

The response was the personal photo of the student to whom ID 1161400 belongs, returned without any authentication. The same behaviour applied to the other uploaded documents: the Personal ID and the Birth Certificate could be retrieved the same way by changing the identifier.

Step 2: Repeat across identifiers

Because the identifier sits directly in the path, the same request can be repeated with other values to try to reach other students' files. The author describes this as working "and so on" for the other document types, the Personal ID and Birth Certificate.

Root cause

The uploaded files are served from a predictable, identifier-based path (/photos/students/<id>/avatar/thum.jpg) and the server returns them to anyone who requests that path. Access control on the uploaded documents is missing at the point where the files are served: knowing or guessing the student identifier is enough to read another student's files. This is a classic insecure direct object reference, where the object reference in the URL is the only thing standing between a requester and the object.

The upload-side validation did not help here. The server restricted uploads to jpg, jpeg and png, which blocked the PHP and SVG attempts, but file type validation says nothing about who may later read a stored file. The author does not describe any authentication check, token or signed URL protecting the storage path.

Impact

An attacker who can reach the storage path can retrieve other students' uploaded documents, including the Personal Photo, the National ID and the Birth Certificate, without the owner's permission and without authentication. The author frames this as disclosing all users' data. The practical limit is that the attacker needs the student identifier, which in this case is a numeric value embedded in the URL.

Fix

The author reported the issue to the IT manager and states that it has been fixed. The write-up does not describe the fix that was applied.

Variants to test

  1. Sequential object identifiers in file paths. Take any URL that contains a numeric or otherwise guessable identifier for a stored file and substitute a neighbouring value. A positive result is another user's file being returned without authentication.
  2. Identifier in the path versus identifier in a parameter. Try the same substitution where the identifier appears as a query parameter or in a JSON body. A positive result is the same unauthorised retrieval through a different surface.
  3. Other document types under the same storage scheme. Once one file type is reachable by identifier, request the sibling paths for other document types (for example the National ID and Birth Certificate in this report). A positive result is each additional document type being served to an unauthenticated requester.
  4. Upload validation versus retrieval authorisation. Where an upload endpoint enforces strict file type checks, verify separately whether the stored file is protected when fetched. A positive result is a file that passes upload validation but is readable by anyone who knows its URL.

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

What happened, in plain words

A student at a university used a website for their studies. The site let students upload personal documents: a National ID, a Birth Certificate and a Personal Photo. The student who wrote this report was curious about the upload page, because upload pages are often a good place to look for mistakes.

After a few failed attempts to upload files the server did not want, they uploaded their own photo and looked at the web address where the photo ended up. That address contained their own student number. They changed the number to a different one, opened the new address in a browser, and saw another student's photo. The same trick worked for the other documents too. No login was needed to see them.

This kind of mistake has a name: IDOR, short for Insecure Direct Object Reference. The idea is simple. Imagine a hotel where every room key is just the room number written on a piece of paper, and the front desk never checks who you are. If you know room 214 exists, you can ask for the key to room 214 even though you booked room 213. The website here worked the same way: the address of a file was the only thing needed to get it, and the address was easy to guess.

This is a beginner's version of the write-up, so every technical idea is explained from scratch as it appears.

The target

The author calls the target sub.redacted.edu.eg. That is a subdomain: a smaller section of a larger domain name. If a domain is like a building's street address, a subdomain is a named office inside it. The .edu.eg ending tells you it belongs to an educational institution in Egypt.

This subdomain hosts an e-learning system. An e-learning system is a website where students do school work online: they check homework, take exams, and follow up on their activities. The system also has a page where students upload sensitive documents:

  • National ID
  • Birth Certificate
  • Personal Photo

"Sensitive" here means documents you would not want a stranger to see. A National ID can be used to impersonate someone. A Birth Certificate contains personal details. A photo identifies a face.

The author says they usually like to test any upload page, because upload pages have many moving parts and therefore many chances for a mistake.

First attempts: trying to upload the wrong kind of file

Before looking at where files are stored, the author tried to make the server accept files it should not accept. Two attempts were made:

  1. Upload a PHP file. PHP is a programming language that runs on web servers. If a server accepts a PHP file and later runs it, an attacker can sometimes make the server do things it was never meant to do. This is called code execution.
  2. Upload an SVG file carrying an XSS payload. SVG is an image format, but unlike JPG or PNG it can contain scripts. XSS, short for Cross-Site Scripting, is a trick where a script hidden in a page runs in another visitor's browser. If the server stored an SVG and showed it to other students, that script might run in their browsers.

Neither attempt worked. The server accepts only jpg, jpeg and png files. Those three are ordinary picture formats. They cannot carry scripts the way SVG can, and they are not programs the server would run.

This is a useful lesson on its own: the upload side was reasonably strict. But as we will see, strict upload rules say nothing about who is allowed to read the file afterwards.

Looking at the upload request

Next, the author uploaded their own personal photo and intercepted the request with BurpSuite.

A quick explanation of those two ideas:

  • When you fill in a form on a website and press a button, your browser sends a request to the server. The request is a short message that says what you want and carries your data.
  • BurpSuite is a tool that sits between your browser and the server. It lets you pause a request, look at it, change it, and then send it on. Think of it as a postal worker who lets you open your own letter before it is delivered.

The author looked at the intercepted request and found nothing that seemed weird. The photo was uploaded normally. So the upload request itself was not the problem.

Reading the page's own code

The author did not give up. They started looking into the JavaScript files and the source code of the upload page.

  • Source code is the set of instructions that make up a web page. In a browser you can usually see it with a right-click and an option like "View Page Source".
  • JavaScript is the programming language that runs inside your browser. It makes pages interactive: buttons that respond, forms that check your input, images that load after the page appears. JavaScript files are separate text files the page loads, and they are readable by anyone.

Reading these files is a normal, harmless activity. It is like reading the instructions printed on the back of a machine. Sometimes those instructions reveal how the machine names and stores things.

That review revealed the path under which the uploaded photo was stored:

Text
https://sub.redacted.edu.eg/photos/students/1161422/avatar/thum.jpg

Line by line, in plain words:

  • https:// is the secure version of the protocol browsers use to fetch web pages. The s stands for secure: the traffic is encrypted.
  • sub.redacted.edu.eg is the subdomain we are talking about, the e-learning system.
  • /photos/students/ is a folder-like part of the address. It tells the server we are looking inside a place where student photos are kept.
  • 1161422 is a number. In this case it is the author's own student ID number.
  • /avatar/ is another folder-like part. "Avatar" usually means a profile picture.
  • thum.jpg is the file name. "Thum" is likely short for thumbnail, a small version of the picture, and .jpg is the picture format.

The important observation is the number in the middle. The address contains the student's own ID. That means the address is a direct reference to one particular student's file. The server does not need to ask "who are you?" to find the file; the address alone points at it.

Exploitation

Step 1: Change the identifier in the storage path

The author changed the ID number in the path from 1161422 to 1161400 and requested the resulting URL:

Line by line:

  • Everything is the same as before except the number.
  • 1161400 is a different student's ID, close to the author's own. Because IDs are usually handed out in order, neighbouring numbers belong to other real students.
  • The rest of the address, /photos/students/ and /avatar/thum.jpg, is unchanged, so the server looks in the same place for the same kind of file.

The response was the personal photo of the student to whom ID 1161400 belongs, returned without any authentication.

Authentication means proving who you are, usually by logging in with a username and password. When a page is returned "without authentication", it means the server did not ask the visitor to log in at all. Anyone with a browser and that address could see the photo.

The same behaviour applied to the other uploaded documents: the Personal ID and the Birth Certificate could be retrieved the same way by changing the identifier.

Step 2: Repeat across identifiers

Because the identifier sits directly in the path, the same request can be repeated with other values to try to reach other students' files. The author describes this as working "and so on" for the other document types, the Personal ID and Birth Certificate.

Sequential means the numbers follow one another: 1161400, 1161401, 1161402, and so on. If you can see one student's file, you could try the next number. This is called enumeration: walking through a list of possible values one by one. It is like trying every room number in a hotel corridor.

Root cause

The uploaded files are served from a predictable, identifier-based path (/photos/students/<id>/avatar/thum.jpg) and the server returns them to anyone who requests that path. Access control on the uploaded documents is missing at the point where the files are served: knowing or guessing the student identifier is enough to read another student's files. This is a classic insecure direct object reference, where the object reference in the URL is the only thing standing between a requester and the object.

Access control is the set of rules that decides who is allowed to see or do what. A good access control rule here would be: only the student whose ID appears in the path, or a staff member, may fetch this file. That rule was missing.

The upload-side validation did not help here. The server restricted uploads to jpg, jpeg and png, which blocked the PHP and SVG attempts, but file type validation says nothing about who may later read a stored file. The author does not describe any authentication check, token or signed URL protecting the storage path.

A token in this context is a short piece of text that proves you are allowed to do something, like a wristband at an event. A signed URL is an address with a secret code attached, so the server can tell the address was handed out by someone authorised. Neither was present here.

Impact

An attacker who can reach the storage path can retrieve other students' uploaded documents, including the Personal Photo, the National ID and the Birth Certificate, without the owner's permission and without authentication. The author frames this as disclosing all users' data. The practical limit is that the attacker needs the student identifier, which in this case is a numeric value embedded in the URL.

In everyday terms: someone who worked out the pattern could look at another student's identity documents. They did not need a password or an account. A browser was enough.

Fix

The author reported the issue to the IT manager and states that it has been fixed. The write-up does not describe the fix that was applied.

Variants to test

These are patterns to look for on other sites, not steps that were performed in this report.

  1. Sequential object identifiers in file paths. Take any URL that contains a numeric or otherwise guessable identifier for a stored file and substitute a neighbouring value. A positive result is another user's file being returned without authentication.
  2. Identifier in the path versus identifier in a parameter. Try the same substitution where the identifier appears as a query parameter or in a JSON body. A positive result is the same unauthorised retrieval through a different surface.
  3. Other document types under the same storage scheme. Once one file type is reachable by identifier, request the sibling paths for other document types (for example the National ID and Birth Certificate in this report). A positive result is each additional document type being served to an unauthenticated requester.
  4. Upload validation versus retrieval authorisation. Where an upload endpoint enforces strict file type checks, verify separately whether the stored file is protected when fetched. A positive result is a file that passes upload validation but is readable by anyone who knows its URL.

Glossary

  • Access control: the rules that decide who may see or do what on a system.
  • Authentication: proving who you are, usually by logging in.
  • Avatar: a profile picture, often a small one shown next to a name.
  • BurpSuite: a tool that sits between your browser and a server so you can pause, inspect and change requests.
  • Code execution: when an attacker makes a server run code it was not meant to run.
  • Direct object reference: an address or identifier that points straight at one stored item, such as a file or a record.
  • Domain: the main name of a website, such as example.com.
  • E-learning system: a website where students do school work online, such as homework and exams.
  • Enumeration: trying possible values one by one, such as walking through a list of numbers.
  • IDOR (Insecure Direct Object Reference): a flaw where an address or identifier points at an item and the server does not check whether you are allowed to see it.
  • JavaScript: the programming language that runs inside your browser and makes pages interactive.
  • JPG / JPEG / PNG: common picture file formats that cannot carry scripts the way SVG can.
  • PHP: a programming language that runs on web servers.
  • Request: the message your browser sends to a server when you open a page or submit a form.
  • Sequential: following one another in order, such as 1, 2, 3.
  • Signed URL: an address with a secret code attached so the server can tell it was handed out by someone authorised.
  • Source code: the instructions that make up a web page, which anyone can view in a browser.
  • Subdomain: a named section of a larger domain, such as sub in sub.example.com.
  • SVG: an image format that can contain scripts, unlike JPG or PNG.
  • Token: a short piece of text that proves you are allowed to do something.
  • XSS (Cross-Site Scripting): a trick where a script hidden in a page runs in another visitor's browser.

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.