OWASP WSTG: Part 6 - Authorization
WSTG v4.2 section 4.5 explained: directory traversal and file include, bypassing authorization schema, privilege escalation and insecure direct object references (IDOR), with test steps and fixes.
Authentication proved who you are. Authorization decides what you are allowed to do, and it is where some of the most common and most serious web vulnerabilities live. “Broken Access Control” is number 1 in the OWASP Top 10 2021.
Authorization testing (WSTG section 4.5, IDs WSTG-ATHZ-*) has only four tests, but they cover an enormous attack surface: reading files you should not reach (path traversal), doing things another role should do (authorization bypass), becoming a more powerful user (privilege escalation), and accessing other users’ data by changing an ID (IDOR).
Source: WSTG v4.2 §4.5 Authorization Testing (CC BY-SA 4.0), explained and expanded. Only test systems you are authorised to test, and never read or modify real users’ data without explicit permission.
Key Takeaways
- Authorization must be enforced on the server, for every request, not hidden in the UI.
- Horizontal access = another user’s data at your level. Vertical access = a higher privilege level. Test both.
- IDOR is everywhere: any ID in a URL, body, header or cookie is a candidate.
- The best test is comparison: capture a request as a privileged user, replay it as a low-privileged one, and check what happens.
- Fix centrally: one access-control layer that denies by default, checked on every object and every action.
Two Directions of Broken Access Control
flowchart TD
subgraph Vertical["Vertical (privilege escalation)"]
U1["Normal user"] -.->|"reach admin functions"| A1["Admin actions"]
end
subgraph Horizontal["Horizontal (same level)"]
U2["User A"] -.->|"change id=A to id=B"| D2["User B's data"]
end
Both["Test every request as every role:<br/>capture privileged -> replay as low-privileged"]
WSTG-ATHZ-01: Directory Traversal / File Include
What it checks: whether user input is used to build file paths, letting an attacker read or write files outside the intended directory (../../../../etc/passwd), or include remote/local files that get executed.
How to test:
- Find the input vectors: any parameter that looks like it names a file, template, page, language, or download:
?file=,?page=,?template=,?lang=,?download=, path segments, and even cookies.
1
2
https://example.com/getUserProfile.jsp?item=ads.txt
https://example.com/?page=home ?page=../../../../etc/passwd
- Try traversal payloads and their encodings (web servers and frameworks decode differently):
1
2
3
4
5
6
../../../../etc/passwd
..%2f..%2f..%2f..%2fetc%2fpasswd (URL-encoded)
..%252f..%252f etc... (double-encoded)
....//....//....//etc/passwd (filter bypass)
..%c0%af..%c0%af etc... (overlong UTF-8)
/etc/passwd%00.png (null byte, older stacks)
On Windows, target ..\..\..\..\windows\win.ini.
- Local / Remote File Inclusion: if the included file is executed, LFI can read source or logs (and reach RCE via log poisoning or PHP wrappers like
php://filter), and RFI can pull in an attacker-hosted script. (Input-side detail is in Part 8.)
1
2
3
4
# Fuzz a parameter with a traversal list
ffuf -u 'https://example.com/?page=FUZZ' -w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt -mr 'root:.*:0:0'
# Or the dedicated traversal fuzzer
dotdotpwn -m http -h example.com -f /etc/passwd
What a finding looks like: ?item=../../../../etc/passwd returning the password file, or ?page=../../../../var/log/apache2/access.log returning the log (then executed).
Fix: avoid passing file names from users; if unavoidable, map input to an allow-list of known files (an index, not a path), canonicalise and verify the resolved path stays inside the base directory, and run with least file-system privilege.
WSTG-ATHZ-02: Bypassing the Authorization Schema
What it checks: whether a user can access functions or resources reserved for another role, in two directions:
- Horizontal: a user reaches another user’s resources at the same privilege level.
- Vertical: a lower-privileged user reaches higher-privilege functions (a customer reaching admin pages).
How to test (the comparison method):
- Log the full set of requests while using a high-privileged account (admin): every admin page and action.
- Repeat each request with a low-privileged session cookie (or none at all), changing nothing else.
- Compare: if the low-privileged user gets the same
200and the same data, authorization is broken.
1
2
POST /account/viewSettings HTTP/1.1
Cookie: SESSION=<low-privileged-user> <- but requesting an admin-only action
Also test:
- Direct access to admin URLs while logged in as a normal user (
/admin/,/admin/users,/api/admin/...). - Resources of another role: does the “manager report” load with an employee session?
- Static/exported files (PDF reports, exports) served without an access check.
Tools: Burp Autorize and AuthMatrix, ZAP Access Control Testing: configure the sessions once and they flag every request that a lower role should not have been able to make.
Fix: deny by default; check authorization on the server for every function and every object; never rely on the UI hiding a link or on knowing a URL.
WSTG-ATHZ-03: Privilege Escalation
What it checks: whether a user can raise their own privileges or role, turning a normal account into a powerful one.
How to test the common manipulation points:
- Role / privilege values in requests, responses, cookies or tokens:
1
2
3
4
POST /user/updateProfile HTTP/1.1
userId=1337&role=user -> role=admin
groupId=100 -> groupId=1 (admin group)
- User profile / group: changing
group,team,departmentortierto a more privileged value. - Condition values: flags like
approved=false,verified=0,can_refund=false. - IP / header trust: functions gated by
X-Forwarded-Foror an “internal” header the client can set:
1
2
X-Forwarded-For: 127.0.0.1
X-Original-URL: /admin
- Weak session IDs / tokens: JWTs where the
roleclaim is unsigned or the signature is not verified (alg:none), or predictable tokens for a privileged user. - URL traversal between resources:
/user/1337/orders→/user/1/orders.
What a finding looks like: editing your own profile request to include "role":"admin" and the server accepting it (a mass-assignment privilege escalation).
Fix: derive privileges server-side from the authenticated session, never from client-supplied fields; bind only allow-listed attributes on updates; verify token signatures; do not trust client-settable headers for access decisions.
WSTG-ATHZ-04: Insecure Direct Object References (IDOR)
What it checks: whether changing an identifier that points to an object (a database row, a file, an account) lets you reach objects you do not own, because the application fetches by the ID without checking that you are allowed to.
IDOR is so common it has its own name in API security: BOLA (Broken Object Level Authorization), the top risk in the OWASP API Security Top 10.
Where IDs appear:
| The ID is used to… | Example |
|---|---|
| Retrieve a database record | /account?invoice=12345 → try 12344, 12346 |
| Perform an operation | /transfer?from=111&to=222&amount=50 → change from |
| Retrieve a file | /download?file=report_900.pdf → try report_899.pdf |
| Access a static resource | /images/users/1337/avatar.png → /images/users/1/... |
How to test:
- Create two accounts (A and B). As A, note every request that references an object you own (an order, a message, a file, a profile).
- Replace the identifier with B’s value (keep A’s session), and see whether you get B’s data or can act on B’s objects.
- Try: incrementing/decrementing numeric IDs; swapping UUIDs captured from B; adding an
idparameter where there was none; changing the ID in JSON bodies, headers, or the second step of a multi-step flow.
1
2
3
# Walk a numeric range as the same user; different responses = IDOR candidates
ffuf -u 'https://example.com/api/invoices/FUZZ' -H 'Authorization: Bearer <userA>' \
-w <(seq 12300 12400) -mc 200 -ac
Handle real data carefully. On authorised engagements, prove the issue with the minimum access (a single record, redacted in the report) and never download or alter other users’ data beyond what proves the finding. See evidence-hygiene practices before taking screenshots.
Guessable vs unguessable IDs: unpredictable IDs (random UUIDs) make IDOR harder to find but do not fix it: a leaked or shared UUID still works if there is no access check. The fix is always the check, not the obscurity.
Fix: enforce object-level authorization on every access (“does the current user own, or may act on, object X?”), ideally in a central layer; map external references to the session where possible (e.g. “my latest invoice” instead of a raw ID); and log access-control failures.
Worked Example: An IDOR and Its Fix (ATHZ-04 / BOLA)
IDOR is almost always a missing ownership check: the handler fetches the object by the ID in the request and returns it, trusting that the user would only ask for their own.
Vulnerable (Node/Express) — fetches by id, never checks who owns it:
1
2
3
4
app.get('/api/invoices/:id', requireLogin, async (req, res) => {
const invoice = await db.invoices.findById(req.params.id); // any id works
res.json(invoice);
});
Exploit — authenticated as user A, walk the ID space to read everyone’s invoices:
1
2
3
4
5
6
7
# A's own invoice is 10231; try the neighbours with A's valid session
for id in 10229 10230 10231 10232 10233; do
printf '%-6s ' "$id"
curl -s https://example.com/api/invoices/$id -H "Authorization: Bearer $A_TOKEN" \
| jq -c '{id, customer, total}'
done
# 10230 {"id":10230,"customer":"Bravo Ltd","total":4200} <- not A's
Automate the sweep and keep only the successful reads:
1
2
3
ffuf -u 'https://example.com/api/invoices/FUZZ' \
-H "Authorization: Bearer $A_TOKEN" \
-w <(seq 10000 10999) -mc 200 -ac -o idor.json
Fixed — scope the query to the authenticated user, so the database itself enforces ownership:
1
2
3
4
5
6
7
8
9
app.get('/api/invoices/:id', requireLogin, async (req, res) => {
// ownerId comes from the verified session, never from the request
const invoice = await db.invoices.findOne({
_id: req.params.id,
ownerId: req.user.id, // the authorization check
});
if (!invoice) return res.sendStatus(404); // 404, not 403: don't confirm it exists
res.json(invoice);
});
The most robust version centralises this so every data access goes through one authorization layer (a policy/guard), rather than relying on each route to remember the check. Unguessable IDs (UUIDs) are not a fix: a leaked or shared UUID still works without the ownership check.
Real-world case. Broken access control is #1 in the OWASP Top 10 (2021), and IDOR/BOLA is the #1 API risk. It is consistently the single most-reported and highest-paid bug class on HackerOne and Bugcrowd, exactly because the pattern above is so easy to write and so easy to miss.
Hands-on Practice
- PortSwigger Academy — the Access control labs cover IDOR, horizontal/vertical bypass and privilege escalation end to end.
- Juice Shop — “View another user’s shopping basket”, “Access the administration section”, and the “Forged” challenges.
- Burp Autorize / AuthMatrix — configure two sessions and let them flag every request a lower role should not have been able to make.
Checklist: Authorization
| ID | Test | Main tools |
|---|---|---|
| WSTG-ATHZ-01 | Directory traversal / file include | ffuf, dotdotpwn, Burp, encodings |
| WSTG-ATHZ-02 | Bypassing authorization schema | Burp Autorize / AuthMatrix, ZAP Access Control |
| WSTG-ATHZ-03 | Privilege escalation | Burp Repeater, jwt_tool, header/param tampering |
| WSTG-ATHZ-04 | Insecure direct object references (IDOR / BOLA) | Burp, ffuf, two test accounts |
Previous: Part 5 - Authentication · Next: Part 7 - Session Management
References
- WSTG-ATHZ-01 Directory Traversal File Include
- WSTG-ATHZ-02 Bypassing Authorization Schema
- WSTG-ATHZ-03 Privilege Escalation
- WSTG-ATHZ-04 Insecure Direct Object References
- OWASP Authorization Cheat Sheet
- OWASP API Security Top 10: BOLA
Further reading
- OWASP Top 10 2021 — A01 Broken Access Control.
- PortSwigger: Access control & IDOR.
- OWASP IDOR Prevention Cheat Sheet.
- Burp Autorize · AuthMatrix — automated authorization testing.
Comments
Questions, corrections or another approach? Comment with your GitHub account.