WriteupsTryHackMe
TryHackMe Stealth
Writeup
Overview
- Machine Name: Stealth
- OS: Windows
- Difficulty: Medium
Summary
The initial foothold was achieved via a web application that allowed the upload of PowerShell scripts, leading to a reverse shell. Privilege escalation was then performed using a known exploit for Windows with SeImpersonatePrivilege enabled.
Reconnaissance
Nmap Scan Results
Observations
- SMB Ports: 139, 445 (common for Windows networking)
- RDP: 3389 (Remote Desktop Protocol)
- HTTP Services: 8000, 8080, 8443 (web services, PowerShell script analyser)
- HTTPS: 8443 (Apache on Windows, self-signed certificate)
Exploitation
Web Application (8080)
- Service Identification: The web application running on port 8080 is identified as "PowerShell Script Analyser."
- Upload Functionality: Allows for the upload of PowerShell scripts.
Exploit Steps
- Upload Malicious Script:
- Created a PowerShell reverse shell script.
- Uploaded the script via the "PowerShell Script Analyser" interface.
-
Start Listener:
- On the attacker's machine, a Netcat listener was started to catch the reverse shell.
-
Trigger Execution:
- After uploading, executed the script via the web application.
Initial Foothold
- Obtained Shell: Successfully received a reverse shell on the attacker's machine.
- Verification: Confirmed access by checking the current user and directories.
Privilege Escalation
Enumeration
-
System Information:
- The machine is running Windows Server with multiple services and privileges enabled.
-
User Privileges:
- The user has
SeImpersonatePrivilege
enabled.
- The user has
Exploit (EfsPotato)
- Tool: EfsPotato was chosen due to
SeImpersonatePrivilege
. https://github.com/zcgonvh/EfsPotato
Steps
- Download EfsPotato:
- Transferred the EfsPotato executable to the target machine and compile.
- Execute EfsPotato:
- Used EfsPotato to escalate privileges.
- Result:
- Obtained a SYSTEM shell.