Security operations

Horizontal Privilege Escalation: What It Is and How to Stop It

Horizontal privilege escalation lets one user reach another user's data without becoming an admin. Here is how it works and how to stop it.

Cysoro Security TeamPublished · 8 min read
AUser AOrder 4512✓ BUser BOrder 4513 — private✕ ID changed SECURITY OPERATIONS Horizontalescalation Sideways, not upward.
Quick answer

Horizontal privilege escalation is when an authenticated user accesses data or actions belonging to another user at the same privilege level, usually by changing an ID in a URL or request. The attacker does not become an admin. They move sideways, reading or changing another customer's orders, invoices, messages or account details because the application never checks ownership on the server.

Key takeaways

  • Horizontal privilege escalation moves sideways, not upward: one ordinary user reaches another ordinary user's data.
  • It is usually caused by missing server-side ownership checks, often through insecure direct object references (IDOR).
  • The fix is to check the user, the resource and the action on every request, and to test that check with two accounts.

You log in to your own account, change one number in the web address, and suddenly you are looking at another customer's invoice. You did not hack an admin account. You did not break encryption. The application simply never asked whether that record belonged to you.

What is horizontal privilege escalation?

Horizontal privilege escalation is when an authenticated user accesses data or performs actions belonging to another user at the same privilege level. The attacker stays at their own level but moves sideways across accounts.

Imagine two customers, A and B, with identical accounts. Customer A changes an order ID from 4512 to 4513 and sees customer B's order, address and payment details. That is the flaw in one sentence.

It is a form of broken access control. OWASP ranked broken access control first in its Top 10 2021 list, after it moved up from fifth place. The category covers any case where a user acts outside their intended permissions.

The damage is easy to underestimate because no admin account is involved. Yet one sideways step can expose thousands of records if the attacker repeats the request with different IDs.

What is the difference between horizontal and vertical privilege escalation?

Horizontal escalation changes scope at the same level: one user reaches another user's data. Vertical escalation changes level: a normal user gains admin powers, such as managing users or changing system settings.

Horizontal privilege escalationVertical privilege escalation
DirectionSideways, same levelUpward, to a higher level
Attacker starts asOrdinary userOrdinary user
Attacker ends asStill an ordinary user, with someone else's dataAdmin, manager or system user
Typical exampleReading another customer's invoice by changing its IDCalling an admin endpoint to promote an account
Common causeMissing ownership check on an objectMissing role check on a function
Common nameIDOR, broken object level authorizationMissing function level authorization

Both flaws often live in the same application. A team that fixes only the admin endpoints can still leak every customer's data through a single unguarded record lookup.

In MITRE ATT&CK, privilege escalation is tactic TA0004. Horizontal cases in web applications usually map to broken access control rather than to operating-system privilege techniques.

How does horizontal privilege escalation work?

It works because the application trusts the ID in the request instead of checking who owns the record. Authentication proves who you are, but authorization must decide what you may touch.

How one changed number exposes another account User A logs inown account, order 4512normal access works User A edits the ID/orders/4512 becomes/orders/4513 Server returns itorder 4513 belongs touser B — no check ran The fix: check owner ID = logged-in user ID before returning anythingReturn 403 or 404 when the owner does not match — never the other user's record.
Changing an ID in a request only works when the server skips the ownership check. Illustration by Cysoro.

A typical attack has four steps. First, the attacker logs in with a real account, which may be their own or a free trial account. Second, they watch the requests the application makes for their own data.

Third, they change an identifier in the URL, a form field, a cookie or an API request. Common targets are user IDs, order numbers, document IDs, invoice numbers and file names.

Fourth, the server returns the other user's record because it looked up the ID and never compared the record's owner with the logged-in user. The attacker can then repeat the request, counting up or down, to collect many records.

Hiding the ID is not a fixIf the check is missing, an attacker can still guess IDs, find them in emails, or enumerate them one by one. Random IDs slow an attacker down, but only a server-side ownership check stops the attack.

