sentence-transformers local model loading bypasses trust_remote_code and executes custom PythonGHSA-jhr6-gm9c-rqjv
CRITICALFix: huggingface/sentence-transformers#3807GHSA-jhr6-gm9c-rqjv is a critical-severity (CVSS 9.8) Code Injection vulnerability in sentence-transformers. A fix is available for sentence-transformers — see the affected versions and patch details below.
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for GHSA-jhr6-gm9c-rqjv.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-jhr6-gm9c-rqjv by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
sentence-transformersReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | sentence-transformers | all versions | 5.6.0pip install --upgrade 'sentence-transformers==5.6.0' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for sentence-transformers, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update sentence-transformers to 5.6.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-jhr6-gm9c-rqjv is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
A remote code execution vulnerability was found in the sentence-transformers library. The import_module_class() function bypasses the trust_remote_code=False security check when loading models from a local file path. If a model's modules.json references a class outside the sentence_transformers.* namespace, arbitrary…
Red Hat has investigated whether a possible mitigation exists for this issue, and has not been able to identify a practical example. Please update the affected package as soon as possible. Note: sentence-transformers 5.6.0 does NOT fix this vulnerability (it only adds a deprecation warning). The fix is planned for version 6.0.Source: Red Hat security advisory for GHSA-jhr6-gm9c-rqjv (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift AI 2.25 | rhoai/odh-caikit-nlp-rhel9:1791448212 | RHSA-2026:87410 |
| Red Hat OpenShift AI 3.3 | rhoai/odh-trustyai-nemo-guardrails-server-rhel9:1789570674 | RHSA-2026:73987 |
| Red Hat OpenShift AI 3.4 | rhoai/odh-trustyai-nemo-guardrails-server-rhel9:1791556128 | RHSA-2026:84734 |
Frequently Asked Questions
Is GHSA-jhr6-gm9c-rqjv in your dependencies?
Find it across PyPI, including transitive dependencies.