Summary
HyperChat's AI Proxy Middleware contains a server-side request forgery (SSRF) flaw in its fetch function, where the baseurl argument can be manipulated by an attacker.
When exploited remotely, this allows crafted requests to be proxied by the server to arbitrary destinations that the attacker selects, potentially reaching internal services not otherwise exposed.
Affected context
The vulnerability exists in BigSweetPotatoStudio HyperChat up to version 2.0.0-alpha.63 within the AI Proxy Middleware (packages/core/src/http/aiProxyMiddleware.mts).
It manifests when the middleware accepts or derives a baseurl value from client-controlled input and then uses it to build outbound HTTP requests without robust validation or restriction.
Deployments where the HyperChat server can reach internal hosts, cloud metadata endpoints, or other sensitive services are at particular risk.
Exploit preconditions
- Attack surface: Remote HTTP interface exposed by the AI Proxy Middleware.
- Required access: Ability to send crafted requests to endpoints that invoke the middleware's
fetchlogic (typically standard user-level or anonymous web/API access). - Trigger point: Supplying a malicious
baseurl(or parameters that influence it) so that the middleware issues an outbound request to an attacker-chosen URL. - Why exploitation is possible: The
fetchfunction trusts thebaseurlvalue without enforcing strict allowlists, scheme checks, or network egress controls, enabling attacker-controlled destinations to be requested from the server's network context.
Why this happens
This issue stems from insufficient validation and normalization of user-influenced URLs used for server-side HTTP requests.
The AI Proxy Middleware's fetch function uses a baseurl argument that can be controlled or influenced by clients, and passes it directly (or with minimal checks) into HTTP request logic.
This aligns with CWE-918: Server-Side Request Forgery (SSRF), where the server becomes an unwitting proxy, leveraging its own network position and trust relationships to reach targets that the attacker cannot access directly.
Potential impact
- May allow access to internal services (e.g., internal APIs, admin panels, databases, or message brokers) not otherwise exposed to the internet.
- Could enable interaction with cloud provider metadata services, potentially leaking credentials or configuration data.
- Can leak sensitive response data (tokens, secrets, configuration, or user data) returned by internal endpoints.
- Might be used to pivot within the infrastructure, assisting in reconnaissance and further attacks.
- Could facilitate partial denial-of-service against internal resources by directing high volumes of proxy requests at them.
General mitigation guidance
Effective mitigation focuses on treating outbound destinations as untrusted when influenced by client input and strictly limiting where the server can connect:
- Introduce strict allowlists of permitted upstream hosts and paths for the AI Proxy Middleware; reject or ignore any
baseurlnot on the allowlist. - Enforce scheme and hostname validation, allowing only expected protocols (e.g.,
https) and forbidding link-local, loopback, private network, and metadata IP ranges. - Normalize and parse URLs using robust libraries, then validate the parsed components before issuing requests.
- Apply network-level egress controls (firewalls, security groups, service meshes) so the application cannot freely call internal or high-risk endpoints.
- Limit the information returned from proxied responses, avoiding reflection of raw internal error messages or sensitive headers to clients.
- Design the middleware with a fixed set of upstream AI providers configured server-side, avoiding patterns where the client can fully control the target URL.
How teams detect issues like this
Identifying and monitoring SSRF risks in components like the AI Proxy Middleware typically involves:
- Static analysis rules that flag direct use of user-influenced URL parameters (
baseurl,url,endpoint) passed into HTTP client APIs without validation or allowlisting. - Code review checklists that require verification of URL normalization, scheme checks, and host/IP restriction logic around any server-initiated HTTP requests.
- Configuration and policy enforcement that disallow dynamic upstream configuration from user input for proxy-like components.
- Runtime monitoring and logging of outbound HTTP requests, including destination host/IP, and alerting on anomalous patterns such as connections to internal IP ranges or metadata endpoints.
- Leveraging automated security testing or DAST tools that attempt to coerce the server into calling controlled SSRF test endpoints to verify defenses.

