Broken Access Control & IDORS
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:
Prevention
The App should check the userβs identity and permissions before granting access to a resource. ( a MUST )
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 HowToHunt-IDOR
Found Encoded IDs?
Try to decode with different algos (base64url, base64, URL)
Use the Smart Decode tool in Burpβs decoder
Hashed IDs?
See if the ID is predictable
Try creating a few accounts to analyze how these IDs are created.
Offer the Application an ID, Even If It Doesnβt Ask for One
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
Pro tip: You can find parameter names to try by deleting or editing other objects and seeing the parameter names used.
Test for Blind IDOR
Change the Request Method: GET
example.com/uploads/user1236-01.jpeg
-> DELETEexample.com/uploads/user1236-01.jpeg
Change the Requested File Type: GET
/get_receipt?receipt_id=2983
-> GET/get_receipt?receipt_id=2983.json
Got 401/403/404?
Try to fuzz there for different IDs and Try Directory Busting
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:
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/
Burp intruder to iterate through IDs to find valid ones, The Burp extension Autorize scans for authorization issues by accessing higher-privileged accounts with lower-privileged accounts, whereas the Burp extensions Auto Repeater and AuthMatrix allow you to automate the process of switching out cookies, headers, and parameters.
Finding Your First IDOR!
Create two accounts for each application role and designate one as the attacker account and the other as the victim account
Pay attention to features that return sensitive information or modify user-data
Revisit the features you discovered in step 2. With a proxy, intercept your browser traffic while you browse through the sensitive functionalities.
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.
try a protection-bypass technique
Monitor for information leaks in export files, email, and text alerts. An IDOR now might lead to an info leak in the future.
Draft your first IDOR report
Reference
Last updated