4 minute read

Sniper

Information Gathering

Nmap Port Scan

Screenshot

Nmap Script Scan

Screenshot

Nmap Full Sport Scan

Screenshot

Nmap Vulnerability Scan

Screenshot

Service Enumeration

Nikto Web Scan on Port 80

Screenshot

FFuF Web Enumeration on Port 80

Screenshot

Nmap SMB Scan

Screenshot

HTTP Service Enumeration

Screenshot

Gobuster Web Enumeration

Screenshot

/blog Web Endpoint

Screenshot

User Account Registration

Screenshot

Screenshot

Penetration

Local File Inclusion - Lang Parameter

The lang parameter on the /blog/ endpoint is vulnerable to local file inclusion. The curl request below shows the basic local file inclusion of the win.ini file on the target server.

Screenshot

Remote File Inclusion over SMB

After testing local file inclusion we can attempt to utilize an SMB path starting with \\ and then our attacking machine IP. Standing up a basic SMB server using the Impacket Python library allows us to confirm the connectivity on the back end. The Impacket library server does not appear to be fully functioning but settings up an SMB share on the attacking Kali machine will allow us to use the RFI vulnerability against the full SMB server. Creating a reverse shell is documented below.

Screenshot

Screenshot

Screenshot

iusr User Shell Enumeration

Once remote code execution is achieved and a reverse shell can be easily spawned by copying nc64.exe onto the box and then executing the reverse shell command.

Screenshot

Privilege Escalation

SQL Credentials in db.php

Screenshot

Chris User Shell

The Chris user is the only other interactive user on the target machine. Using the stolen MySQL credentials to create a PowerShell command we can run our reverse shell as the Chris user.

Screenshot

Screenshot

Chris User Shell Enumeration

It appears that C:\Docs is being used to discuss documentation on a new PHP project and they are expecting files to be placed there so that they can be read. After placing our CHM file in our downloads folder here we can see that it is read and deleted.

Screenshot

Screenshot

Crafting Malicious CHM File

Because this CHM file is being opened and deleted we can craft a malicious file to be read by the end user. A tool has been created to do just that called Out-CHM.ps1 by Nishang. Below illustrates the steps for successful exploitation. A second Windows VM was used to compile the particular file.

http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe

https://github.com/samratashok/nishang/blob/master/Client/Out-CHM.ps1

Screenshot

Screenshot

Screenshot

Administrator User Shell

By mounting the attacking machine SMB share using net use we can easily access files on the attacking server from the compromised user shell. Simply copying files off of this share to the C:\Docs location and waiting will return a user shell as the NT AUTHORITY\SYSTEM user, allowing for infinite control over the target system.

Screenshot

Screenshot

Screenshot

Screenshot