# CVE-2026-68770: sentence-transformers Arbitrary Code Execution on Local Model Load Despite trust_remote_code=False

> Attackers with local file write access can execute arbitrary code by placing malicious files in a model directory, bypassing the trust_remote_code=False security control.

- **Severity:** Critical 9.3 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 31 Jul 2026
- **Updated:** 8 Oct 2026
- **Also known as:** CLSA-2026-1790851862, ECHO-fe3d-8e4c-5919, GHSA-jhr6-gm9c-rqjv, PYSEC-2026-4164, ROOT-APP-PYPI-CVE-2026-68770

## What is CVE-2026-68770?

CVE-2026-68770 is a critical code injection vulnerability in Hugging Face sentence-transformers, published on 31 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

sentence-transformers contains a security control bypass vulnerability that allows attackers to achieve arbitrary code execution by exploiting a logic flaw in the import_module_class helper within sentence_transformers/util/misc.py, where the guard condition includes an 'or os.path.exists(model_name_or_path)' clause that satisfies the trust gate whenever the supplied path exists on the local filesystem, regardless of the trust_remote_code=False argument. Attackers who can control or influence the contents of a model directory on disk can place malicious Python files such as modeling_*.py referenced via modules.json, causing the code to execute at import time when an application loads the model with SentenceTransformer(path, trust_remote_code=False), bypassing the documented security contract and achieving code execution within the loading process.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2026-68770?

3 open source packages ship an affected version, including sentence-transformers.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sentence-transformers` | PyPI | All versions | 5.6.0 |
| `sentence-transformers` | PyPI | All versions | 5.6.0 |
| `sentence-transformers` | PyPI | All versions | 5.6.0 |

## How do I fix CVE-2026-68770?

Upgrade sentence-transformers to 5.6.0 or later.

## Is CVE-2026-68770 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-68770 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-68770 and fix it if it is affected.

What it is: CVE-2026-68770 is a critical code injection vulnerability in Hugging Face sentence-transformers, published on 31 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-68770 exists.

Affected packages and fixed versions:
- sentence-transformers (PyPI): affected all versions; fixed in 5.6.0
- sentence-transformers (PyPI): affected all versions; fixed in 5.6.0
- sentence-transformers (PyPI): affected all versions; fixed in 5.6.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-68770/ (Markdown: https://insights.sbomify.com/CVE-2026-68770/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-68770
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-68770
- OSV: https://osv.dev/vulnerability/CVE-2026-68770

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-68770/
Summaries are generated and may contain mistakes; the official description above is the record.
