CVE-2021-31800: Path Traversal Vulnerabilities in Impacket
Summary
CVE-2021-31800: Multiple path traversal vulnerabilities exist in smbserver.py in Impacket through 0.9.22. Affects impacket across 2 version ranges.
>= 0.9.10, < 0.9.23
< 49c643bf66620646884ed141c94e5fdd85bcdd2f
Fixed in 49c643bf66620646884ed141c94e5fdd85bcdd2f. How to fix ↓
Also tracked for
- impacket · Debian:11
The same CVE-2021-31800 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Impacket is a Python library that provides a set of tools for working with network protocols. It is commonly used for network security testing, penetration testing, and forensic investigations. The library allows users to interact with various protocols, including SMB, LDAP, MSRPC, and more. However, versions of Impacket up to 0.9.22 are vulnerable to multiple path traversal vulnerabilities in the smbserver.py module.
Vulnerability Detail
The path traversal vulnerabilities in Impacket's smbserver.py module allow an attacker who connects to a running smbserver instance to list and write to arbitrary files using directory traversal techniques. By exploiting these vulnerabilities, an attacker could potentially achieve arbitrary code execution by replacing critical system files such as /etc/shadow or SSH authorized keys. This could lead to unauthorized access, privilege escalation, and compromise of the affected system.
How To Fix
Latest published version: 0.13.1 as of 23 Oct 2026
pip install --upgrade "impacket==0.13.1"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
49c643bf66620646884ed141c94e5fdd85bcdd2f
This is the first release that contains the fix.
pip install --upgrade "impacket==49c643bf66620646884ed141c94e5fdd85bcdd2f"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Conclusion
The path traversal vulnerabilities in Impacket's smbserver.py module pose a significant security risk, allowing attackers to list and write to arbitrary files on the affected system. To mitigate this risk, it is crucial to upgrade Impacket to version 0.9.23 or later. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for impacket →
FAQ
Impacket is a Python library that provides a set of tools for working with network protocols. It is commonly used for network security testing, penetration testing, and forensic investigations.
These vulnerabilities allow an attacker to list and write to arbitrary files on the affected system. By replacing critical system files, an attacker could achieve arbitrary code execution, leading to unauthorized access and compromise of the system.
You can use the Vulert Playground at Vulert Scanner to check if your Impacket installation is affected by this vulnerability. Simply provide your Pipfile.lock file, and Vulert will analyze it for any open-source vulnerabilities, including CVE-2021-31800.
At the moment, there are no known workarounds for these vulnerabilities. It is recommended to upgrade Impacket to the latest version as soon as possible.
You can find more information about this vulnerability in the Impacket advisory database at https://github.com/pypa/advisory-database/blob/main/vulns/impacket/PYSEC-2021-17.yaml
References
Related vulnerabilities
Recent vulnerabilities recorded for impacket.