Skip to content
IDOR Write-up Beginner

Breaking Application’s Logic to DOS Attack

The file deletion endpoint lacked access control and used sequential file IDs, allowing an attacker to delete any file by guessing its ID. A script could iterate through IDs and delete files belonging to other users, causing a denial of service for file sharing.

Abhijeet Singh Follow

Published on medium.com

Hey guys, Recently I had found a bug which was fine enough to deserve this post. So, I thought of writing it up here.

Abhijeet Singh, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

Context

The target is a file sharing application, similar to WeTransfer, in which a user sends a file to another user by supplying the receiver's email, the sender's email, a verified mobile number and the files themselves. The company behind it is not named because of a non-disclosure agreement, and the report refers to it as redacted.com.

how it looks From the original on medium.com

how it looks

The feature has two parts that matter here. Uploading a file returns a file id for that upload, and the same id is visible in the browser's Inspector. There is also an option to remove a file from the server, for the case where the wrong file was uploaded.

Setup

The report does not describe any accounts, roles or tooling beyond a browser with its Inspector and a Python 3 script. The only precondition is that you upload a file yourself and read the current file id from the upload response or from the Inspector.

Finding it

When a file is uploaded, the response contains a file id. The id is also visible in the Inspector.

Upload a file > get a file_id. From the original on medium.com

Upload a file > get a file_id.

The removal of a file is performed with a POST request that carries the file id in the request body. Two properties of that request stood out:

  1. The file id is sequential in nature, so ids can be enumerated.
  2. There is no access control on removal, so any file id can be submitted, not only the ones belonging to the caller.

That combination is a classic IDOR: anyone who knows your file id can remove your file, and because ids are sequential, knowing one is not even necessary.

If file was present then it shows success, otherwise fail. From the original on medium.com

If file was present then it shows success, otherwise fail.

The response distinguishes the two cases. If the file was present, removal succeeds; otherwise it fails. When a file id has been removed, the user simply gets an error message saying "Something went wrong, Please try again".

error message From the original on medium.com

error message

Exploitation

The researcher took the IDOR further by automating it, turning a single-object deletion into a denial of service. The script is invoked as:

Bash
python3 dos_poc.py <file_id>

Step 1: obtain a starting id

Upload a file on the website and read the current file id from the Inspector. This value is passed to the script as its argument, for example:

Bash
python3 dos_poc.py 310

Step 2: build a range

The script creates a range starting at the supplied id; in the example, 310 produces the range 310 to 330.

Step 3: send removal requests across the range

The script sends a POST request to remove each file id in the range, 310 to 330 in the example. The request is the same removal request the application itself issues, with the file id in the body.

Step 4: slide the range on success

If the script finds a success message in the response to any request, it increases its range automatically. If 310 was found successful in the response, the new range becomes 311 to 331, and the attack continues.

From the original on medium.com

Because the range follows the successes, the script keeps walking forward through the id space and the attack continues.

Root cause

The removal endpoint trusts the file id supplied in the POST body and performs no access control check on it, so any caller can remove any file. The ids are sequential, which makes the whole id space enumerable. Neither of these is anomalous traffic: every request is a well-formed removal request that the application itself would issue, so a WAF has nothing to match on. As the researcher puts it, no WAF could have detected the attack because of its non-malicious behaviour; the abuse is entirely in the logic of the application.

Impact

While the script runs, anyone trying to share files through the website is affected: their files are deleted from the server automatically and they are shown the error message "Something went wrong, Please try again later.". The researcher describes the IDOR as High severity and the chained denial of service as Critical. The range only advances on a success response.

Fix

The report does not say what the vendor changed.

Variants to test

  1. Sequential object ids in any POST body. Upload an object, note its id, and submit removal or modification requests with neighbouring ids. A positive result is a success response for an id you do not own.
  2. Response-based oracles. Look for endpoints whose response differs between "object exists" and "object does not exist". A positive result is a reliable success/failure signal that a script can use to drive a range, as here.
  3. Automated range walking. Write a loop that starts from your own id and advances the window whenever a success is returned. A positive result is a run that keeps deleting other users' objects without ever tripping a WAF.
  4. Other state-changing actions on the same id. Test whether the same unprotected id also works for actions other than removal. A positive result is any action on another user's object that the application accepts.

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

