The Nen-Book
LinkedinTwitterMediumGithubHTB
  • Whoami
  • Walkthroughs & Writeups
    • My CTF Methodology
    • Hack The Box Machines
      • Administrator
      • Escape two
      • Cicada
      • HTB Permx Machine(CVE-2023–4220 Chamilo LMS)
    • Intigriti 1337Up 2024
      • Intigriti 1337Up 2024-CTF OSINT Challenges
      • Intigriti 1337Up Live 2024-CTF Web Challenges
    • CyCTF Quals 2024
      • OSINT Challenges CyCTF Quals 2024
      • Old Friend OSINT Challenge CyCTF 2024 Quals Writeup
    • PicoCTF
      • PicoCTF 2024 Web Exploitation Challenges
      • PicoCTF 2024 General Skills Challenges
      • PicoCTF 2021 Web Exploitation Challenges Walkthrough
      • PicoCTF 2019 Web Exploitation Challenges
  • Web_AppSec
    • Web_Recon
    • SQli
    • ATO
    • Backend_Technology_Tricks
    • XSS
    • SSRF
    • CSRF
    • XXE
    • SSTI
    • Insecure_Deserialization
    • Open_Redirects
    • Information_Disclosures
    • Rate_Limiting
    • Clickjacking
    • Broken Access Control & IDORS
    • Bash_Scripting
    • Authentication_Vulnerabilities
    • App_Logic_Errors
  • Network & AD Pentesting
    • Scanning & Enumeration
    • Active_Directory
      • AD_Overview_&_ Lab Build
      • AD_Initial_Attack_Vectors
      • AD_Post-Compromise_Enumeration
      • AD_Post-Compromise_Attacks
    • Buffer_Overflow_Attacks
    • Web_Applications
    • Privilege_Escalation
  • Cloud_Security
    • AWS Pentesting
  • APISec
    • API_Recon
    • Broken_Access_Control & Info_Leaks
  • Code_Review
    • Source_Code_Review_101
    • Code Review Tools
  • Bug_Hunting
    • Picking_A_BugBounty_Program
    • Writing_A_Good_Report
  • MITRE ATT&CK
    • Introducing the ATT&CK Framework
    • MITRE Engenuity
    • Threat-Informed Defense
Powered by GitBook
On this page
  • Testing for IDOR - ( Manual-Method ):
  • Basic Steps:
  • Prevention
  • Methodology and Testing Checklist
  • Bypassing IDOR Protection
  • Escalating the Attack
  • Automating the Attack
  • Finding Your First IDOR!
  • Reference

Was this helpful?

Edit on GitHub
  1. Web_AppSec

Broken Access Control & IDORS

PreviousClickjackingNextBash_Scripting

Last updated 8 months ago

Was this helpful?

IDORs happen when users can access resources that do not belong to them by directly referencing the object ID, object number, or filename. ==Remember that you can trigger IDORs from different locations within a request, like URL parameters, form fields, filepaths, headers, and cookies==

Testing for IDOR - ( Manual-Method ):

Basic Steps:

1. Create two accounts if possible or else enumerate users first. 
2. Check if the endpoint is private or public and does it contains any kind of id param.
3. Try changing the param value to some other user and see if does anything to their account.
4. Done !!

Prevention

  1. The App should check the user’s identity and permissions before granting access to a resource. ( a MUST )

  2. The website can use a unique, unpredictable key or a hashed identifier to reference each user’s resources.

Methodology and Testing Checklist

You can find a pretty good one here

Bypassing IDOR Protection

IDORs aren’t always as simple as switching out a numeric ID, the way they reference resources also often becomes more complex

Encoded IDs and Hashed IDs

  • Don’t ignore encoded and hashed IDs likely to be (base64url, base64, URL)

  • Use the Smart Decode tool in Burp’s decoder

If the application is using a hashed or randomized ID

  • See if the ID is predictable

  • try creating a few accounts to analyze how these IDs are created.

  • You might be able to find a pattern that will allow you to predict IDs belonging to other users.

Offer the Application an ID, Even If It Doesn’t Ask for One

  • If no IDs exist in the generated request, try adding one to the request

  • Append id, user_id, message_id, or other object references to the URL query, or the POST body parameters GET /api_v1/messages => GET /api_v1/messages?user_id=ANOTHER_USERS_ID

  • Try Parameter Pollution

Keep an Eye Out for Blind IDORs

sometimes endpoints susceptible to IDOR don’t respond with the leaked information directly. For example, imagine that this endpoint on example.com allows users to email themselves a copy of a receipt:

POST /get_receipt
(POST request body)
receipt_id=3001

this will send the receipt with id= 3001 info to the Email of the current user, if we tried a receipt belongs to another user like 2983

Change the Request Method

Applications often enable multiple request methods on the same endpoint but fail to implement the same access control for each method: GET example.com/uploads/user1236-01.jpeg-> DELETE example.com/uploads/user1236-01.jpeg

Change the Requested File Type

Applications might be flexible about how the user can identify information GET /get_receipt?receipt_id=2983 -> GET /get_receipt?receipt_id=2983.json

Escalating the Attack

  • The impact of an IDOR depends on the affected function

  • Read-based IDORs -> look for sensitive information in the application (direct messages, personal information, and private content)

  • Write-based IDORs-> (password reset, password change, and account recovery features, email subscription settings)

  • Write-based IDOR can be combined with self-XSS to form a stored XSS.

  • An IDOR on a password reset endpoint combined with username enumeration can lead to a mass account takeover.

  • Write IDOR on an admin account may even lead to RCE!

Automating the Attack

  • A very Good reference you can find here-> https://www.tevora.com/threat-blog/finding-broken-access-controls/

Finding Your First IDOR!

  1. Create two accounts for each application role and designate one as the attacker account and the other as the victim account

  2. Pay attention to features that return sensitive information or modify user-data

  3. Revisit the features you discovered in step 2. With a proxy, intercept your browser traffic while you browse through the sensitive functionalities.

  4. With a proxy, intercept each sensitive request and switch out the IDs that you see in the requests. If switching out IDs grants you access to other users’ information or lets you change their data, you might have found an IDOR.

  5. try a protection-bypass technique

  6. Monitor for information leaks in export files, email, and text alerts. An IDOR now might lead to an info leak in the future.

  7. Draft your first IDOR report

Reference

Burp intruder to iterate through IDs to find valid ones, The Burp extension scans for authorization issues by accessing higher-privileged accounts with lower-privileged accounts, whereas the Burp extensions and allow you to automate the process of switching out cookies, headers, and parameters.

HowToHunt-IDOR
Autorize
Auto Repeater
AuthMatrix
WSTG - v4.2
Everything You Need to Know About IDOR (Insecure Direct Object References)
Finding more IDORs - Tips and Tricks | Aon
OWASP Cheat Sheet-Preventing IDORS
Automating Finding IDORs