Summary
PromptHub versions 0.4.9 through 0.5.3 expose an authenticated API endpoint that fetches arbitrary user-supplied URLs server-side and returns up to 5 MB of the response to the caller.
Due to incomplete validation of IPv6 and IPv4-mapped IPv6 addresses, attackers can bypass SSRF protections, target internal network resources, and access otherwise unreachable services from the PromptHub server.
Affected context
This vulnerability occurs in the PromptHub web application's skill management feature, specifically in the POST /api/skills/fetch-remote endpoint used to retrieve remote skill definitions or related metadata.
The issue is present when:
- The application is running PromptHub versions 0.4.9 to before 0.5.4
- The backend server performs HTTP(S) requests on behalf of users to arbitrary URLs they provide
- SSRF defenses rely on string-based checks (e.g.,
isPrivateIPv6) that only recognize a narrow set of IPv6/loopback representations
Deployments with ALLOW_REGISTRATION=true expand the risk surface, since anyone on the internet can create an account and reach the vulnerable endpoint.
Exploit preconditions
- Attack surface: HTTP POST endpoint
/api/skills/fetch-remoteon the PromptHub web server. - Required access:
- Any authenticated user account (role
useroradmin), and - On instances with
ALLOW_REGISTRATION=true, any internet user who can self-register. - Trigger point: Submitting a POST request containing a crafted URL that uses alternate-but-valid IPv6 or IPv4-mapped IPv6 representations to bypass
isPrivateIPv6checks. - Why exploitation is possible:
- The server-side code:
- Accepts attacker-controlled URLs.
- Performs outbound HTTP(S) requests without fully normalizing or validating IP address literals.
- Reflects the remote server's response body back to the caller (up to 5 MB).
- The SSRF protection only examines specific literal IPv6 forms (e.g., the exact string
"::1") and fails to handle: - Canonical loopback written in other equivalent IPv6 formats.
- IPv4-mapped IPv6 addresses in hex or other accepted notations.
- As a result, requests can be directed to internal IPv4/IPv6 targets despite nominal filtering.
Why this happens
The core issue is an incomplete and format-sensitive validation of network addresses used for SSRF protection, aligning with:
- CWE-918: Server-Side Request Forgery (SSRF)
- CWE-20: Improper Input Validation
- CWE-693: Protection Mechanism Failure
The defensive logic in isPrivateIPv6 relies on string comparisons and a narrow interpretation of what constitutes private or loopback IPv6 addresses. It does not:
- Canonically parse and normalize IPv6 addresses before classification.
- Correctly identify IPv4-mapped IPv6 addresses that resolve to private, loopback, or link-local IPv4 ranges.
- Treat semantically equivalent IPv6 representations of loopback (beyond the literal
"::1") as local destinations.
This pattern is a classic SSRF trap: server-side tools intended to "fetch remote resources" are given untrusted URLs, and validation is implemented at the string level instead of performing robust, parser-backed checks on the resolved IP address and network range. Because the HTTP client runs in the trusted backend environment, these gaps translate directly into unintended access to internal services.
Potential impact
- Access to internal HTTP(S) services that are not exposed to the public internet (e.g., admin panels, internal APIs, service metadata endpoints).
- Retrieval of sensitive information from internal endpoints, such as credentials, configuration data, or service metadata (e.g., cloud instance metadata services if reachable).
- Network mapping and reconnaissance of internal hosts and services using response behavior and timing side channels.
- Potential pivoting into further attacks if internal endpoints themselves contain exploitable vulnerabilities.
- Abuse of the PromptHub server as an unwilling proxy to interact with restricted network resources.
General mitigation guidance
Effective mitigation centers on hardening server-side URL fetching logic and reducing trust in user-supplied destinations:
- Enforce strict allow-listing:
- Prefer defining explicit allow-lists of domains or service endpoints that the server is permitted to contact.
- Avoid open "fetch arbitrary URL" patterns in production features whenever possible.
- Perform canonical network-level validation:
- Parse URLs using a robust URL/URI parser, resolve hostnames to IP addresses, and:
- Normalize IPv6 addresses.
- Expand and classify IPv4-mapped IPv6 addresses.
- Reject any IP that falls into private, loopback, link-local, multicast, or otherwise non-routable ranges.
- Re-check the final resolved IP after DNS resolution and before issuing the outbound request.
- Separate network egress responsibilities:
- Route untrusted outbound HTTP requests through tightly controlled egress proxies or dedicated network segments with restricted access to internal services.
- Apply firewall or security group rules to block the application server from directly reaching internal-only or metadata endpoints where possible.
- Constrain response handling:
- Limit the size of responses more aggressively and enforce strict content-type and timeouts.
- Avoid reflecting entire arbitrary response bodies to clients; instead, consider extracting only the minimal data actually required by the feature.
- Privilege and configuration hardening:
- Run the web application with least-privilege network permissions.
- Avoid colocating highly sensitive internal services on the same network segments that the web front-end can access.
How teams detect issues like this
Detection approaches typically combine code-level inspection with runtime monitoring:
- Static analysis and code review:
- Search for server-side HTTP clients that accept user-controlled URLs or hostnames (e.g.,
fetch,axios,http.request, or similar library calls). - Flag URL construction patterns where the host, port, or scheme is derived from request parameters or stored user data without robust validation.
- Specifically review any custom IP classification utilities (like
isPrivateIPv6) for: - String-based checks that do not normalize addresses.
- Lack of handling for IPv4-mapped IPv6 and alternate textual IPv6 forms.
- Introduce coding guidelines that discourage open "URL fetcher" endpoints unless strictly constrained.
- Security testing and fuzzing:
- Run application-level SSRF tests using automated scanners that generate:
- Multiple equivalent IPv6 representations.
- IPv4-mapped IPv6 addresses.
- Hostnames resolving to internal ranges.
- Confirm that internal and metadata endpoints remain unreachable from SSRF vectors.
- Operational monitoring:
- Log outbound HTTP requests originating from the server, including resolved IP, host header, URL, and authenticated user context.
- Set alerts for:
- Requests to known internal address ranges.
- Unexpected spikes in outbound requests triggered by a single user.
- Use network-level telemetry (firewall logs, proxy logs) to identify unusual egress patterns from application servers.
- Policy enforcement via tooling:
- Integrate SAST/DAST tools that include SSRF rulesets into CI/CD pipelines.
- Use infrastructure-as-code and network policy tools to enforce egress constraints independent of application logic.

