Page cover

Alert

Synopsis

Alert is a easy linux machine created by FisMatHackarrow-up-right. The md file is vulnerable to XSS and through contact form the Arbitrary File Read is performed. The hash of albert is found in one of the file. SSH into alber and pillaging reveals that the php server running at port 8080. The reverse shell php script is created and port 8080 is forwarded. The root shell is gained using nc and visiting the malicious php script.

OS
Difficulty
Points
Release Date
Retired Date

Linux

Easy

20

23-11-2024

22-03-2025


Enumeration

Nmap

Starting the nmap scan and found ssh and http services running.

nmap -Pn -sC -sV --min-rate=1000 10.10.11.44                                                                                                                             
Starting Nmap 7.95 ( https://nmap.org ) at 2025-03-18 10:49 GMT                                                                                                              
Nmap scan report for 10.10.11.44
Host is up (0.97s latency).
Not shown: 998 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.11 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 7e:46:2c:46:6e:e6:d1:eb:2d:9d:34:25:e6:36:14:a7 (RSA)
|   256 45:7b:20:95:ec:17:c5:b4:d8:86:50:81:e0:8c:e8:b8 (ECDSA)
|_  256 cb:92:ad:6b:fc:c8:8e:5e:9f:8c:a2:69:1b:6d:d0:f7 (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Did not follow redirect to http://alert.htb/
|_http-server-header: Apache/2.4.41 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 55.56 seconds

Add alert.htb in /etc/hosts file.

Web - alert.htb

Alert website is a markdown viewer, where we have to uplaod the markdown file and we see the markdown.

The Contact Us page has a form to write message and send it. The About Us has a message saying that the administrator reviews the contact messages.

Searching the web for md files vulnerabilities, one of the hacktricks pagearrow-up-right contains the XSS vulnerability which is used in md files. Trying the first XSS payload form hacktricks gives us the alert, which confirms the XSS vulnerability in md files.

Directory fuzzing reveals some of the hidden paths.

The messages gives the forbidden and messages.php has a blank page.


Foothold

Shell - albert [ Arbitrary File Read via XSS ]

Clicking Share Markdown button at the bottom right corner of the page gives us the http://alert.htb/visualizer.php?link_share=67e02ea9ea5471.39498561.md link to share the md file.

Exploit

Creating the malicious md file to read the files, and sharing the md file. The link is send via message in contact us to administrator and we will get to read the file.

1

Creating malicious md file

Adding the below script in payload.md file for checking Arbitrary File Read.

2

Uploading and sharing the md file

Open the python server. Upload and share the md file. Paste the link in the contact us message input.

3

Decoding the base64

4

Reading config file

Reading the apache config file via Arbitrary File Read vulnerability.

Repeat step 3.

5

Getting hash

The /var/www/statistics.alert.htb/.htpasswd file contains the user authentication credentials. Repeat the above steps to get the file.

6

Cracking the hash

The password gives us the ssh login as albert.

circle-info

The user.txt file contains the user flag 👏


Privilege Escalation

Pillaging - albert [ user ]

The netstat reveals that the tcp port 8080 is open.

The ps aux command reveals that the root is running php web-server in port 8080 and serving the files from /opt/website-monitor directory.

Shell - root

Creating the reverse shell php file in /opt/website-monitor directory gives us the reverse shell.

1

Port Forwarding [ port 8080 ]

2

Creating the php script for reverse shell

Change Directory to /opt/website-monitor/config

3

Getting Shell

Open nc listener and visit http://localhost:8080/config/shell.php

circle-info

The root.txt contains the root flag 🎉


Proof of Concept

The below video provides the PoC of Alert machine.

Last updated