Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-109152 Overview
CVE-2026-109152 is a path traversal vulnerability [CWE-22] in the jbardin/scp.py Python library, affecting versions up to and including 0.16.1. The flaw resides in the _recv_file and _recv_pushd functions of the SCP Receive Handler component. A malicious or compromised SCP server can supply crafted file paths that cause the client to write files outside the intended local directory. Exploitation requires user interaction, such as initiating an SCP download from an attacker-controlled server. The maintainer released a fix in version 0.16.2 with commit 42fc3aaa71411daed60544e3b40179c1038bed5d.
Critical Impact
A remote SCP server can write files to arbitrary locations on the client file system, enabling unauthorized file overwrite and potential follow-on code execution through placement of files in sensitive directories.
Affected Products
- jbardin/scp.py versions up to 0.16.1
- Python applications and automation tooling depending on scp.py for SCP transfers
- Downstream libraries bundling scp.py as a dependency
Discovery Timeline
- 2026-10-13 - CVE-2026-109152 published to the National Vulnerability Database (NVD)
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-109152
Vulnerability Analysis
The vulnerability exists in how scp.py processes file paths received from a remote SCP server during a receive operation. The SCP protocol allows the server to specify filenames for each transferred file. The client is expected to constrain writes to the user-specified local destination directory. The affected code did not resolve the destination directory to its canonical absolute path before combining it with server-supplied names. As a result, a server returning names containing .. sequences or absolute-style components could escape the download directory.
Because the attack requires a user to initiate an SCP receive against a hostile or compromised server, exploitation is interaction-dependent. Impact is limited to integrity and availability of files writable by the client process, with no direct confidentiality loss within the scp.py scope.
Root Cause
The root cause is improper limitation of a pathname to a restricted directory [CWE-22]. The _recv_dir attribute was assigned directly from local_path or the current working directory without canonicalization. Subsequent join operations with server-controlled filenames therefore accepted traversal sequences and resolved outside the intended destination.
Attack Vector
Exploitation requires a victim to connect to an attacker-controlled or compromised SSH/SCP server using an application built on scp.py. During a get() or recursive receive operation, the server returns filenames containing path traversal sequences. The client writes the file contents to the resolved location on the local filesystem, which may lie outside the chosen download directory.
# Security patch in scp.py - canonicalize the receive directory
# Source: https://github.com/jbardin/scp.py/commit/42fc3aaa71411daed60544e3b40179c1038bed5d
else:
remote_path = list(remote_path)
remote_path = [self.sanitize(asbytes(r)) for r in remote_path]
- self._recv_dir = local_path or os.getcwd()
+ self._recv_dir = os.path.realpath(local_path or os.getcwd())
self._depth = 0
self._rename = (len(remote_path) == 1 and
not os.path.isdir(os.path.abspath(local_path)))
The fix wraps the destination in os.path.realpath(), resolving symlinks and relative components so later boundary checks operate on a canonical path.
Detection Methods for CVE-2026-109152
Indicators of Compromise
- Files written outside the intended SCP download directory following a scp.py client session
- Unexpected modification of configuration files such as ~/.ssh/authorized_keys, ~/.bashrc, or cron paths after SCP operations
- SSH client sessions to untrusted or newly observed SCP endpoints initiated by automation using scp.py
Detection Strategies
- Inventory Python environments and container images for installed versions of scp.py below 0.16.2 using pip list or software composition analysis tooling
- Monitor file create and write events generated by Python processes immediately following outbound SSH connections on port 22
- Correlate process lineage where a python process spawning SCP traffic writes to paths outside the invoking user's working directory
Monitoring Recommendations
- Enable filesystem auditing on sensitive directories including ~/.ssh/, shell startup files, and system configuration paths
- Log and review outbound SSH connections from workstations and CI/CD runners that execute scp.py-based automation
- Alert on unusual filename patterns containing .. or absolute path components returned over SCP sessions where protocol inspection is feasible
How to Mitigate CVE-2026-109152
Immediate Actions Required
- Upgrade scp.py to version 0.16.2 or later across all Python environments, container images, and CI/CD pipelines
- Rebuild and redeploy applications that bundle scp.py to ensure the patched release is loaded at runtime
- Audit recent SCP download destinations for files written outside expected directories
Patch Information
The fix is published as jbardin/scp.py release v0.16.2 and corresponds to commit 42fc3aaa. Additional context is available in GitHub Issue #206 and the VulDB entry for CVE-2026-109152.
Workarounds
- Restrict scp.py operations to known, trusted SSH servers through strict host key verification and network allowlisting
- Run SCP automation under a least-privilege account that cannot write to sensitive user or system paths
- Validate server-supplied filenames in calling code by rejecting entries containing .. segments or absolute path prefixes before invoking scp.py
# Upgrade to the patched release
pip install --upgrade 'scp>=0.16.2'
# Verify the installed version
python -c "import scp; print(scp.__version__)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

