Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-123158-LAB — musl libc를 쓰는 Apline의 OpenSSH에서 비밀번호 인증을 우회하는 취약점 (sshhole, CVE-2026-123158)을 이해하고 검증하기위해 작성함 | Kitploit
Tools/GitHubGitHub/aciddust/cve-2026-123158-lab
Container SecurityVulnerability AnalysisExploitationPenetration TestingAuthenticationLearning & EducationLabs & Practice
GitHubaciddust/cve-2026-123158-lab

CVE-2026-123158-LAB

musl libc를 쓰는 Apline의 OpenSSH에서 비밀번호 인증을 우회하는 취약점 (sshhole, CVE-2026-123158)을 이해하고 검증하기위해 작성함

View Repository
11 days agoNot yet reviewed
Share

sshhole 랩: CVE-2026-123158 로컬 격리 재현

musl libc를 쓰는 Alpine의 OpenSSH에서 비밀번호 인증을 우회하는 취약점(sshhole, CVE-2026-123158)을 이해하고 검증하는 Docker 랩이다.

이 취약점의 CVSS 점수는 8.1이고, OpenSSH 10.6p2에서 수정됐다.

모든 트래픽은 일회용 컨테이너 사이의 docker 사설 네트워크 안에서만 오간다. 외부 스캔도, 외부 대상도 없고, 이 컴퓨터 밖으로 나가는 것은 없다.

본 코드는 오직 보안 연구 및 시스템 방어 점검을 위한 교육적 목적으로만 제공된다.

취약한 버전에서 우회가 되는 동작과 패치된 버전에서 차단되는 동작을 직접 비교해서, 본인이 운용하는 Alpine 이미지의 조치 여부를 판단할 수 있게 한다.

취약점이 발생하는 원리

musl libc의 crypt()는 비밀번호가 256바이트를 넘으면 문자열 "*"를 그대로 반환한다. glibc은 NULL을 반환하고 sshd가 이를 거부하므로 Debian, Ubuntu, RHEL은 해당하지 않는다.

비밀번호가 없는 계정은 /etc/shadow의 비밀번호 칸에 정확히 "*"를 저장한다. sshd가 이런 계정을 인증할 때도 crypt(password, salt)를 호출한다.

이때 salt는 실제 $5$ 또는 $6$ 해시를 가진 다른 계정에서 가져온다.

10.6p1의 openbsd-compat/xcrypt.c에 있는 pick_salt()가 그 일을 한다. sshd는 그 결과를 저장된 값과 strcmp로 비교한다. 256바이트를 넘는 비밀번호를 보내면 "*"와 "*"가 같아져서, 실제 자격 증명 없이 로그인이 통과된다.

성립 조건은 네 가지다.

  1. musl libc를 사용할 것
  2. sshd가 PAM 없이 빌드될 것 (UsePAM no, Alpine 기본값)
  3. PasswordAuthentication yes일 것
  4. "*" 계정과 실제 해시를 가진 계정이 모두 존재할 것

"!"로 잠긴 계정은 잠긴 상태로 처리돼서 영향을 받지 않는다. 반드시 "*"여야 한다.

PoC 전달 시 함정: sshpass를 쓰면 재현되지 않는다

sshpass로 긴 비밀번호를 보내면 우회가 조용히 실패한다.

sshpass는 pty에 비밀번호를 타이핑하는데, 터미널 캐노니컬 모드의 줄 길이 제한이 비밀번호를 255바이트로 잘라 버린다.

255바이트는 musl의 256바이트 기준보다 작아서, 서버에는 평범한 틀린 비밀번호로 보인다.

attack.sh는 대신 SSH_ASKPASS_REQUIRE=force로 비밀번호를 전달한다.

askpass 헬퍼 스크립트에는 #!/bin/sh 쉬뱅이 필요하다.

확장자 없는 스크립트를 musl의 execvp가 실행하지 않기 때문이다.

랩 구성

