Skip to content
Path traversal Disclosed report Intermediate CVE-2024-5187

onnx allows Arbitrary File Overwrite in download_model_with_test_data

The download_model_with_test_data function in onnx extracted tar files without checking paths, allowing a malicious tar to overwrite arbitrary files. An attacker could overwrite files such as SSH authorised_keys, potentially leading to remote code execution or data loss.

onnx/onnx

Originally disclosed on huntr

A vulnerability in the download_model_with_test_data function of the onnx/onnx framework, versions before 1.16.2, allow 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.

From the GitHub Advisory Database (GHSA-6rq9-53c3-f7vj, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The tar extraction routine did not validate or sanitise entry paths, so absolute paths and path traversal sequences were honoured.

Impact

An attacker could overwrite any file on the system, potentially leading to remote code execution or deletion of system, personal, or application files, affecting integrity and availability.

What the attacker needed

Ability to supply a malicious tar file; victim runs download_model_with_test_data

The fix

The issue was fixed in version 1.16.2 by adding security checks on paths within tar files before extraction.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a program unpacks a tar archive, it should only write files inside the intended folder. Here it did not check the file paths, so a crafted archive could write anywhere on the disk, including sensitive files that control who can log in.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from onnx/onnx

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.