SSRF Vulnerability in utcp-http via Unvalidated Redirects
The utcp-http library performs security validation on the initial URL but fails to re-validate the target during HTTP redirects, enabling SSRF attacks to reach internal services or cloud metadata endpoints.
The utcp-http library (and its TypeScript counterpart @utcp/http) contains a Server-Side Request Forgery (SSRF) vulnerability due to improper handling of HTTP redirects during tool invocation. The library's HttpCommunicationProtocol.call_tool method validates the initial tool URL against a security policy before execution. However, the subsequent request is performed with aiohttp's default allow_redirects=True setting without re-validating the target of any 3xx redirect responses.
An attacker controlling the registered tool endpoint can provide a redirect to internal network services, such as the IMDSv1 cloud metadata service (e.g., 169.254.169.254) or internal administrative panels. Because the library does not inspect the Location header or re-run the ensure_secure_url check on follow-up requests, it inadvertently bypasses intended network segmentation controls. This vulnerability, which effectively functions as an SSRF-to-exfiltration primitive, is particularly impactful in cloud environments where it can lead to the theft of IAM credentials. The issue was addressed in version 1.1.4 by implementing per-hop revalidation of redirect targets.
Attack Chain
- The attacker registers a tool or manual endpoint in the UTCP-enabled application using an attacker-controlled URL that passes initial security checks (e.g., any
https://endpoint). - The application's
call_toolmethod validates the provided attacker-controlled URL and confirms it satisfies theensure_secure_urlpolicy. - The
utcp-httplibrary initiates aGETrequest to the attacker's server. - The attacker's server responds with an HTTP
302 Foundstatus code and aLocationheader pointing to an internal-only resource (e.g.,http://169.254.169.254/latest/meta-data/iam/security-credentials/). - The library's
aiohttpclient automatically follows the redirect to the target internal resource. - The internal resource processes the request and returns sensitive data (e.g., IAM credentials) in the response body.
- The library captures the response body from the internal resource and returns it to the caller, completing the exfiltration of the data to the attacker.
Impact
Successful exploitation allows for blind-to-readable SSRF, enabling unauthorized access to internal HTTP services not directly reachable from the public internet. On cloud-hosted instances configured with IMDSv1, this allows attackers to retrieve instance IAM credentials, resulting in full infrastructure or service compromise.
Recommendation
- Upgrade
utcp-httpand@utcp/httpto version 1.1.4 or higher immediately. - Audit all registered tool or manual endpoints to identify and remove any attacker-influenced or untrusted URL inputs.
- Implement network-level restrictions (such as egress filtering or host-based firewall rules) to prevent the UTCP process from accessing cloud metadata services and internal local network segments.
Immediate actions
Upgrade utcp-http to 1.1.4
Mitigations
Restrict outbound access to cloud metadata services from application hosts
SSRF mitigation