# IDOR

### \[#] IDOR Example : &#x20;

* `if you login to url` [`http://online-service.thm/profile?user_id=1305`](http://online-service.thm/profile?user_id=1305)`,  and change id=1000 , and now you can access the account of user 1000 . Then it is a IDOR vulnerability.`

## `1]` Finding IDORs in Encoded IDs :&#x20;

<figure><img src="https://2855293502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpZ0GSi6rFzKo8D8arzs%2Fuploads%2F2oiOTBG8bY1hmAfCA1a7%2Fimage.png?alt=media&#x26;token=15156a47-08ea-48c8-9f9f-68644323eaad" alt=""><figcaption></figcaption></figure>

* When data is passed through web , the raw data, query strings, or cookies are first encoded and then sent.&#x20;
* Encoding is mostly done in `BASE64` and For passing credentials and parameters `Hashing` also can be used.
* [https://crackstation.net/ ](https://crackstation.net/) For HASH Database matching.
* <https://www.base64decode.org/> For Base64 encoding & decoding .

## 2] **Unpredictable IDs  & Where are they located?**&#x20;

* The vulnerable endpoint you're targeting may not always be something you see in the address bar. It could be content your browser loads in via an AJAX request or something that you find referenced in a JavaScript file.  Can compare 2 account logged-in URL.

* For example, you may notice a call to **/user/details** displaying your user information (authenticated through your session). But through an attack known as parameter mining, you discover a parameter called user\_id that you can use to display other users' information, for example, **/user/details?user\_id=123**.

## 3] EXAMPLE :&#x20;

* Here i logged-in my account and gone to YOUR\_ACCOUNT tab , When YOUR\_ACCOUNT page opens we can see that my username , email are preloaded in this page.
* This means this page is getting this data from somewhere with my account id OR some other reference number are feeding into YOUR\_ACCOUNT page fields.![](https://2855293502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpZ0GSi6rFzKo8D8arzs%2Fuploads%2FtsmCAl0NUA7gUQRb5sY2%2Fimage.png?alt=media\&token=ac59ac04-20e2-47cf-a43b-c83c161bc4bf)
* When we go to NETWORK TAB in developer tools and refresh the page , we see HTTP REQUESTS  , one of which is `customer?id=15`    meaning id=15 data is being fetch for this page by webserver.

<figure><img src="https://2855293502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpZ0GSi6rFzKo8D8arzs%2Fuploads%2FbLUYFuc9fvCXMCz8smxB%2Fimage.png?alt=media&#x26;token=35fd570b-a39b-442a-abf7-0e2886677a48" alt=""><figcaption></figcaption></figure>

* Double clicking on it will take you to JSON panel ![](https://2855293502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpZ0GSi6rFzKo8D8arzs%2Fuploads%2FcDF2rQhRfsOWkp8xoouP%2Fimage.png?alt=media\&token=eefcd418-ba0f-4718-aa2e-d85619710695) .. Here we can tamper the URL -=>  ![](https://2855293502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpZ0GSi6rFzKo8D8arzs%2Fuploads%2FlcoB3vh0SE4K7FNPmPVm%2Fimage.png?alt=media\&token=9324fb6b-de0d-46c3-bccf-52e980b601e1)

## &#x20;
