> For the complete documentation index, see [llms.txt](https://0xa1mn.gitbook.io/cyber-explained/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xa1mn.gitbook.io/cyber-explained/pentesting/web-pentesting/ssrf.md).

# SSRF

#### Server-Side Request Forgery

**any url parameter try ssrf**

cause the server to make a connection to **internal-only** services within the organization's infrastructure

* **SSRF attacks against the server itself**

  alter url parameter to `http://localhost` this may allow functions only allowed for normal user
* **SSRF attacks against other back-end systems**

  alter url parameter to `http://192.168.0.x` using intruder to scan back-end systems that are not reachable by user *These systems often have non-routable private IP addresses*
* **SSRF with blacklist-based input filters**
  * alter ip representation to

    ```
    hex IPoctal IP127.1 127.0.0.10177.0.0.10x7f.0.0.1127.0.1127.121307064330177000000010x7f000001
    ```

    this work because of : inet\_ntop, inet\_pton - convert IPv4 and IPv6 addresses between binary and text form
  * Registering your own domain name that resolves to 127.0.0.1. You can use `spoofed.burpcollaborator.net` for this purpose.
  * Obfuscating blocked strings using URL encoding or case variation like encode first letter from admin
* **SSRF with whitelist-based input filters**
  * embed credentials in a URL before the hostname `https://expected-host@evil-host`
  * use the `#` character to indicate a URL fragment `https://expected-host#evil-host` or`https://expected-host#@evil-host`
  * leverage the DNS naming hierarchy `https://expected-host.evil-host`
  * URL-encode characters to confuse the URL-parsing code
  * MIX ALL ABOVE TOGETHER
* **Bypassing SSRF filters via open redirection**

  `/product/nextProduct?currentProductId=6&path=http://evil-user.net`

  returns a redirection to:

  `http://evil-user.net`

  You can leverage the open redirection vulnerability to bypass the URL filter, and exploit the SSRF vulnerability as follows:

  ```
  POST /product/stock HTTP/1.0Content-Type: application/x-www-form-urlencodedContent-Length: 118​stockApi=http://weliketoshop.net/product/nextProduct?currentProductId=6&path=http://192.168.0.68/admin
  ```

  This SSRF exploit works because the application first validates that the supplied stockAPI URL is on an allowed domain, which it is. The application then requests the supplied URL, which triggers the open redirection. It follows the redirection, and makes a request to the internal URL of the attacker's choosing.

***

ssrf to local file disclosure


---

# 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:

```
GET https://0xa1mn.gitbook.io/cyber-explained/pentesting/web-pentesting/ssrf.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