What happened, in plain words

A researcher found a bug in a file sharing website. The website worked a lot like WeTransfer: you type in the receiver's email address, your own email address, a mobile number that has to be verified, and you attach the files you want to send. The company that runs the site is not named in the report because of a non-disclosure agreement, so the report calls it redacted.com.

how it looks From the original on medium.com

how it looks

The bug had two parts, and the second part only became possible because of the first. First, when you uploaded a file the site gave that file a number, called a file id. Second, the site had a button to remove a file again, in case you uploaded the wrong one. The removal request carried that file id, and the site never checked whether the person sending the removal request was the same person who uploaded the file. On top of that, the file ids were handed out in order: 310, 311, 312 and so on. So anyone could guess other people's file ids and delete their files.

That alone is bad, but the researcher went one step further. He wrote a small Python script that tried one file id after another, automatically, and deleted every file it could find. While the script ran, people using the site to share files found their files gone from the server, and they got an error message instead. That is a denial of service: the site still responds, but a feature people rely on stops working for them.

The interesting part for defenders is that none of this looked like an attack to a firewall. Every request was a normal, well-formed removal request that the site itself would send. The abuse was entirely in the order and the volume of the requests, which is a matter of application logic, not of strange-looking traffic.

Some words you will need

Before going further, a few ideas come up again and again. If you have never done any security work, read these once and come back when a term surprises you.

  • A web application is a program that runs on a server somewhere and that you use through your browser. The file sharing site is one.
  • An API (application programming interface) is the set of addresses and rules a web application offers so that a browser, or a script, can ask it to do things. A simple comparison: a restaurant menu. You do not walk into the kitchen; you pick an item from the menu, the kitchen prepares it and hands it back. The menu items are the API endpoints, and what comes back is the response.
  • A request is one message your browser sends to the server, for example "please upload this file" or "please remove file 310". A response is the server's answer to that request.
  • GET and POST are two kinds of request. A GET request is like asking a question ("show me this page"). A POST request is like handing something over ("here is my form, please process it"). Removing a file is done with a POST request, because it changes something on the server.
  • The request body is the part of a POST request that carries the data, for example the file id. Think of an envelope: the address on the outside is the URL, the letter inside is the body.
  • A parameter is one named piece of data in a request, such as file_id=310. It is a labelled slot with a value in it.
  • The Inspector is a panel built into every modern browser (usually opened with F12, or right-click then "Inspect"). It shows you the requests your browser made and the responses it got back. It is the easiest way to see what a website is really doing behind the page you see.
  • Sequential means numbered in order, one after another, with no gaps and no randomness: 310, 311, 312. The opposite would be a long random string that nobody can guess.
  • Brute force means trying many possibilities one by one until one works. If ids are sequential, brute forcing them is trivial: you just count upwards.
  • Access control is the part of an application that decides who is allowed to do what. "Only the person who uploaded this file may delete it" is an access control rule. When a feature has no access control, anyone can use it on anything.
  • IDOR (Insecure Direct Object Reference) is the name for exactly that mistake: the application lets you name an object directly (here, by its file id) and does not check that the object is yours. If changing a number in a request lets you touch someone else's data, that is an IDOR.
  • A denial of service (DoS) attack is an attack that stops legitimate users from using a service. The report quotes US-CERT: a denial-of-service condition is accomplished by flooding the targeted host or network with traffic until the target cannot respond or simply crashes, preventing access for legitimate users. The researcher adds his own working definition: if an attacker is able to stop users from using any functionality or feature inside the application after, or during, an attack, that should count as a denial of service. Notice that in this case nothing crashed. The feature simply stopped being usable.
  • A WAF (web application firewall) is a filter that sits in front of a website and inspects incoming requests, looking for known attack patterns such as obvious injection attempts. It is like a security guard at the door who checks people against a list of known troublemakers. A request that looks completely normal passes straight through, even if it is being sent for a bad reason.
  • Severity is a rough rating of how bad a bug is. The report rates the IDOR on its own as High and the chained denial of service as Critical.
  • Chaining means combining two or more bugs so that the result is worse than either one alone. That is the whole story here.

