> 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-ssrf-lab/lab-2.md).

# lab-2

## Basic SSRF Against Another Back-End System

**Difficulty:** Apprentice

### Lab Description

This lab has a stock check feature which fetches data from an internal system.

**Objective:** Use the stock check functionality to scan the internal `192.168.0.X` range for an admin interface on port 8080, then use it to delete the user `carlos`.

### Root Cause

Some application servers have permission to make requests to other internal application servers to retrieve data. Developers sometimes allow these servers to access sensitive panels — such as admin or IT support interfaces — without any authentication, on the assumption that they are not reachable from outside the network. In such cases, an attacker can use the server's outbound request functionality to probe and reach private internal infrastructure that would otherwise be inaccessible.

### Exploitation

1. Access any product page and find the **stock check** functionality. Click it and capture the request in Burp.
2. Find the `POST /product/stock` endpoint and send it to Repeater.
3. Change the `stockApi` parameter to `http://192.168.0.1:8080/admin` and send to Intruder.
4. Mark the last octet (`1`) as the payload position. Set the payload to numbers from `1` to `255` and start the attack.
5. Sort results by status code — find the request that returns a `200` response. Note the IP address.
6. Send that request to Repeater and open the response in the browser — the admin panel is accessible.
7. Click **Delete carlos** and note the URL path: `/admin/delete?username=carlos`.
8. Back in Repeater, set the `stockApi` parameter to:

   ```
   http://192.168.0.X:8080/admin/delete?username=carlos
   ```

   (replacing `X` with the discovered IP octet)
9. Send the request — `carlos` is deleted and the lab is complete.

### Lesson Learned

* The server must never blindly trust user-supplied URLs.
* Admin panels and other sensitive internal interfaces must require authentication even for internal network requests — assuming private network access means safe access is a dangerous design flaw.
* Server-to-server and server-to-internal-machine communication must have its own authentication layer, even within a private network.


---

# 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-ssrf-lab/lab-2.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.
