CVE-2026-108597
Path traversal (tar slip) in Cohere SDK allows arbitrary file write via malicious tar archives.
- CVSS 5.9
- CWE-22
- Input Validation and Sanitization
- Remote
Cohere Python SDK 5.11.0 through 7.2.0 contains a path traversal (tar slip) vulnerability in _s3_models_dir_to_tarfile that allows arbitrary file write via unvalidated tarfile.extractall calls. Attackers who can write model archives to the victim's S3 prefix can include absolute paths or ../ members to overwrite files on the SDK host.
- CWE
- CWE-22
- CVSS base score
- 5.9
- Published
- 2026-10-10
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Path Traversal
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Upgrade the Cohere Python SDK to 7.2.1 (or later), which patches the tar‑slip vulnerability in _s3_models_dir_to_tarfile.
Vulnerable code sample
import os
import tarfile
from typing import List
def _s3_models_dir_to_tarfile(model_dir: str, tar_path: str) -> None:
"""
Packages a local model directory into a tarfile and writes it to `tar_path`.
"""
with tarfile.open(tar_path, "w:gz") as tar:
# VULNERABLE: extracting without path sanitization can lead to tar slip
tar.add(model_dir, arcname=os.path.basename(model_dir))
# Later the SDK extracts the archive to a temporary location
with tarfile.open(tar_path, "r:gz") as tar:
tar.extractall(path="/tmp/model_extracted")Patched code sample
import os
import tarfile
from typing import List
def _s3_models_dir_to_tarfile(model_dir: str, tar_path: str) -> None:
"""
Packages a local model directory into a tarfile and writes it to `tar_path`.
"""
with tarfile.open(tar_path, "w:gz") as tar:
tar.add(model_dir, arcname=os.path.basename(model_dir))
# FIX: validate members to prevent path traversal
with tarfile.open(tar_path, "r:gz") as tar:
safe_members: List[tarfile.TarInfo] = []
for member in tar.getmembers():
member_path = os.path.normpath(member.name)
if not (member_path.startswith("..") or os.path.isabs(member_path)):
safe_members.append(member)
tar.extractall(path="/tmp/model_extracted", members=safe_members)Cite this entry
@misc{vaitp:cve2026108597,
title = {{Path traversal (tar slip) in Cohere SDK allows arbitrary file write via malicious tar archives.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-108597},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-108597/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