The feature, and the two things that matter about it

The site lets one user send files to another. You fill in the receiver's email, your own email, a mobile number that must be verified, and you attach the files. The report shows what the page looks like:

how it looks From the original on medium.com

how it looks

Two parts of this feature are relevant to the bug.

  1. Uploading returns an id. When you upload a file, the server's response contains a file id for that upload. The same id can also be seen in the browser's Inspector.
  2. There is a remove option. If you uploaded the wrong file, you can remove it from the server again.

Getting set up

The report does not describe any accounts, roles or special tools. The only things needed are a browser with its Inspector and a Python 3 script. The one precondition is that you upload a file yourself and read the current file id, either from the upload response or from the Inspector. You need a starting number so that the script knows where in the sequence to begin.

Finding the bug

When a file is uploaded, the response contains a file id, and the same id is visible in the Inspector.

Upload a file > get a file_id. From the original on medium.com

Upload a file > get a file_id.

Removing a file is done with a POST request that carries the file id in the request body. Two properties of that request stood out to the researcher:

  1. The file id is sequential. Ids are handed out in order, so they can be enumerated: try 310, then 311, then 312, and so on.
  2. There is no access control on removal. Any file id can be submitted, not only the ones that belong to the person making the request.

Put those two together and you have a classic IDOR. Anyone who knows your file id can remove your file, and because the ids are sequential, knowing one is not even necessary: you can simply guess.

If file was present then it shows success, otherwise fail. From the original on medium.com

If file was present then it shows success, otherwise fail.

The response tells the two cases apart. If the file was present, the removal succeeds; if not, it fails. That difference matters a lot later, because it gives a script a reliable signal to steer by. When a file id has been removed, the user simply gets an error message saying "Something went wrong, Please try again".

error message From the original on medium.com

error message

At this point the researcher had a working IDOR. The question he then asked himself was how to make it worse.

From IDOR to denial of service

A single IDOR lets you delete one file if you happen to know its id. That is bad, but limited. The researcher turned it into something much bigger by automating it: instead of deleting one object, the script walks through the id space and deletes everything it can find. The script is invoked like this:

Bash
python3 dos_poc.py <file_id>

Line by line, in plain words:

  • python3 is the command that runs the Python 3 interpreter, the program that reads and executes Python code.
  • dos_poc.py is the name of the script file. "PoC" stands for proof of concept, meaning a small program that demonstrates that a bug is real.
  • <file_id> is a placeholder for the number you supply. The angle brackets are not typed; they just show that a value goes there. So the real command looks like python3 dos_poc.py 310.

Step 1: get a starting id

Upload a file on the website and read the current file id from the Inspector. That value is passed to the script as its argument, for example:

Bash
python3 dos_poc.py 310

Here 310 is the file id of the file you just uploaded.

Step 2: build a range

The script creates a range starting at the supplied id; in the example, 310 produces the range 310 to 330. A range here simply means a list of consecutive numbers the script intends to try.

Step 3: send removal requests across the range

The script sends a POST request to remove each file id in the range, 310 to 330 in the example. The request is the same removal request the application itself issues, with the file id in the body. Nothing is crafted or obfuscated: it is the site's own request, repeated with different numbers.

Step 4: slide the range on success

If the script finds a success message in the response to any request, it increases its range automatically. If 310 was found successful in the response, the new range becomes 311 to 331, and the attack continues.

From the original on medium.com

Why does the range move only on success? Because a success means a file existed at that id and has now been deleted. The script is effectively following the files. As long as there are files to delete, it keeps finding successes, and the window keeps sliding forward through the id space.

Why it worked

