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

Critical 9.3 Published Updated

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.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

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

Which versions are affected by CVE-2026-68770?

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

PackageAffectedFixed in
sentence-transformers PyPIAll versions5.6.0
sentence-transformers PyPIAll versions5.6.0
sentence-transformers PyPIAll versions5.6.0

How do I fix CVE-2026-68770?

Upgrade sentence-transformers to 5.6.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-68770 being exploited?

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

Sources

Also known as CLSA-2026-1790851862, ECHO-fe3d-8e4c-5919, GHSA-jhr6-gm9c-rqjv, PYSEC-2026-4164, ROOT-APP-PYPI-CVE-2026-68770.

Is CVE-2026-68770 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free