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

CVE-2026-102566: CTranslate2 Buffer Overflow Vulnerability

CVE-2026-102566 is a heap-based buffer overflow in CTranslate2 that allows attackers to execute arbitrary code through malicious model files. This post covers technical details, 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-102566 Overview

CVE-2026-102566 is a heap-based buffer overflow [CWE-787] in CTranslate2 versions prior to 4.8.1. The binary model loader fails to validate the payload length field against the allocated buffer size. Attackers can craft a malicious model.bin file with an oversized payload length to write past heap allocation boundaries. Exploitation can trigger process crashes or arbitrary code execution in applications that load untrusted model files.

CTranslate2 is a widely used inference engine for Transformer models, commonly embedded in machine translation and large language model (LLM) pipelines.

Critical Impact

Loading an attacker-controlled CTranslate2 model file can corrupt heap memory and lead to arbitrary code execution in the host process.

Affected Products

  • OpenNMT CTranslate2 versions before 4.8.1
  • Applications embedding CTranslate2 for Transformer model inference
  • Machine translation and LLM pipelines that load third-party model.bin artifacts

Discovery Timeline

  • 2026-09-29 - CVE-2026-102566 published to the National Vulnerability Database (NVD)
  • 2026-09-30 - Last updated in NVD database

Technical Details for CVE-2026-102566

Vulnerability Analysis

The vulnerability resides in the binary model deserialization path in src/models/model.cc. When CTranslate2 loads a model, it reads a length-prefixed string from the binary stream. The loader consumes a uint16_t length value and then reads that many bytes into a heap-allocated buffer. The pre-patch code passed the raw pointer to the std::string constructor without bounding the copy to the declared length. When the declared length was 0, the underlying read produced an unusable buffer and the string constructor scanned past the allocation looking for a null terminator, producing an out-of-bounds heap read and subsequent memory corruption.

Because CTranslate2 is embedded inside inference services, a poisoned model file distributed through a model hub or supplied by an untrusted user can compromise the process that loads it.

Root Cause

The root cause is missing input validation on the deserialized str_length field and unsafe construction of a std::string from an unterminated byte buffer. The loader did not reject zero-length strings and did not constrain the string constructor to the declared payload size, allowing a crafted length value to drive an out-of-bounds access on the heap.

Attack Vector

Exploitation requires the victim to load an attacker-supplied CTranslate2 binary model. The typical delivery path is a malicious model.bin uploaded to a public model repository, shared through supply-chain channels, or passed to a hosted inference endpoint that accepts user-provided models. No network authentication is required; user interaction (loading the model) is the trigger.

text
     template<>
     std::string consume(std::istream& in) {
       const auto str_length = consume<uint16_t>(in);
+      if (str_length == 0)
+        throw std::runtime_error("Invalid string length in " + binary_file);
       const auto c_str = consume<char>(in, str_length);
-      std::string str(c_str);
+      std::string str(c_str, str_length - 1);
       delete [] c_str;
       return str;
     }
// Source: [CTranslate2 commit d9b991e](https://github.com/OpenNMT/CTranslate2/commit/d9b991e0700933a0c05373df8b52ed89cdcab96d)
// The patch rejects zero-length strings and bounds the std::string constructor to the declared payload size.

Detection Methods for CVE-2026-102566

Indicators of Compromise

  • Unexpected crashes, SIGSEGV, or glibc heap corruption messages from processes that call CTranslate2 inference APIs
  • Presence of model.bin files from untrusted sources with anomalous string length headers
  • Inference workers restarting immediately after loading a newly introduced model artifact

Detection Strategies

  • Inventory all services that link against CTranslate2 and record the library version in use
  • Run vulnerable loaders under AddressSanitizer (ASan) in staging to surface heap out-of-bounds writes when parsing candidate model files
  • Hash and allowlist trusted model.bin artifacts, and alert on load attempts of files outside the allowlist

Monitoring Recommendations

  • Monitor process telemetry for abnormal termination of Python or C++ inference workers loading CTranslate2 models
  • Log every model file path, source, and SHA-256 hash at load time to enable retrospective hunting
  • Track outbound connections initiated by inference processes immediately after model load to identify post-exploitation callbacks

How to Mitigate CVE-2026-102566

Immediate Actions Required

  • Upgrade CTranslate2 to version 4.8.1 or later across all inference hosts and container images
  • Rebuild and redeploy downstream applications that statically link or vendor CTranslate2
  • Restrict model loading to files retrieved from vetted, integrity-verified sources

Patch Information

The fix is delivered in CTranslate2 release v4.8.1 via pull request #2068 and commit d9b991e. The patched consume<std::string> function rejects zero-length strings and constructs the resulting std::string with an explicit length bound. See the VulnCheck advisory for additional context.

Workarounds

  • Load only model files produced in-house or downloaded from cryptographically verified publishers
  • Sandbox inference processes with seccomp, AppArmor, or containerized least-privilege profiles to constrain post-exploitation impact
  • Reject model.bin files that fail a schema validation pass performed by a hardened parser before handing them to CTranslate2
bash
# Upgrade CTranslate2 to the patched release
pip install --upgrade 'ctranslate2>=4.8.1'

# Verify the installed version
python -c "import ctranslate2; print(ctranslate2.__version__)"

# Enforce integrity on model artifacts before loading
sha256sum -c model.bin.sha256

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.