Skip to main content
EPSS 0.6%top 51%

CVE-2026-68770: Improper Control of Generation of Code ('Code Injection') in Hugging Face sentence-transformers

0
Critical
Published: 07/31/2026 (07/31/2026, 20:56:06 UTC)
Source: CVE Database V5
Vendor/Project: Hugging Face
Product: sentence-transformers

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.

CVSS v4.0

Score 9.3critical

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vuln. Confidentiality
High
Vuln. Integrity
High
Vuln. Availability
High
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
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

Affected software

Hugging Face

sentence-transformers

Affected versions
>=0 <=5.5.1
sentence-transformers
pkg:pypi/sentence-transformers
Affected versions
*

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/16/2026, 13:43:29 UTC

Technical Analysis

CVE-2026-68770 is a critical security control bypass vulnerability in the sentence-transformers library by Hugging Face. The vulnerability arises from a logic flaw in the import_module_class helper within sentence_transformers/util/misc.py. The guard condition improperly trusts any existing local path due to an 'or os.path.exists(model_name_or_path)' clause, ignoring the trust_remote_code=False argument. Consequently, attackers who can control or influence the contents of a model directory on disk can place malicious Python files (e.g., modeling_*.py referenced via modules.json). These files execute at import time when the application loads the model with SentenceTransformer(path, trust_remote_code=False), leading to arbitrary code execution and bypassing the documented security contract.

Potential Impact

An attacker able to control or influence the contents of a model directory on disk can achieve arbitrary code execution within the context of the application loading the model. This bypasses the trust_remote_code=False security setting, potentially allowing full compromise of the host running the vulnerable sentence-transformers library.

Mitigation Recommendations

Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid loading models from untrusted or user-controlled directories. Do not rely solely on the trust_remote_code=False argument to prevent code execution from local model paths.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
VulnCheck
Date Reserved
2026-07-31T16:10:55.448Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 6a6d131bbf32cb7a3452db5b

Added to database: 07/31/2026, 21:26:51 UTC

Last enriched: 08/16/2026, 13:43:29 UTC

Last updated: 09/14/2026, 10:01:32 UTC

Views: 104

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses