Insecure Direct Object References (IDOR)

Insecure Direct Object References (IDOR)

IDOR occurs when an application provides direct access to an object using a user input. IDOR allows attackers to bypass authorization mechanisms to access information/resources directly by manipulating the value of a parameter used to point to that resource/object.

Attackers can use IDOR to access resources of another user (Files, PII, etc.) or functionality/privileges of another user (Admin, Moderator, etc.).

This vulnerability is caused by the fact that the application does not validate the user input and uses it to retrieve an object/resource without performing sufficient authorization checks.

Impact

  • Unauthorized access of resources.

    • Viewing sensitive user information

    • Viewing files that are private to the user

    • Downloading invoices from another user

  • Unauthorized data manipulation.

    • This is not just limited to user data, it can also include other objects such as:

      • Videos in a video streaming site. Manipulating the video thumbnail.

  • Data leaks.

  • Confidentiality breach (user PII, invoices, private documents)

  • Privilege escalation (gaining admin-level access)

  • Account takeover (resetting passwords for other users)

Test Objectives

  • Identify points where object references may occur.

  • Assess the access control measures and if they’re vulnerable to IDOR.

Enumeration

How to Test for IDOR

Best Practice for Testing

  • Create at least two or more user account that contains different objects and functions.

  • Example:

    • Each users has different account information, purchase information, private message, etc.

    • Users with different privileges (Admin, User, Moderator, etc.)

Examples

  • The Value of a Parameter Is Used Directly to Retrieve a Database Record

    • http://foo.bar/somepage?invoice=12345

  • The Value of a Parameter Is Used Directly to Perform an Operation in the System

    • http://foo.bar/changepassword?user=someuser

  • The Value of a Parameter Is Used Directly to Retrieve a File System Resource

    • http://foo.bar/showImage?img=img00011

  • The Value of a Parameter Is Used Directly to Access Application Functionality

    • http://foo.bar/accessPage?menuitem=12

Bypasses

If you get an error accessing another data you can try the following:

Broken Acccess Controls

  • Unprotected functionality

    • Can you access endpoints that should only be accessed by admins?

  • Parameter-based access control methods

    • Can you access objects/resources from other users by changing the value of a parameter?

  • Broken access control resulting from platform misconfiguration

    • Can you access restricted resources by changing/adding headers?

      • Change HTTP Methods (POST → GET)

      • Add headers: X-Original-URL / X-Rewrite-URL

  • Broken access control resulting from URL-matching discrepancies

    • Can you access restricted resources by changing the URL format/capitalization.

      • /admin/deleteUser/ADMIN/DELETEUSER

      • /admin/deleteUser/admin/deleteUser.anything

      • /admin/deleteUser/admin/deleteUser/

  • Horizontal to Vertical privesc

    • Try to access a user with admin privileges

  • Access control vulnerabilities in multi-step processes

    • Look for functions that requires multi-step process

      • Forms that that allows you to review/confirm changes. You might be able to access the functionality of that endpoint on the review page.

  • Referer-based access control

    • Some sub-pages are restricted and can only be access if the referer header contains the parent page.

    • Change/add the Referer header with the value of the parent page of the restricted sub-pages to access those pages and functionality.

      GET /admin-roles?username=wiener&action=upgrade HTTP/1.1
      Host: acme.net
      Referer: <https://acme.net/admin>
      Cookie: session=User0001
  • Location-based access control

References / Resources:

Last updated