Insecure direct object references (IDOR)
https://gitlab.com/jobertabma/vulnerable-code/-/tree/master/idor?ref_type=heads
Step 1: Understand the Vulnerability
The
index.phpscript takes anidparameter from the URL and uses it to query thesecretstable in the SQLite database. There is no authorization check to ensure that the user is allowed to view the secret corresponding to thatid.

Step 2: Create and Run the Bash Script
1.Create the Bash Script: Create a file named run_idor.sh and add the provided Bash script to it.
- Explanation of the Script:
echo $1 > _tmp/strip: This line writes the first argument passed to the script into a file namedstripin the_tmpdirectory.php -S 127.0.0.1:8080 -t idor &: This line starts a local PHP server on127.0.0.1(localhost) at port8080, serving files from theidordirectory, and runs it in the background.open 'http://127.0.0.1:8080/': This line opens the default web browser and navigates tohttp://127.0.0.1:8080/.wait: This line waits for the background process (the PHP server) to finish
2.Make the Script Executable: Change the script's permissions to make it executable.
3. Run the script:

4. press on your secret (#1) and modify the url to http://127.0.0.1:8080/?id=2

Expected Outcomes:
the page will display the secret corresponding to the provided id

Last updated