CVE-2023-0591 Path Traversal in ubi_reader

Medium 5.5 Published Updated

Attackers can overwrite arbitrary files outside the extraction directory by crafting malicious UBIFS files processed by ubi_reader.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2023-0591?

CVE-2023-0591 is a medium-severity path traversal vulnerability in ubi_reader, published on 31 Jan 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

ubireader_extract_files is vulnerable to path traversal when run against specifically crafted UBIFS files, allowing the attacker to overwrite files outside of the extraction directory (provided the process has write access to that file or directory).

This is due to the fact that a node name (dent_node.name) is considered trusted and joined to the extraction directory path during processing, then the node content is written to that joined path. By crafting a malicious UBIFS file with node names holding path traversal payloads (e.g. ../../tmp/outside.txt), it's possible to force ubi_reader to write outside of the extraction directory.

This issue affects ubi-reader before 0.8.5.

Weakness: CWE-22

Which versions are affected by CVE-2023-0591?

3 open source packages ship an affected version, including ubi-reader. It affects 1 product.

PackageAffectedFixed in
ubi-reader PyPIAll versions0.8.5
ubi-reader PyPIAll versions0.8.5
ubi-reader PyPIAll versions0.8.5

Products include Ubi Reader Project Ubi Reader.

How do I fix CVE-2023-0591?

Upgrade ubi-reader to 0.8.5 or later.

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

Is CVE-2023-0591 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-0591 exists.

Sources

Also known as GHSA-vp2x-3mc3-3cj4, PYSEC-2023-51.

Is CVE-2023-0591 in your software?

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

Check your SBOMs for free