What are common examples of horizontal privilege escalation?

The pattern shows up wherever one user has records that look like another user's records. The examples below are the ones testers find most often.

Viewing another customer's invoice or order

A customer changes an invoice number in a download link and receives another customer's invoice, including name, address and items bought. This is the classic IDOR case in shops and billing portals.

Editing another user's profile

A user changes a profile ID in an update form and edits someone else's name, email or password. If the email can be changed, the attacker may then take over the other account through a password reset.

Downloading another user's document

A document link contains a predictable file ID. Changing it downloads another user's contract, medical letter, payslip or tax form. Shared file links need the same ownership check as any other record.

Reading another user's messages

A messaging or support-ticket page loads messages by conversation ID. Without a check, one user can read another user's private messages or support history by changing that ID.

Cross-tenant access in multi-tenant apps

In software used by many companies, one tenant's admin changes a tenant ID and sees another company's users, reports or settings. This is horizontal escalation at company scale, and it is often the most serious version.

Why does horizontal privilege escalation happen so often?

It happens because authorization is easy to forget in one place. A team may secure the login page and the admin area, then add a new feature that fetches a record by ID and never adds the ownership check.

Several habits make it worse. Developers sometimes check access in the user interface only, hiding a button instead of enforcing the rule on the server. Anyone can call the underlying request directly.

Other causes include trusting IDs sent by the client, reusing one generic lookup function for every record type, and adding new API endpoints without an authorization review. Fast-moving teams also copy a working endpoint and change the resource without copying its check.

Testing gaps play a part too. If every test uses one account, no test ever tries to open another user's record. That is why the OWASP authorization regression guidance recommends testing with at least two accounts in the same role.

How do you find horizontal privilege escalation in your own app?

Test with two accounts. Create user A and user B with the same role, give each one a record, then try to open B's record while logged in as A. A correct application returns 403 Forbidden or 404 Not Found, never the record.

Repeat that test for every read, update and delete operation, not just for viewing pages. An application that blocks viewing but allows editing through an API call is still vulnerable.

Map every place an ID enters the application: URLs, query strings, form fields, JSON bodies, cookies and file names. For each one, ask which user should own the object and where the server enforces that rule.

Automate the check. The OWASP authorization regression testing cheat sheet describes a multi-user replay pattern: authenticate as A, create a resource, then authenticate as B and try to read, update and delete it.

Two-account test: the fastest way to find it 1. Create A and BSame role, different accounts.Each creates one record. 2. Swap the IDsAs A, request B's record IDin the URL, form or API call. 3. Try read, edit, deleteTest all three actions, notjust viewing the page. 4. Expect 403 or 404A 200 with B's data is a fail.Log it and fix the check.
Run this two-account test on every endpoint that takes an ID. Illustration by Cysoro.

Penetration tests and bug bounty programs find these flaws often because they are simple to test. If your team has never run the two-account test, assume the flaw may be present until the test proves otherwise.

How do you prevent horizontal privilege escalation?

Enforce ownership on the server, on every request, for every resource. That single rule, applied consistently, stops the whole class of attacks.

  • Check the triple: who is logged in, which resource was requested, and what action they want. Allow it only when all three match your policy.
  • Take the user ID from the session, never from a form field or URL parameter the user can edit.
  • Deny by default. If no rule explicitly allows the access, refuse it.
  • Use indirect references where you can, such as random or per-user IDs, so IDs are harder to guess. Treat this as defense in depth, not as the fix.
  • Centralize the check in one authorization layer or middleware, so a new endpoint cannot accidentally skip it.
  • Log denied attempts and alert on repeated attempts to open other users' records.
  • Test on every release with the two-account pattern, including API endpoints and file downloads.

For APIs, OWASP lists broken object level authorization first in its API Security Top 10. The same rule applies: every object-level request must check that the caller owns the object or has a role that allows access to it.