The removal endpoint trusts the file id supplied in the POST body and performs no access control check on it, so any caller can remove any file. The ids are sequential, which makes the whole id space enumerable. Neither of these produces anomalous traffic: every request is a well-formed removal request that the application itself would issue, so a WAF has nothing to match on. As the researcher puts it, no WAF could have detected the attack because of its non-malicious behaviour. The abuse is entirely in the logic of the application.

A comparison may help. A guard checking bags for weapons will not stop a person who walks in through the front door, fills in the correct form and asks, politely and correctly, for other people's belongings. Every step is allowed by the rules; the rules themselves are the problem.

Impact

While the script runs, anyone trying to share files through the website is affected: their files are deleted from the server automatically and they are shown the error message "Something went wrong, Please try again later.". The researcher describes the IDOR as High severity and the chained denial of service as Critical.

The range only advances on a success response.

How it should be fixed

The report does not say what the vendor changed.

Things worth trying on other sites

If you want to look for something similar, these are the patterns the researcher's work suggests. Only ever test on systems you are authorised to test.

  1. Sequential object ids in any POST body. Upload an object, note its id, and submit removal or modification requests with neighbouring ids. A positive result is a success response for an id you do not own.
  2. Response-based oracles. Look for endpoints whose response differs between "object exists" and "object does not exist". A positive result is a reliable success/failure signal that a script can use to drive a range, as here. An oracle in this sense is simply any observable answer that tells you something you were not supposed to know.
  3. Automated range walking. Write a loop that starts from your own id and advances the window whenever a success is returned. A positive result is a run that keeps deleting other users' objects without ever tripping a WAF.
  4. Other state-changing actions on the same id. Test whether the same unprotected id also works for actions other than removal. A positive result is any action on another user's object that the application accepts.

What to take away

  • Always think about chaining vulnerabilities to increase the severity. Look for the highest impact you can honestly demonstrate.
  • Access control bugs become far more interesting when you chain them with something else. A single deletion is a bug; a script that deletes many files at once is a denial of service.
  • A request that looks normal to a firewall can still be an attack. Logic is where these bugs live.

Glossary

  • Access control: the part of an application that decides who may do what; when it is missing, anyone can act on anything.
  • API: the set of addresses and rules a web application offers so that a browser or script can ask it to do things.
  • Body (request body): the part of a POST request that carries the data being sent, such as a file id.
  • Brute force: trying many possibilities one by one until one works.
  • Chaining: combining two or more bugs so that the combined result is worse than either alone.
  • Critical: the highest severity rating used in the report, applied here to the chained denial of service.
  • Denial of service (DoS): an attack that stops legitimate users from using a service, whether by crashing it or by making a feature unusable.
  • Endpoint: one specific address in an application that accepts requests, for example the one that removes a file.
  • File id: the number the site assigns to an uploaded file and uses to refer to it later.
  • GET: a request type used to ask for something, such as a page.
  • High: a severity rating used in the report for the IDOR on its own.
  • IDOR (Insecure Direct Object Reference): a bug where an application lets you name an object directly and does not check that the object belongs to you.
  • Inspector: the panel in a browser that shows the requests made and the responses received.
  • Non-disclosure agreement (NDA): a contract that forbids naming or describing certain details publicly; the reason the company is called redacted.com here.
  • Oracle: any observable response that reveals information you were not meant to have, such as whether an object exists.
  • Parameter: one named piece of data in a request, such as file_id.
  • POST: a request type used to send data and change something on the server, such as removing a file.
  • Proof of concept (PoC): a small program that demonstrates a bug is real.
  • Python 3: a programming language, and the interpreter that runs it, used here to write the script.
  • Range: a list of consecutive numbers the script intends to try, for example 310 to 330.
  • Request: one message a browser or script sends to a server.
  • Response: the server's answer to a request.
  • Sequential: numbered in order with no gaps and no randomness, so the next value can be guessed.
  • Severity: a rough rating of how bad a bug is.
  • US-CERT: the organisation quoted in the report for its definition of a denial-of-service condition.
  • WAF (web application firewall): a filter in front of a website that inspects requests for known attack patterns.
  • Web application: a program that runs on a server and is used through a 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.