CVE-2024-5187 Arbitrary File Overwrite in download_model_with_test_data in onnx/onnx

High 8.8 Published Updated

Attackers can overwrite arbitrary files via path traversal in malicious tar archives, potentially leading to remote code execution or system compromise.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-5187?

CVE-2024-5187 is a high-severity path traversal vulnerability in onnx/onnx, published on 6 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

A vulnerability in the `download_model_with_test_data` function of the onnx/onnx framework, version 1.16.0, allows for arbitrary file overwrite due to inadequate prevention of path traversal attacks in malicious tar files. This vulnerability enables attackers to overwrite any file on the system, potentially leading to remote code execution, deletion of system, personal, or application files, thus impacting the integrity and availability of the system. The issue arises from the function's handling of tar file extraction without performing security checks on the paths within the tar file, as demonstrated by the ability to overwrite the `/home/kali/.ssh/authorized_keys` file by specifying an absolute path in the malicious tar file.

Weakness: CWE-22

Which versions are affected by CVE-2024-5187?

It affects 1 product.

Products include Linuxfoundation Onnx.

How do I fix CVE-2024-5187?

Apply the vendor's patch.

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

Is CVE-2024-5187 being exploited?

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

Sources

Also known as AZL-50635, DEBIAN-CVE-2024-5187, UBUNTU-CVE-2024-5187, USN-8307-1.

Is CVE-2024-5187 in your software?

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

Check your SBOMs for free