
Lab de estudo para CVE-2026-123158 (sshole) - bypass de autenticacao SSH em sshd musl sem PAM
Local, Docker-reproducible lab to study CVE-2026-123158 — a real password authentication bypass vulnerability in OpenSSH, disclosed on November 5, 2026, and fixed the same day by the OpenSSH project (version 10.6p2).
⚠️ Warning. The vulnerability is real. This repository exists only for controlled reproduction in a local, isolated environment. Never run the exploit included here against third-party systems without explicit authorization.
sshd running without PAM, a password between 257 and 1024 bytes causes musl's crypt() function to fail internally and return, on error, the input string itself — which may coincide with the * character stored in the password field of a "key-only" account in /etc/shadow. sshd then compares * with *, concludes (wrongly) that the password matched, and accepts the login.AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.openssh-server 10.0_p1-r11.sshd delegates password authentication to PAM.Conditions required for exploitation (all simultaneous): musl libc, sshd without PAM, PasswordAuthentication yes (factory default), a target account with a * password field, and a second account in the same /etc/shadow with a valid $5$/$6$ hash (the "salt donor").
Dockerfile # build multi-stage: sshd vulnerável (compilado sem PAM) vs. pacote Alpine corrigido
docker-compose.yml # dois serviços: app-vulnerable (porta 2222/8000) e app-patched (2223/8001)
entrypoint.sh # monta as contas de teste (deploy, salted) e sobe sshd + app
app/ # serviço FastAPI mínimo, sem vulnerabilidade própria — só "vítima colateral"
exploit/sshole.py # PoC em Python/Paramiko: autentica por senha longa, sem chave nem senha real
keys/ # fica vazio no repo; veja "Como rodar" para gerar seu par de chaves
entrypoint.sh installs a legitimate public key for the deploy account (representing the correct
access path, by key). Generate your own pair locally — it is never used by the exploit, it only serves
to demonstrate the "normal" scenario:
ssh-keygen -t ed25519 -N "" -C "deploy-operator-lab" -f keys/deploy_ed25519
docker compose up --build -d
This brings up:
sshole-vuln — OpenSSH 9.9p1 compiled from source with --without-pam, on Alpine/musl. SSH on
localhost:2222, HTTP on localhost:8000.sshole-patched — current Alpine openssh-server package (already patched). SSH on localhost:2223,
HTTP on localhost:8001.pip install -r exploit/requirements.txt # paramiko
python3 exploit/sshole.py --host localhost --port 2222 --user deploy
Expected result against the vulnerable one: rejection on the 1st attempt, authentication on the 2nd, shell as deploy
without ever having had the private key.
Repeat against port 2223 (sshole-patched) to confirm that the same technique fails on all
attempts.
apk upgrade on Alpine).PasswordAuthentication no in sshd_config, or disable SSH until you update.* alone as protection for a "key-only" account without also disabling password authentication
on the server.Personal study material, no warranties. Educational use only, in a local and isolated environment.