Course contentsShow
← Security
Lesson 807 of 3,05217. Web Security - Authorization and Access ControlFree lesson

Direct Reference Manipulation

Modifying identifiers in URLs, parameters, or requests to access unauthorized resources without proper checks.

Direct Reference Manipulation

What you'll learn: How attackers exploit predictable identifiers in URLs and requests to access data they shouldn't see.

The Core Vulnerability

Direct Reference Manipulation (often called IDOR - Insecure Direct Object Reference) occurs when an application exposes internal identifiers—like database IDs, filenames, or user account numbers—directly in URLs or request parameters without properly verifying that the current user should have access to that specific resource.

How It Works

Imagine a banking app where your account page URL is:

https://bank.com/account?id=12345

If the application doesn't check whether you actually own account 12345, an attacker can simply change the URL to:

https://bank.com/account?id=12346

...and potentially view someone else's bank account. The identifier is directly referenced, predictable, and insufficiently protected.

Real-World Examples

This vulnerability appears everywhere:

  • Invoice downloads: /invoice.pdf?order=9001 → try 9002, 9003...
  • User profiles: /api/user/789/details → enumerate other user IDs
  • Document access: /files/document_456.pdf → guess adjacent document numbers
  • Message reading: /message?id=abc123 → swap identifiers

Why It's Dangerous

Unlike complex exploits, direct reference manipulation requires no technical skill—just changing a number in a URL. Yet it can expose sensitive data at scale through automated enumeration of all possible identifiers.

The fix requires proper authorization checks: verify not just that the user is authenticated, but that they're authorized to access this specific resource before retrieving it.

Key Takeaway: Always validate that the authenticated user has permission to access the specific resource identified by IDs in URLs or parameters—never trust client-supplied identifiers alone.