CVE-2021-31800 Path traversal in impacket

Critical 9.8 Published Updated

Attackers can traverse directories to read or write arbitrary files, potentially achieving code execution by modifying system files like SSH keys.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-31800?

CVE-2021-31800 is a critical path traversal vulnerability in Fedoraproject Fedora, published on 5 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Multiple path traversal vulnerabilities exist in smbserver.py in Impacket through 0.9.22. An attacker that connects to a running smbserver instance can list and write to arbitrary files via ../ directory traversal. This could potentially be abused to achieve arbitrary code execution by replacing /etc/shadow or an SSH authorized key.

Weakness: CWE-22

Which versions are affected by CVE-2021-31800?

3 open source packages ship an affected version, including impacket. It affects 2 products.

PackageAffectedFixed in
impacket PyPIAll versions0.9.23
impacket PyPIAll versions0.9.23
impacket PyPIFrom 0.9.100.9.23
Linux distribution packages (1)
python-impacket openSUSE:TumbleweedAll versions0.11.0-3.3

Products include Fedoraproject Fedora, Secureauth Impacket.

How do I fix CVE-2021-31800?

Upgrade impacket to 0.9.23 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2021-31800 being exploited?

There is no known exploitation of CVE-2021-31800 in the wild and no public exploit code.

Public exploit code: 2 proofs of concept on GitHub.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as DEBIAN-CVE-2021-31800, GHSA-mj63-64x7-57xf, PYSEC-2021-17, UBUNTU-CVE-2021-31800, openSUSE-SU-2024:11232-1, openSUSE-SU-2024:14142-1.

Is CVE-2021-31800 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free