Horizon Alert
Summary of the vulnerability and why it matters
This advisory details a critical security control bypass vulnerability in the sentence-transformers library. The flaw allows attackers to execute arbitrary code by manipulating local model files, even when remote code execution is intended to be disabled. This bypasses intended security measures and could lead to code execution during the model loading process.
- Local code execution flaw found in a data processing library.
- Critical flaw bypasses security when loading models.
- Confirm relevance and exposure of local model loading.
Attack Path
How an attacker could exploit the issue
An attacker can trick an application into running malicious code by manipulating local files. This occurs when an application loads a SentenceTransformer model from a controlled directory, even when configured to avoid remote code execution. The flaw bypasses a security check if the model path exists locally, allowing the attacker's code to run during the import process.
- Attacker influences local model directory contents.
- Application loads model with `trust_remote_code=False`.
- Arbitrary code execution is achieved.
Live Threat
Current exploitation, exposure, and threat context
When an application loads a model using the SentenceTransformer library with `trust_remote_code=False`, a logic flaw in the `import_module_class` helper can be exploited. This occurs when an attacker can influence the contents of a local model directory, allowing them to place malicious Python files that execute at import time, bypassing security checks.
- Local model files could be compromised.
- Malicious code executes during model import.
- Arbitrary code execution may occur.
Operational Fix
Recommended remediation, mitigation, and detection steps
Application owners responsible for code that loads models using the `sentence-transformers` library should investigate. The first practical step is to identify all instances where this library is used, confirm whether the affected function is reachable or handles business-critical data, and then coordinate with development and security teams to plan remediation based on assessed risk.
- Application owners must identify usage.
- Verify critical data paths.
- Plan remediation based on risk.