CVE-2026-68770
JSON

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 packageVersionsReported by
Hugging Face sentence-transformersup to 5.5.1CVE List
sentence-transformers (PyPI)before 5.6.0GitHub Advisory Database, PyPA Advisory Database

All scores

VulnCheck9.3critical CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
VulnCheck9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHubcritical CVSS:4.0CVSS: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 Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS: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

CWE-94

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

https://github.com/huggingface/sentence-transformers/issues/3801exploit, issue-tracking, web
https://github.com/huggingface/sentence-transformers/pull/3807patch, vendor-advisory, web
https://github.com/huggingface/sentence-transformerspackage, product
https://github.com/huggingface/sentence-transformers/commit/ae1acc3fb2aa2004577b297eb4a915ce7a03316apatch, web
https://www.vulncheck.com/advisories/sentence-transformers-arbitrary-code-execution-on-local-model-load-despite-trust-remote-code-falsethird-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2026-68770advisory
https://github.com/huggingface/sentence-transformers/pull/3935web
https://github.com/huggingface/sentence-transformers/commit/626eb602b088878a8173bcab69225f68411b99e1web
https://github.com/huggingface/sentence-transformers/releases/tag/v5.6.0web
https://github.com/huggingface/sentence-transformers/releases/tag/v6.0.0web
https://pypi.org/project/sentence-transformerspackage
https://github.com/advisories/GHSA-jhr6-gm9c-rqjvadvisory

Sources

SourceRecordLicence
CVE ListCVE-2026-68770 changed 2026-11-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-jhr6-gm9c-rqjv changed 2026-10-01CC-BY-4.0
NVDCVE-2026-68770 changed 2026-10-23Public domain
PyPA Advisory DatabasePYSEC-2026-4164 changed 2026-10-01CC-BY-4.0