/

CVE-2026-43637

Severity:

CRITICAL RISK

(9.1)

Path Traversal (CWE-22) in Cornac Dataset Archive Loader

CVE-2026-43637

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Cornac before 2.6.0 is vulnerable to a path traversal (Tar Slip) issue in its dataset archive extraction logic, allowing crafted TAR files to write outside the intended cache directory.

When an attacker can influence the TAR archive consumed by Cornac's automatic dataset loaders, arbitrary files may be written anywhere on the filesystem reachable by the running process.

Affected context

This vulnerability appears in environments where Cornac's dataset loading utilities automatically download and extract TAR archives to a cache directory.

It is relevant when archives are fetched from external sources, user-provided locations, or any endpoint that an attacker can control or tamper with.

The risk increases on systems where the Cornac process runs with elevated or broad filesystem permissions, as unintended file writes can affect sensitive paths.

Exploit preconditions

  • Attack surface: Archive extraction via Cornac's built-in dataset loaders (_extract_archive()).
  • Required access: Ability to supply or modify TAR archives consumed by Cornac (e.g., control over the dataset source, man-in-the-middle of downloads, or poisoned mirrors).
  • Trigger point: Invocation of the automatic download-and-extract flow, which calls archive.extractall() on the crafted TAR.
  • Why exploitation is possible: The extraction logic does not validate or sanitize file paths inside the archive, allowing ../ components, absolute paths, symlinks, and hardlinks to escape the cache directory.

Why this happens

The underlying bug is an unsafe file extraction pattern that trusts filenames embedded in an archive without normalizing or constraining them.

In Cornac, _extract_archive() in cornac/utils/download.py relies on archive.extractall() directly, which will honor any path entries the TAR provides, including traversal sequences and links.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because user-controlled or external archive contents are allowed to dictate where files are written on the filesystem instead of being confined to a designated cache directory.

Potential impact

  • Arbitrary files may be written to locations outside the intended cache directory.
  • Attackers could plant malicious scripts or configuration files that may later be executed or loaded by other components.
  • Application behavior can be altered through overwritten configuration or data files.
  • In some deployments, this could facilitate privilege escalation or system compromise if sensitive paths (e.g., cron, service units, libraries) are writable.

General mitigation guidance

Effective mitigation focuses on constraining archive extraction to trusted directories and validating archive contents before writing any files.

Common defensive patterns include:

  • Normalizing and checking each entry's path to ensure it remains within a configured base directory, rejecting entries containing .., absolute paths, or unexpected link targets.
  • Implementing a whitelist-based extraction routine that reconstructs safe paths rather than using generic extractall() on untrusted archives.
  • Running processes that handle external archives with least-privilege filesystem permissions to limit the impact of any misuse.
  • Treating all externally sourced datasets as untrusted and applying layered validation and sandboxing around file handling operations.

How teams detect issues like this

Detection typically involves reviewing archive-handling code for direct use of broad extraction APIs such as extractall() without path validation.

Static analysis rules can flag calls where TAR or ZIP contents are written to disk based on user-controlled or network-sourced archives.

During code review, engineers should look for:

  • Absence of normalization and boundary checks on extracted file paths.
  • Use of symlink or hardlink entries in archives without explicit validation.
  • Dataset download flows that implicitly trust external sources and immediately extract their contents.

Security policies and automated tooling can enforce safer archive-handling patterns by requiring explicit checks for traversal sequences and absolute paths.

Sources

SourceLink
github.comgithub.com/PreferredAI/cornac/commit/8a50be72c11569b6747c6b96d6e31a0a1962f1a8
github.comgithub.com/PreferredAI/cornac/pull/709
github.comgithub.com/PreferredAI/cornac/releases/tag/v2.6.0
vulncheck.comvulncheck.com/advisories/cornac-path-traversal-via-extract-archive-in-download-py

Frequently asked

questions

Exploitability depends on whether an attacker can control or tamper with the TAR archives consumed by Cornac's dataset loaders. In environments where datasets are pulled from third-party or user-controlled sources, the risk is significantly higher.

An attacker needs influence over the archive input, such as providing a malicious dataset TAR, compromising a download endpoint, or altering files in a shared cache location. They do not need direct code execution privileges within the application itself.

The safest fix is to enforce strict path validation on archive entries before extraction, ensuring every file path is normalized and confined to a designated directory. Avoid generic extractall() on untrusted archives and remove support for unsafe constructs like traversal sequences and unrestricted symlinks.

Adopt secure file-handling patterns as a standard, including treating all external archives as untrusted, running extraction in low-privilege contexts, and using utility functions that validate paths against a base directory. Incorporate static analysis and security-focused code reviews to catch unsafe archive extraction logic early in development.

Find out what's already
exploitable in your codebase.