> 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/command-injection/basic-os-command-injection.md).

# Grundlegende OS-Befehlsinjektion

### OS-Befehlsinjektion

Dieses Lab zeigt eine Schwachstelle für die Einschleusung von Systembefehlen in das Lagerbestandsprüfwerkzeug eines Produkts. / Die Anwendung führt einen Shell-Befehl aus, der die vom Benutzer bereitgestellten Produkt- und Store-Zugangsdaten enthält, und gibt dann die Roh-Ausgabe dieses Befehls direkt in der Antwort zurück.

Das Ziel des Labs ist es, den **whoami** Befehl auszuführen, um den aktuellen Benutzernamen zu ermitteln.

Wir stellen fest, dass es unter Linux möglich ist, wenn Sie einen Befehl wie z. B. eingeben:

```bash
pwd
```

mehrere Befehle mit einem Semikolon zu verketten:

```bash
pwd;whoami
```

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

In diesem Fall werden zwei Parameter übertragen.

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

Wenn man ein **;** in das eine oder das andere einfügt, kann man einen beliebigen Befehl ausführen, da das Backend eine Funktion vom Typ verwendet **system**.

Beispiel:

```bash
productId=1&storeId=1;ls -l
```

<figure><img src="/files/572918b9872e74fa4d9194c8d4926fa42dd0d688" 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/command-injection/basic-os-command-injection.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.
