CVE-2026-59997
Executive Summary
CVE-2026-59997 is a command-line argument parsing flaw in OpenSSH's internal-sftp subsystem, present in versions prior to 10.4. When internal-sftp is invoked via sshd, it processes only the first 9 command-line arguments, silently ignoring any subsequent ones. This truncation can undermine intended security controls if an administrator configured an SFTP session with restrictive flags (e.g., -d for chroot directory, -u for umask) in positions beyond the 9th argument, allowing affected users to operate with broader access than intended. The vulnerability carries a CVSS score of 4.2 (Medium), indicating a localized privilege/integrity issue requiring an existing authenticated SSH session. Enterprise environments relying on internal-sftp argument tuning for jail enforcement or file operation restrictions are at risk of policy bypass, potentially exposing sensitive files or permitting unauthorized file operations (upload, delete, rename) outside the intended scope.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
The vulnerability resides in the argument handling routine of internal-sftp, which is implemented within the OpenSSH source tree (typically sftp-server.c or a dedicated internal module). The flaw is a classic argument truncation defect: the code parses options passed from sshd's Subsystem sftp internal-sftp directive (or the -o override in sshd_config) but stops processing after the 9th argument (argv[9]). This is likely due to a hardcoded array size or a loop boundary condition that fails to iterate beyond a fixed count, either because the developer assumed a maximum option count or because a for loop uses i < 9 instead of i < argc.
From a code standpoint, an administrator's sshd_config might contain:
Subsystem sftp internal-sftp -d /srv/sftp/%u -u 0022 -R -l INFO -f AUTH -m 0750
If an attacker can influence the configuration (e.g., through a chained misconfiguration or a user-modifiable setting), or if the argument list naturally exceeds 9 entries, the 10th argument (e.g., -m 0750 restricting file creation modes) would be ignored. In a default installation, internal-sftp usually receives 1–3 arguments, so the vulnerability is only reachable in complex, security-hardened deployments where many flags are stacked.
The attack surface is authenticated, interactive SFTP sessions. An attacker must first authenticate as a valid user (or compromise a low-privilege account). The impact is a security-policy bypass: the SFTP server behaves as if restrictive flags were absent, allowing operations that the administrator explicitly tried to forbid. For example, if -d /home/%u (chroot to user's home) is the 10th argument and ignored, the user can traverse to /etc, /var, or other users' directories. If -u 0022 (umask) is ignored, file permissions may default to system-wide umask (e.g., 0022 resulting in world-readable files), leaking sensitive data.
The CWE identifier is unknown per CVE data; based on the mechanism, it aligns most closely with CWE-1395: Dependency on Vulnerable Third-Party Component if linked to a bundled library, but more precisely CWE-193: Off-by-One Error or CWE-124: Buffer Underwrite if the truncation stems from an index miscalculation. Given the functional behavior (ignoring arguments, not a memory corruption), we assess it as CWE-20: Improper Input Validation — specifically, failure to validate the complete argument vector before use. No memory corruption is indicated; the impact is purely logical.
Exploitation Scenarios
Scenario 1: Chroot Escalation via Argument Truncation (Authenticated User)
- Reconnaissance: An attacker with a valid low-privilege SSH account identifies the target as an OpenSSH server via banner (
SSH-2.0-OpenSSH_10.2) and probes SFTP behavior (sftp user@host). They runpwdon login; if it returns something other than/or the home directory, they suspectinternal-sftpwith custom arguments. - Trigger Setup: The attacker checks
sshd_config(if readable via misconfiguration or local file disclosure) to see if theSubsystem sftpline is long (≥ 10 arguments). They note the position of security-relevant flags (e.g.,-d,-u,-m). - Weaponization: The attacker initiates an SFTP session. Because the vulnerable parser ignores arguments beyond
argv[9], any chroot directive (-d) in that position is not enforced at session setup. - Payload/Execution: The attacker runs
cd /etcorcd /home/otheruserand thenget sshd_configorput malicious_shell.sh. The SFTP server, running without the chroot, honors the path traversal. - Post-Exploitation: The attacker exfiltrates sensitive configuration (e.g.,
/etc/shadowif perms allow), places a malicious file in another user's home (if write perms align), or uploads a file that a cron job later executes — pivoting to lateral movement or privilege escalation.
Scenario 2: Umask/File-Mode Bypass for Data Exfiltration
- Reconnaissance: Attacker enumerates the
sshd_config(readable via world-readable ACL or prior foothold) and sees the SFTP subsystem configured with-u 0077(restrictive umask) as the 12th argument. - Trigger Setup: The attacker uploads a file containing sensitive data (e.g., a database dump already accessible to their account) via SFTP.
- Weaponization: Due to truncation, the
-u 0077is ignored; the server applies the default umask (e.g.,0022), creating the file with0644permissions instead of0600. - Payload/Execution: The attacker moves the file to a world-readable directory (e.g.,
/tmp) and confirms permissions viachmodif needed, but the upload itself already created a world-readable file. - Post-Exploitation: The attacker defers—another low-privilege user (or a service account scanning for
*.sqlin/tmp) picks up the file, providing an alternative data access path that bypasses the restrictive umask policy.
Scenario 3: Log/Uplog Disablement (Operational Disruption)
- Reconnaissance: Attacker knows the organization uses
-l VERBOSE(log level) as the 10th argument to enable detailed SFTP audit logs. - Trigger Setup: Any SFTP session will fail to enable verbose logging.
- Weaponization: The attacker performs a series of file deletions and renames designed to avoid detection (since logs are not capturing the operations).
- Payload/Execution: The attacker deletes the
authorized_keysfile of a colleague or removes critical application files, then exits. - Post-Exploitation: The security team lacks audit trails for the specific actions, delaying incident response and attribution.
Impact Assessment
- CVSS Score: 4.2 (Medium) — The vector is not provided in the CVE data; we infer:
AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N(high attack complexity due to the need for a specifically configured instance, low privilege requirement for authenticated SFTP, limited CIA impact). The Medium rating reflects that exploitation is environment-dependent and requires a non-default configuration. - Business Impact: For organizations using
internal-sftpwith layered argument-based controls (chroot, umask, log levels), the truncation silently disables the later flags, creating a security-policy gap. This can lead to:- Confidentiality breach: Unauthorized read access to files outside the intended chroot.
- Integrity violation: Unauthorized file write/delete/rename operations.
- Audit failure: Loss of detailed SFTP logs, hampering compliance (e.g., PCI DSS, SOC 2) and forensic investigations.
- Affected Systems: Any OpenSSH server (< 10.4) with
Subsystem sftp internal-sftpconfigured with a flag list whose critical options appear at position 10 or later. Also relevant for deployments usingForceCommand internal-sftpwith multiple options inauthorized_keys. - Blast Radius: Single SFTP subsystem per affected host. The impact is per-user, authenticated; it does not yield root access directly but can provide file-level access that may lead to credential harvesting (reading
.ssh/authorized_keysor config files) and lateral movement. In multi-tenant hosting environments (shared servers with many users), the chroot bypass could expose one tenant's data to another.
Detection Guidance
Sigma Rule
title: OpenSSH internal-sftp Argument Truncation - Chroot Bypass Detection
id: 44a12c3e-5f9b-4c01-8d4a-7e97b2a1e00c
status: experimental
description: Detects SFTP sessions attempting to access paths outside the expected chroot, indicating possible CVE-2026-59997 exploitation.
logsource:
product: linux
service: sshd
definition: 'Requirements: sshd configured with internal-sftp and auth logging (ssh -l VERBOSE).'
detection:
selection_root_access:
- data: 'sftp: realpath "/*"'
- data: 'sftp: stat name "/etc/*"'
- data: 'sftp: open "/etc/*"'
- data: 'sftp: opendir "/"'
condition: selection_root_access
falsepositives:
- Admin SFTP sessions where chroot is intentionally disabled
- Misconfigured SFTP clients that normalize paths
level: high
tags:
- attack.t1190
- attack.initial_access
- cve.2026.59997
YARA Rule
rule openssh_internal_sftp_truncation
{
meta:
author = "ValtersIT Threat Intel"
description = "Detects strings associated with OpenSSH internal-sftp argument parsing flaw (CVE-2026-59997)"
date = "2026-01-15"
cve = "CVE-2026-59997"
severity = "medium"
strings:
$sftp_marker = "internal-sftp" nocase
$sftp_start = "sftp-server" nocase
$arg_loop = "argc" nocase ascii
$arg_bound = "argv[9]" ascii
$chroot_flag = "-d" ascii
$umask_flag = "-u" ascii
$more_flags = "-m" ascii
condition:
(uint16(0) == 0x5A4D or uint32(0) == 0x464c457f) and
any of ($sftp*) and
any of ($arg_loop*) and any of ($arg_bound*) and
(any of ($chroot_flag*) or any of ($umask_flag*) or any of ($more_flags*))
}
Suricata IDS Rule
alert tcp any any -> $HOME_NET 22 (msg:"ET EXPLOIT OpenSSH internal-sftp Argument Truncation Chroot Bypass Attempt"; flow:established,to_server; content:"SSH-"; depth:4; content:"|00 00 00|"; dsize:>50; content:"SFTP"; nocase; content:"realpath"; nocase; distance:0; content:"/etc/"; nocase; within:20; classtype:attempted-user; sid:20265997; rev:1; metadata:cve CVE-2026-59997;)
Elastic Detection
// EQL query for Elastic Security
sequence by process.entity_id with maxspan=5m
[process where event.action == "exec" and process.name : "sshd" and process.args : "internal-sftp"]
[file where event.action in ("open", "read") and file.path : ("/etc/*", "/var/*", "/home/*") and not file.path : ("/home/*/sftp/*", "/var/sftp/*")]
Splunk SPL Query
index=linux sourcetype=sshd "SFTP" "realpath" "/"
| stats count by user src_ip host, _time
| where count > 10
| join type=inner user [search index=linux sourcetype=sshd "chroot" OR "session opened" | stats values(host) as chroot_servers by user]
Wazuh OSSEC Rule
<group name="openssh,">
<rule id="346643" level="10">
<decoded_as>sshd</decoded_as>
<match>sftp: realpath</match>
<regex>"/etc/|/var/|/root/|/bin/"</regex>
<description>CVE-2026-59997: SFTP chroot bypass - access to sensitive path detected</description>
<mitre>
<id>T1190</id>
</mitre>
<group>authentication_success,pci_dss_10.2.4,</group>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 2/4 — CLAIMED (a single source (OSV) references a patched version; not independently confirmed by the vendor advisory as of this report's date).
Immediate Mitigations (no patch deployed yet):
- Audit configuration: Review all
sshd_configfiles forSubsystem sftp internal-sftplines. Count the arguments. If more than 9 arguments (including theinternal-sftpbinary name) appear, identify which flags fall at positions 10+ and reorder so critical security flags (-d,-u,-m,-l) appear within the first 9 arguments. - Restrict access: Temporarily disable
Subsystem sftp internal-sftpand use the standalonesftp-serverbinary (e.g.,Subsystem sftp /usr/lib/openssh/sftp-server -d /chroot/%u) which does not suffer from this truncation flaw. - Enforce chroot at the OS level: If
internal-sftpis required, wrap the SFTP session in aChrootDirectorydirective (viaMatch group sftpblocks) to provide a second layer of confinement independent of argument parsing. - Monitor: Enable verbose logging (
LogLevel VERBOSE) and deploy an HIDS rule (e.g., the Wazuh rule above) to flag anomalous SFTP path access.
Patch/Upgrade Steps:
- Identify current version: Run
sshd -V(orssh -V) to check the OpenSSH version. If it is < 10.4, the server is vulnerable. - Upgrade: Install the latest OpenSSH package version that includes the fix (≥ 10.4). For most Linux distributions (Debian/Ubuntu:
sudo apt upgrade openssh-server; RHEL/CentOS/Fedora:sudo dnf update openssh-server; FreeBSD:pkg upgrade openssh-portable), the package manager will fetch the patched build. No package manager applies to OpenSSH as it is a system daemon, not a Perl/Ruby/Python/Go/Rust/Node.js package. - Verify the fix: After upgrading, re-run a configuration with 10+ arguments and confirm the 10th argument (e.g.,
-d /chroot) is now honored by creating a session and attemptingcd /— it should fail with "Permission denied" if the chroot is enforced. - Test: Restart sshd (
sudo systemctl restart sshd) and re-test SFTP for all user groups.
Long-Term Hardening:
- Adopt defense-in-depth: Always use
ChrootDirectoryin combination withinternal-sftp; never rely on a single flag for containment. - Standardize SFTP configuration templates with a maximum of 5–7 arguments to avoid hitting the truncation threshold.
- Implement file integrity monitoring (e.g., Wazuh FIM, Auditd) on sensitive directories to catch unauthorized file reads/writes.
- Subscribe to vendor security feeds (OpenSSH mailing list, CERT/CC) to receive early advisories before CVE publication.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2026-59997
- OSV Advisory (patch source): https://osv.dev/vulnerability/CVE-2026-59997
- OpenSSH Release Notes (version 10.4) — expected to reference the fix: https://www.openssh.com/releasenotes.html
- CISA Known Exploited Vulnerabilities Catalog (CVE-2026-59997 NOT listed — no in-the-wild exploitation evidence): https://www.cisa.gov/known-exploited-vulnerabilities-catalog
- MITRE ATT&CK Technique: T1190 — Exploit Public-Facing Application: https://attack.mitre.org/techniques/T1190/
Threat Actor Campaigns / Exploit-in-the-Wild: As of this report, CISA KEV indicates NO known exploitation in the wild. OSV lists a single claimed patch source; no public exploit code or Nuclei template exists. This is a high-complexity, low-RCE-value flaw limited to authenticated users and specific configurations, making it an unlikely target for automated campaigns; however, nation-state actors with SSH footholds could leverage it in targeted operations against hardened SFTP servers.
Report generated for Valters IT — Threat Intelligence Division. Distribution: TLP:CLEAR.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.