| Titel | NousResearch hermes-agent 0.16.0 Server-Side Request Forgery (CWE-918) |
|---|
| Beschreibung | # Technical Details
An SSRF vulnerability exists in the `save_url_image()` method in `agent/image_gen_provider.py` of hermes-agent.
The xAI image generation provider parses provider responses and, when `data[0].url` is present, passes that provider-controlled URL directly to `save_url_image()`. This function performs a raw `requests.get(url, timeout=timeout, stream=True)` without any URL safety validation, no call to `tools.url_safety.is_safe_url`, and no redirect-target revalidation. A malicious or compromised provider can cause the Hermes host to fetch attacker-chosen URLs.
# Vulnerable Code
File: agent/image_gen_provider.py
Method: save_url_image()
Why: The function calls `requests.get(url)` on a provider-controlled URL without any SSRF guard, URL allowlist check, or redirect-target revalidation. Unlike user-supplied URLs elsewhere in the codebase, this second-hop fetch skips all safety checks.
# Reproduction
1. Set up a localhost xAI-compatible stub service that returns `data[0].url` pointing at `/canary.png`.
2. Configure hermes-agent with `xai` as the image generation provider and `XAI_API_KEY` set to any non-empty value.
3. Call `image_generate` with a prompt.
4. Observe the stub logs show `provider_hits=1` and `canary_hits=1`, confirming the host-side fetch of the provider-controlled URL.
# Impact
- The Hermes host can be induced to request loopback services, internal HTTP endpoints, or cloud metadata resources.
- Unauthorized disclosure of internal network information reachable from the Hermes process.
- Bypasses the existing URL safety infrastructure used elsewhere in the codebase. |
|---|
| Quelle | ⚠️ https://gist.github.com/YLChen-007/7c71603a25d84f372f2275dd570e99d4 |
|---|
| Benutzer | Eric-y (UID 95889) |
|---|
| Einreichung | 12.06.2026 11:40 (vor 2 Monaten) |
|---|
| Moderieren | 04.08.2026 09:35 (2 months later) |
|---|
| Status | Akzeptiert |
|---|
| VulDB Eintrag | 385784 [NousResearch hermes-agent bis 0.16.0 xAI Image Generation Provider image_gen_provider.py save_url_image erweiterte Rechte] |
|---|
| Punkte | 20 |
|---|