Skip to main content
Vulnerability Database/CVE-2026-108597

CVE-2026-108597: Cohere Python SDK Path Traversal Vulnerability

CVE-2026-108597 is a path traversal flaw in Cohere Python SDK versions 5.11.0 through 7.2.0 that enables arbitrary file writes through malicious tar archives. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-108597 Overview

CVE-2026-108597 is a path traversal vulnerability [CWE-22] in the Cohere Python SDK affecting versions 5.11.0 through 7.2.0. The flaw resides in the _s3_models_dir_to_tarfile function, which calls tarfile.extractall without validating archive member paths. An attacker who can write model archives to the victim's Amazon S3 prefix can craft tar entries containing absolute paths or ../ traversal sequences. When the SDK extracts these archives on the host, arbitrary files are overwritten outside the intended extraction directory. This classic "tar slip" pattern enables arbitrary file write on any machine running the vulnerable SageMaker integration code path.

Critical Impact

Attackers with write access to the SDK user's S3 model prefix can overwrite arbitrary files on the host, leading to configuration tampering, credential replacement, or code execution via planted scripts.

Affected Products

  • Cohere Python SDK version 5.11.0
  • Cohere Python SDK versions between 5.11.0 and 7.2.0
  • Cohere Python SDK version 7.2.0

Discovery Timeline

  • 2026-10-10 - CVE-2026-108597 published to NVD
  • 2026-10-16 - Last updated in NVD database

Technical Details for CVE-2026-108597

Vulnerability Analysis

The Cohere Python SDK provides a SageMaker integration that downloads model artifacts from S3 and extracts them locally. The _s3_models_dir_to_tarfile helper in src/cohere/manually_maintained/cohere_aws/client.py constructs a tarfile from objects pulled from the S3 prefix and extracts it using tarfile.extractall. The SDK does not validate member names before extraction. Python's tarfile module honors absolute paths and parent-directory references embedded in archive entries by default. An attacker uploading a crafted model archive to the victim's S3 bucket controls both the file names and content written to disk during extraction.

Root Cause

The root cause is unsanitized use of tarfile.extractall on attacker-influenced archive data. The function does not apply the filter='data' extraction filter introduced in Python 3.12, nor does it enforce path normalization checks against the target directory. Any tar member containing .. segments or an absolute path such as /home/user/.ssh/authorized_keys is written verbatim, bypassing the intended extraction boundary.

Attack Vector

Exploitation requires that the attacker can write to the S3 prefix consumed by the SDK. This typically occurs in multi-tenant pipelines, shared training buckets, or environments where S3 permissions are overly permissive. The attacker uploads a malicious tar archive containing entries whose names traverse outside the extraction root. When the victim invokes the SageMaker helper that pulls and unpacks the archive, the SDK writes attacker-controlled files to arbitrary locations on the host filesystem. Overwriting shell profiles, cron jobs, SSH keys, or Python site-packages modules provides a path to code execution under the SDK user's privileges.

The vulnerability manifests in the _s3_models_dir_to_tarfile function. See the VulnCheck Security Advisory and the Cohere Python Client Code Snippet for technical details.

Detection Methods for CVE-2026-108597

Indicators of Compromise

  • Unexpected files appearing outside the designated model extraction directory on hosts running the Cohere SDK SageMaker workflow.
  • Modifications to sensitive paths such as ~/.ssh/authorized_keys, ~/.bashrc, cron directories, or Python site-packages shortly after an S3 model pull.
  • S3 access logs showing PutObject operations into model prefixes from unexpected principals or IAM roles.
  • Tar archives in S3 model prefixes containing members with .. sequences or absolute path names.

Detection Strategies

  • Inventory Python environments and identify any installation of cohere package versions 5.11.0 through 7.2.0 using pip list or SBOM tooling.
  • Statically scan code for calls to _s3_models_dir_to_tarfile or direct tarfile.extractall usage without a path-validating filter.
  • Enable S3 server access logging and CloudTrail data events on buckets that feed the SDK, and alert on writes from unexpected identities.

Monitoring Recommendations

  • Monitor file integrity on hosts that run SageMaker integration code, focusing on user home directories and system configuration paths.
  • Audit IAM policies granting s3:PutObject on model prefixes and remove unused or overly broad grants.
  • Alert on process executions spawned from recently extracted model directories that touch locations outside the extraction root.

How to Mitigate CVE-2026-108597

Immediate Actions Required

  • Upgrade the Cohere Python SDK to a version released after 7.2.0 that validates tar member paths before extraction.
  • Restrict s3:PutObject permissions on model prefixes to a minimal, audited set of principals.
  • Run SDK processes under a dedicated low-privilege user account to limit the blast radius of arbitrary file writes.
  • Review existing model archives in S3 prefixes for malicious tar members prior to re-running pipelines.

Patch Information

Refer to the Cohere AI GitHub Repository for the latest release that addresses the path traversal in _s3_models_dir_to_tarfile. The VulnCheck Security Advisory tracks fixed versions and remediation guidance.

Workarounds

  • Pin the SDK to a version outside the vulnerable 5.11.0 through 7.2.0 range once a patched release is available.
  • Wrap or monkey-patch the SageMaker helper to apply Python's tarfiledata extraction filter, which rejects absolute paths and parent-directory traversal.
  • Pre-validate downloaded archives by listing members and rejecting any entry whose resolved path escapes the intended extraction directory.
  • Isolate SDK execution inside a container or chroot so arbitrary file writes cannot affect host configuration or persistent credentials.
bash
# Configuration example
# Pre-extraction validation helper to reject unsafe tar members
python - <<'PY'
import tarfile, os, sys
archive, dest = sys.argv[1], os.path.abspath(sys.argv[2])
with tarfile.open(archive) as tf:
    for m in tf.getmembers():
        target = os.path.abspath(os.path.join(dest, m.name))
        if not target.startswith(dest + os.sep):
            raise SystemExit(f"unsafe member: {m.name}")
    tf.extractall(dest, filter='data')
PY

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.