서비스OpenSSH역할
vuln10.6p1취약 버전 sshd. 소스에서 빌드, musl, PAM 제외
patched10.6p2패치된 버전. 이미지와 빌드 옵션이 vuln과 동일하고 버전만 다르다
attacker클라이언트ssh 클라이언트와 askpass로 시연을 실행한다

두 sshd 이미지는 Dockerfile.sshd를 공유하고 OPENSSH_VERSION 빌드 인자만 다르다.

그래서 OpenSSH 버전이 유일한 변수임이 구조로 확인된다. 각 서버에는 두 계정이 있다.

deploy는 shadow 값이 "*"인 키 전용 계정이고 피해자 역할이다.

admin은 실제 $6$ 해시를 가진 계정으로, pick_salt()가 가져갈 salt의 원천이다.

실행

./run-lab.sh

The expected output is as follows. It is exactly what attack.sh actually outputs, with only the container ID replaced by a placeholder.

>>> LONG_PW length: 400 bytes
>>> SHORT_PW length: 13 bytes
=== 1. 대조군: 취약 서버에 짧은 오답 비밀번호 (거부 기대) ===
>>> ssh deploy@vuln     (평범한 틀린 비밀번호)
   로그인 거부됨

=== 2. 우회: 취약 서버에 400바이트 무의미 비밀번호 (로그인 기대) ===
>>> ssh deploy@vuln     (400바이트 무의미 비밀번호)
   로그인 성공: deploy  (uid=1001(deploy) ...)  호스트 <컨테이너 ID>

=== 3. 동일 공격을 패치 서버(OpenSSH 10.6p2)에 재실행 (거부 기대) ===
>>> ssh deploy@patched  (400바이트 무의미 비밀번호)
   로그인 거부됨

Short incorrect passwords are rejected. A 400-byte meaningless password passes login in 10.6p1 and is rejected in 10.6p2.

This difference is the vulnerability itself, and 10.6p2 is the fix.

Directly Verifying the Root Cause

docker compose cp root-cause/crypt_test.c vuln:/tmp/crypt_test.c
docker compose exec vuln sh -c 'cc /tmp/crypt_test.c -o /tmp/t && /tmp/t'

long key -> * is printed. This is the musl behavior on which this entire vulnerability depends.

Summary

docker compose down --rmi local

Checking My Host (Without a Lab)

Run it on an Alpine/musl host.

You should suspect exposure when all of the following conditions are met: a "*" account appears, password authentication is enabled, and sshd runs without PAM.

# 비밀번호 칸이 "*"인 계정 (잠재적 피해 계정)
awk -F: '$2=="*"{print $1}' /etc/shadow
# 실제 $5$/$6$ 해시를 가진 계정 (salt 원천)
awk -F: '$2 ~ /^\$[56]\$/{print $1}' /etc/shadow
# 설치 버전. 본인 브랜치의 수정 버전과 비교한다
apk info openssh | head -1
grep -Ei '^(UsePAM|PasswordAuthentication)' /etc/ssh/sshd_config

Command to check whether there is an intrusion that has already succeeded:

grep "Accepted password for" /var/log/messages 2>/dev/null

Action

  1. Install OpenSSH 10.6p2 or later with apk update && apk upgrade openssh. Modified builds in each branch are also valid. Examples: edge 10.6_p2-r0, 3.24 10.3_p1-r2. Even if the version number in an Alpine branch is lower than 10.6p2, the fix may have been backported. Do not judge by the version string alone; base your judgment on the fixed version specified per branch in the distribution advisory.
  2. Restart sshd (rc-service sshd restart). Containers must be rebuilt with the patched image. This is because running processes continue to use the old code.
  3. If you cannot patch immediately, disable password authentication with PasswordAuthentication no or change to UsePAM yes, then restart sshd.

Source

  • ethiack: sshole CVE-2026-123158
  • Detectify: critical OpenSSH auth bypass on Alpine
  • IONIX: SSHHole CVE-2026-123158
  • ThreatDefence: patching and hunting
  • SOCRadar: sshole, OpenSSH fixes password bypass on Alpine
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    1.0k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    593
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    371
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    336
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    326
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    322

Explore all tools

Browse our collection of tools

View all tools →