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

Sequential and Predictable Identifiers

Exploiting sequential IDs, numeric identifiers, and predictable patterns to access unauthorized objects.

Sequential and Predictable Identifiers

What you'll learn: How attackers exploit easy-to-guess ID patterns to access resources that don't belong to them.

The Core Problem

Many web applications assign identifiers to objects (users, orders, documents, invoices) using simple, predictable patterns—often just counting up: 1, 2, 3, 4.... While this seems convenient for developers, it creates a serious security vulnerability when combined with Insecure Direct Object References (IDOR).

If you legitimately access /api/invoice/1042 and the system doesn't properly verify authorization, an attacker can simply try /api/invoice/1043, /api/invoice/1044, and so on—systematically harvesting data that should be private.

Why Sequential IDs Are Dangerous

Think of it like hotel room keys numbered 101, 102, 103... If the hotel only checks that you have a room key (authentication) but not which room is yours (authorization), you could try every door in sequence.

Common predictable patterns:

  • Pure sequential: user_id=500, 501, 502...
  • Timestamp-based: 20240115001, 20240115002
  • Simple increments: Starting at 1000 and adding 1 each time
  • Hex sequential: 0x1a, 0x1b, 0x1c

Real-World Impact

An attacker discovering that invoice #12500 is accessible can:

  1. Iterate through 12499, 12498, 12497... (backward enumeration)
  2. Or probe 12501, 12502, 12503... (forward enumeration)
  3. Extract thousands of records in minutes with automated scripts

This leads to massive data breaches, privacy violations, and competitive intelligence theft—all because IDs were guessable and authorization checks were missing.

Key Takeaway: Never rely on ID secrecy for security. Always implement proper authorization checks, and prefer non-sequential identifiers (UUIDs, random tokens) for sensitive resources to add defense-in-depth against enumeration attacks.