| 제목 | NousResearch hermes-agent 0.16.0 Server-Side Request Forgery (CWE-918) |
|---|
| 설명 | # 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. |
|---|
| 원천 | ⚠️ https://gist.github.com/YLChen-007/7c71603a25d84f372f2275dd570e99d4 |
|---|
| 사용자 | Eric-y (UID 95889) |
|---|
| 제출 | 2026. 06. 12. AM 11:40 (2 개월 ago) |
|---|
| 모더레이션 | 2026. 08. 04. AM 09:35 (2 months later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 385784 [NousResearch hermes-agent 까지 0.16.0 xAI Image Generation Provider image_gen_provider.py save_url_image 권한 상승] |
|---|
| 포인트들 | 20 |
|---|