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

Horizontal vs Vertical Privilege Escalation

Distinguishing between accessing peer user data (horizontal) and gaining admin rights (vertical) privilege escalation.

Horizontal vs Vertical Privilege Escalation

What you'll learn: You'll understand the two distinct types of privilege escalation attacks and how they differ in scope and impact.

When access controls break down, attackers can escalate their privileges in two fundamentally different directions. Understanding this distinction helps you recognize and defend against both attack patterns.

The Two Directions of Escalation

Horizontal privilege escalation occurs when an attacker gains access to resources belonging to other users at the same privilege level. Think of it like breaking into your neighbor's apartment on the same floor—you're both residents with equal rights, but you shouldn't be able to access their stuff.

For example, if user Alice (ID: 123) can view user Bob's (ID: 124) bank account by simply changing userId=123 to userId=124 in the URL, that's horizontal escalation. The attacker remains at the "regular user" level but accesses peer data they shouldn't see.

Vertical privilege escalation happens when an attacker elevates themselves to a higher privilege level, typically gaining administrator or elevated rights. This is like a building resident somehow gaining access to the building manager's master key. You've moved "up" in the authorization hierarchy.

For instance, if a regular user discovers they can access /admin/users without proper checks and can now delete any account, they've achieved vertical escalation.

Why the Distinction Matters

Vertical escalation is typically considered more severe because it grants broad system-wide control. Horizontal escalation, while still critical, usually affects individual users rather than entire systems. However, both violate the principle of least privilege and represent broken access control.

In practice, many vulnerabilities can enable both types—an Insecure Direct Object Reference (IDOR) might let you access peer accounts and admin accounts depending on what ID you manipulate.

Key Takeaway: Horizontal escalation means accessing peer-level data you shouldn't see; vertical escalation means gaining higher-level permissions like admin rights. Both are serious broken access control vulnerabilities requiring different testing approaches.