Last updated
Last updated
Sniper is a medium difficulty Windows machine which features a PHP server. The server hosts a file that is found vulnerable to local and remote file inclusion. Command execution is gained on the server in the context of NT AUTHORITY\iUSR
via local inclusion of maliciously crafted PHP Session files. Exposed database credentials are used to gain access as the user Chris
, who has the same password. Enumeration reveals that the administrator is reviewing CHM (Compiled HTML Help) files, which can be used the leak the administrators NetNTLM-v2 hash. This can be captured, cracked and used to get a reverse shell as administrator using a PowerShell credential object.
Scope
IP Address: 10.10.10.151
Nmap Scan
RPC & SMB Enumeration
Nothing found from rpcclient
smb anonymous login failed
HTTP Enumeration
Looking at wapplayzer
http://10.10.10.151/user/login.php
I registered an account and try to login with it, but the site didn't have any thing
Under http://10.10.10.151/blog/
there is a parameter ?lang
which include blog-en.php
When I tried to include local file such as /etc/hosts
located at C:windows\system32\drivers
, It returned the file content
Since, this is windows machine I will try LFI
to my smb server
Craft the url
to call our server and we got a hit
I tried then to get RCE via download a reverse_shell.ps1
and execute it on the fly
shell.php
content
start nc
listener and include the remote shell
We are in a web server folder which can contain database connection string or credentials for login
It's database credentials, I looked at open ports listening locally and found that mysql
default port 3306
is there
To connect to the database, I need fully interactive shell, So I will map mysql
port to my local machine using chisel
run Nmap
against the port locally to verify
I found two users, one I created when registering in webapp and admin user, but when I tried to crack the hash of admin, I failed
Looking at users on the system. Chris
user has a profile, Let's try the password we found of the dbuser
with him instead
And we got a hit, but I need a shell with that user as I we don't have remote access with him
So, I download RunasCs.exe
from my kali to the machine
Execute it as Chris
user to have a shell as that use
start nc
listener and wait for a shell
Get the flag
User Flag: 44d27619bef1f819476fxxxxxxxxxxxxxxxxx
When I typed tree /F
to explore the folder content, I found weird file extension I didn't seen before .chm
I searched at google for it and found that it's a compiled HTML Help
file
I found this useful post:
Personally, I couldn't download this program as it's available on Microsoft center to download so I will reach administrator admin with unintended path
I found that iusr
has SeImpersonatePrivilege
which can be abused to escalate to SYSTEM
account
I need PrintSpoofer.exe
tool, So I will download it to the box and execute it to get a reverse shell as SYSTEM
Get root flag
Root Flag: f65247f419e1087df1fxxxxxxxxxxxxx