9.3critical
sentence-transformers Arbitrary Code Execution on Local Model Load Despite trust_remote_code=False
- Severity
- 9.3critical CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.65% (higher than 52% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-jhr6-gm9c-rqjvPYSEC-2026-4164
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
| Product or package | Versions | Reported by |
|---|---|---|
| Hugging Face sentence-transformers | up to 5.5.1 | CVE List |
| sentence-transformers (PyPI) | before 5.6.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| VulnCheck | 9.3critical CVSS:4.0 | 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 |
| VulnCheck | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | critical CVSS:4.0 | 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 |
| PyPA Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| PyPA Advisory Database | Not scored CVSS:4.0 | 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 |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.
What each source says
CVE List
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.
NVD (es)
sentence-transformers contiene una vulnerabilidad de omisión de control de seguridad que permite a los atacantes lograr ejecución de código arbitrario al explotar un fallo lógico en la función auxiliar import_module_class dentro de sentence_transformers/util/misc.py, donde la condición de guardia incluye una cláusula ’or os.path.exists(model_name_or_path)’ que satisface la puerta de confianza siempre que la ruta proporcionada existe en el sistema de archivos local, independientemente del argumento trust_remote_code=False. Los atacantes que pueden controlar o influir en el contenido de un directorio de modelo en disco pueden colocar archivos Python maliciosos como modeling_*.py referenciados a través de modules.json, haciendo que el código se ejecute en el momento de la importación cuando una aplicación carga el modelo con SentenceTransformer(path, trust_remote_code=False), omitiendo el contrato de seguridad documentado y logrando la ejecución de código dentro del proceso de carga.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-68770 changed 2026-11-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-jhr6-gm9c-rqjv changed 2026-10-01 | CC-BY-4.0 |
| NVD | CVE-2026-68770 changed 2026-10-23 | Public domain |
| PyPA Advisory Database | PYSEC-2026-4164 changed 2026-10-01 | CC-BY-4.0 |