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

IDOR in REST APIs and GraphQL

Identifying object-level access vulnerabilities in API endpoints and GraphQL queries.

IDOR in REST APIs and GraphQL

What you'll learn: How object-level access vulnerabilities manifest differently in REST APIs versus GraphQL queries, and why API architectures require special attention to authorization checks.

Why APIs Are IDOR Hotspots

Modern applications expose data through APIs, and both REST and GraphQL architectures are particularly vulnerable to Insecure Direct Object Reference (IDOR) attacks if authorization isn't enforced at every data access point.

REST API IDOR Patterns

REST APIs use predictable endpoint structures that often expose identifiers directly:

  • GET /api/users/123/profile — Change 123 to 124, and you might see someone else's profile
  • PUT /api/orders/5678 — Modify or cancel another user's order
  • DELETE /api/documents/abc123 — Delete files you shouldn't access

The HTTP method doesn't protect you—attackers will try GET, POST, PUT, PATCH, and DELETE on any discovered identifier.

GraphQL's Unique Challenge

GraphQL introduces a different attack surface. Since clients specify exactly what data they want, a single query can expose multiple IDOR vulnerabilities:

query {
  user(id: "456") {
    email
    orders {
      total
      creditCardLast4
    }
  }
}

An attacker can modify the id parameter to access unauthorized user data. GraphQL's flexibility means one misconfigured resolver can leak sensitive information across nested relationships—checking authorization only at the top level isn't enough.

The Core Problem

Both architectures fail when developers assume authentication equals authorization. Just because a user is logged in doesn't mean they should access object X. Every API endpoint and every GraphQL resolver must verify: "Does this user have permission to access this specific resource?"

Key Takeaway: API IDOR vulnerabilities arise when authorization checks aren't enforced at the object level in every REST endpoint and GraphQL resolver—authentication alone never grants data access rights.