Code review helps too. When you review a change, look for any database lookup by ID and ask where the ownership check is. If you cannot find it in the same function, the endpoint is suspect.

For a wider review of your web application's defenses, run our free security headers checker alongside your authorization tests. It does not test authorization, but it catches the header gaps that often sit next to it.

Check your certificate too with our free SSL checker, which confirms your site serves HTTPS correctly and flags certificate problems.

What mistakes keep this flaw alive?

The most common mistake is checking access only in the interface. Hiding a link or button does not stop a direct request, and attackers routinely call endpoints the interface never shows.

Another mistake is trusting the client. If the request says userId=4513, that value is attacker-controlled. The server must derive the user from its own session data.

Teams also forget secondary actions. They protect the main record page but leave the export, download, delete or share endpoint unguarded. Attackers look for those forgotten endpoints first.

Finally, some teams return different errors that leak information. A 404 for missing records and a 403 for forbidden ones is fine, but a message that confirms a record exists can help an attacker enumerate IDs. Keep error responses consistent where the record's existence is itself sensitive.

If you run a small business, add this test to your small business cybersecurity checklist routine: two accounts, one record each, and a deliberate attempt to cross the line.

The bottom line

Horizontal privilege escalation is simple, common and preventable. One user changes an ID, the server trusts it, and another user's data comes back. No admin account is needed, and no advanced skill is required.

Fix it by checking ownership on the server for every request, testing with two accounts on every release, and denying access by default. Start by listing every endpoint that takes an ID, then check each one with our free security headers checker as part of a broader review of your site's defenses.

Frequently asked questions

What is horizontal privilege escalation in simple terms?

It is when you log in as a normal user and can see or change another normal user's data. You do not gain admin powers. You simply cross a boundary that should separate one user's records from another's, often by changing a number in a web address.

What is the difference between horizontal and vertical privilege escalation?

Horizontal escalation stays at the same level: user A reaches user B's data. Vertical escalation moves upward: a normal user gains admin or higher-level powers, such as deleting users or changing system settings. Both are broken access control, but they need different tests.

What is an IDOR vulnerability?

IDOR stands for insecure direct object reference. It happens when an application uses a predictable ID, such as an order number or user ID, and does not check whether the logged-in user owns that object. Changing the ID in the request then returns someone else's data.

Is horizontal privilege escalation the same as broken access control?

It is one form of broken access control. Broken access control is the wider OWASP category, ranked first in the OWASP Top 10 2021. Horizontal escalation is the sideways form of it, while vertical escalation and missing function-level checks are other forms.

How do attackers find horizontal privilege escalation flaws?

They log in with their own account, watch the requests their browser makes, and change IDs, filenames or account numbers to values that belong to other users. Automated scanners and manual testing with two accounts also find these flaws quickly.

Can horizontal privilege escalation happen in APIs?

Yes, and APIs are a common place for it. OWASP lists broken object level authorization as the top API security risk. An API that returns any record by ID without checking ownership exposes every user's data to any authenticated caller.

How do you fix horizontal privilege escalation?

Check ownership on the server for every read, write and delete, using the logged-in user's ID from the session, not from the request. Use indirect or random IDs where you can, deny access by default, log denied attempts, and add automated tests that try to access another user's data.

Does multi-factor authentication stop horizontal privilege escalation?

No. Multi-factor authentication proves who you are, but it does not limit what you can reach once you are logged in. An attacker with a valid account and MFA can still exploit a missing ownership check, so authorization must be enforced separately.

Sources

  1. OWASP — Top 10 2021: A01 Broken Access Control
  2. OWASP Cheat Sheet Series — Authorization Regression Testing
  3. OWASP API Security Top 10 — Broken Object Level Authorization
  4. MITRE ATT&CK — Privilege Escalation (TA0004)
  5. Packetlabs — Broken Access Control: #1 on OWASP Top 10 List
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against OWASP Top 10 A01 Broken Access Control, the OWASP authorization testing cheat sheets and MITRE ATT&CK TA0004.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free