---
description: Insecure Direct Object Reference
---

# IDOR

{% embed url="https://github.com/daffainfo/AllAboutBugBounty/blob/master/Insecure%20Direct%20Object%20References.md" %}

{% embed url="https://portswigger.net/web-security/access-control/idor" %}

### &#x20;                 What are insecure direct object references (IDOR)? <a href="#what-are-insecure-direct-object-references-idor" id="what-are-insecure-direct-object-references-idor"></a>

Insecure direct object references (IDOR) are a type of [access control](https://portswigger.net/web-security/access-control) vulnerability that arises when an application uses user-supplied input to access objects directly. The term IDOR was popularized by its appearance in the OWASP 2007 Top Ten. However, it is just one example of many access control implementation mistakes that can lead to [access controls](https://portswigger.net/web-security/access-control) being circumvented. IDOR vulnerabilities are most commonly associated with horizontal privilege escalation, but they can also arise in relation to vertical privilege escalation.

### &#x20;                                                    IDOR examples <a href="#idor-examples" id="idor-examples"></a>

There are many examples of access control vulnerabilities where user-controlled parameter values are used to access resources or functions directly.

#### &#x20;                        IDOR vulnerability with direct reference to database objects <a href="#idor-vulnerability-with-direct-reference-to-database-objects" id="idor-vulnerability-with-direct-reference-to-database-objects"></a>

Consider a website that uses the following URL to access the customer account page, by retrieving information from the back-end database:

```
https://insecure-website.com/customer_account?customer_number=132355
```

Here, the customer number is used directly as a record index in queries that are performed on the back-end database. If no other controls are in place, an attacker can simply modify the `customer_number` value, bypassing access controls to view the records of other customers. This is an example of an IDOR vulnerability leading to horizontal privilege escalation.

An attacker might be able to perform horizontal and vertical privilege escalation by altering the user to one with additional privileges while bypassing access controls. Other possibilities include exploiting password leakage or modifying parameters once the attacker has landed in the user's accounts page, for example.

#### &#x20;                                   IDOR vulnerability with direct reference to static files <a href="#idor-vulnerability-with-direct-reference-to-static-files" id="idor-vulnerability-with-direct-reference-to-static-files"></a>

IDOR vulnerabilities often arise when sensitive resources are located in static files on the server-side filesystem. For example, a website might save chat message transcripts to disk using an incrementing filename, and allow users to retrieve these by visiting a URL like the following:

```
https://insecure-website.com/static/12144.txt
```

In this situation, an attacker can simply modify the filename to retrieve a transcript created by another user and potentially obtain user credentials and other sensitive data.

&#x20;                             **Lab:** [**Insecure direct object references**](https://portswigger.net/web-security/access-control/idor)

{% embed url="https://portswigger.net/web-security/access-control/lab-insecure-direct-object-references" %}
