> For the complete documentation index, see [llms.txt](https://ganesha-hk.gitbook.io/cybersecurity-writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ganesha-hk.gitbook.io/cybersecurity-writeups/port-swigger-access-control-labs/lab-6.md).

# lab-6

## User ID Controlled by Request Parameter

**Difficulty:** Apprentice

### Lab Description

This lab has a horizontal privilege escalation vulnerability on the user account page. The application uses a user-controlled URL parameter to determine which account to display, and does not validate the session against it.

**Objective:** Obtain the API key for the user `carlos` and submit it as the solution.

**Credentials:** `wiener:peter`

### Solution

**Step 1 — Identify the vulnerable parameter**

Log in as `wiener:peter` and capture the requests in Burp. Navigate to the account page and observe the URL:

```
GET /my-account?id=wiener
```

The application uses the `id` parameter to determine which account to load. Send this request to Repeater.

**Step 2 — Confirm the session is not validated**

In Repeater, remove the session cookie entirely and send the request. The server still returns `wiener`'s account page — confirming the back-end does not check whether the authenticated session matches the requested `id` value.

**Step 3 — Access carlos's account**

Change the parameter to `id=carlos` and send:

```
GET /my-account?id=carlos
```

A `200` response returns Carlos's account page, including his API key. Copy the key and submit it to complete the lab.

### Conclusion

The application relied entirely on a user-supplied parameter to decide which account to display, with no server-side check that the session belonged to the requested user. This is a textbook example of **horizontal privilege escalation** — an attacker can access any other user's data simply by changing a parameter value.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ganesha-hk.gitbook.io/cybersecurity-writeups/port-swigger-access-control-labs/lab-6.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
