# Passage

## Gaining Access

Nmap scan:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-f3d4dec52ea1b6f24ccf6deb3872e88ce01740ab%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Passage News

Port 80 reveals some kind of website archive thing:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-418aab221d735d2bf0864f60933213ee5dc1e76b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Checking the page source, we find that this is running CuteNews, which had a few RCE exploits available:

{% embed url="<https://www.exploit-db.com/exploits/48800>" %}

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-fc9ed5f337ed34d437efef4f3d29509c27099973%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

With this, we can easily gain a reverse shell:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-713ef88c10a5c97c356b942e2374fc0e20af2f97%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilege Escalation

### Paul Credentials

Within the `/var/www/html/CuteNews/cdata/users` directory, we can find some base64 encoded lines:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-3c69c3c87ee4a08e3665a2166277c5f8c747dd80%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

When one of them was decoded, we find a token of some sorts:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-bc980b7ef15df277bcf9d614c44e784b7d2fb381%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

We can crack this hash on crackstation:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-47b9069d916621d6b15790ff46fb169d7e64d242%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Then we can `su` to `paul`:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-4920423d6607463b8a0e10b58c5553a6088471bd%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Cool

### SSH to Nadav

When I ran LinPEAS on the machine, I found that the public key of `nadav` was the public key of `paul`...?

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-baf597c713dec97ac29c19d335c0e45c26c2ffe8%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

I tried to `ssh` in as `nadav` from `paul`, and it worked!

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-751afdbb0598ad295e784450d4ab214e13b5fc85%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### USBCreator

When running another LinPEAS, we find this part here:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-ed2539c9945ef9250528e27c7ad26115c6ffcea3%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% embed url="<https://rioasmara.com/2021/07/16/usbcreator-d-bus-privilege-escalation/>" %}

{% code overflow="wrap" %}

```bash
gdbus call --system --dest com.ubuntu.USBCreator --object-path /com/ubuntu/USBCreator --method com.ubuntu.USBCreator.Image /root/.ssh/id_rsa /tmp/id_rsa true
```

{% endcode %}

Following this PoC would extract the private SSH key of `root` and allow me to SSH in as `root`:

<figure><img src="https://1617468840-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqpzdj1tPRpELJdvxuVYh%2Fuploads%2Fgit-blob-8f31e430e3b07408dcfd321d34c99a33c27012cf%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
