Secure-coding laboratory: Docker reproduction of CVE-2026-123158 (sshole) — OpenSSH password-auth bypass on musl/no-PAM, why the default is safe, and the fix
A self-contained, Docker-isolated reproduction of CVE-2026-123158 ("sshole"): an OpenSSH
password-authentication bypass that affects musl-based systems (Alpine, OpenWrt, Buildroot, Yocto)
where sshd is built without PAM. On a vulnerable host, an account whose /etc/shadow hash
field is * can be logged into with any password of 257 bytes or longer.
The cause is a three-way collision: musl's crypt(3) returns the string "*" to signal "key too
long", a locked account stores "*", and OpenSSH authenticates with strcmp(crypt(...), stored).
So strcmp("*", "*") == 0 — an error signal is accepted as a valid credential.
This repo proves the bypass end to end, shows why it only "affects some configurations", and proves the official fix rejects it — all on an isolated Docker network, against accounts and hosts you control.
This is defensive security education. Everything runs in throwaway Docker containers on a
private network (sshole-net) against a victim account created solely for the demo. Nothing
reaches, scans, or authenticates to any system you do not own. Do not point the PoC client
(repro/exploit.sh) at a host you are not authorised to test — that is the only part that could be
misused, and it needs a target you supply.
makemake core # the vulnerability in ~50 lines, no network: shows the BYPASS
make pwn # full live network shell against a vulnerable sshd: shows PWNED
make patched # the official fix rejecting the identical attack
make clean # remove all containers and the Docker network
make core is the fastest way to see the collision; it builds and runs repro/replica.c and needs
no sshd. make pwn is the full remote proof.
make target | What it demonstrates | Result |
|---|---|---|
core | the crypt/strcmp collision in isolation (replica.c) | BYPASS |
pwn | full live network shell, warm pick_salt cache (Dockerfile.warm) | PWNED |
vuln-cold | cold cache: the primitive fires but a musl buffer clobber blocks the match | rejected |
spy | live crypt()/strcmp() trace inside real sshd (cryptspy.c via LD_PRELOAD) | trace |
authsim | the pick_salt() buffer clobber against the real /etc/shadow (authsim.c) | rejected |
shadowtest | the victim's effective stored hash resolves to "*" (shadowtest.c) | prints "*" |
patched | the fix (MIN_PASSWORD_HASH_LEN) rejecting the attack (Dockerfile) | rejected |
clean | tear down containers and the network | — |
vuln-cold and pwn are the instructive pair: the same from-source OpenSSH 9.7p1, differing only
in whether pick_salt()'s salt cache is warm when the privsep monitor forks. Cold, a musl
shared-buffer overwrite clobbers the stored "*" and the login is rejected; warm, the "*" survives
and the shell drops. That fragility is why the advisory says the bug "affects some configurations".
Vulnerable only if all hold: sshd linked against musl, built without PAM, password auth on,
a login-reachable account whose shadow field is exactly * (any account, not just root; !,
!!, x and empty do not collide), and OpenSSH < 10.6p2 without the backported fix. The triage commands are in
WRITEUP.md §8. Fix: upgrade to OpenSSH ≥ 10.6p2 (Alpine openssh-server ≥ 9.7p1-r6),
or set PasswordAuthentication no, or re-lock such accounts with ! instead of *.