Summary
The repomix /api/pack endpoint contains a server-side request forgery (SSRF) flaw that lets unauthenticated users cause the server to send arbitrary outbound requests via git clone.
Because URLs like http://, https://, and file:// are not properly validated or restricted, this becomes risky whenever the service can reach internal networks, cloud metadata endpoints, or sensitive local filesystem paths.
Affected context
This vulnerability appears in deployments of repomix where the POST /api/pack endpoint is exposed and accepts user-supplied repository URLs.
It is most impactful when the repomix server:
- Runs inside a network with access to internal services or management planes
- Has connectivity to cloud provider metadata endpoints (e.g., GCP metadata service)
- Has local filesystem paths that can be referenced via supported URL schemes (e.g., file://)
The issue manifests when user-controlled URLs are passed directly into git clone without strict validation or allow-listing.
Exploit preconditions
- Attack surface: Publicly exposed POST /api/pack HTTP endpoint
- Required access: No authentication; attacker only needs network reachability to the repomix service
- Trigger point: Submission of a crafted URL parameter (http://, https://, or file://) that is forwarded to git clone
- Why exploitation is possible: The endpoint trusts user-provided URLs and does not enforce scheme restrictions, host allow-lists, or path validation, allowing interaction with internal resources and local paths through server-side execution of git clone.
Why this happens
The underlying bug class is server-side request forgery as described by CWE-918, where a server-side component performs outbound requests based on untrusted user input.
In this case, the application passes user-specified URLs directly to git clone, effectively turning the server into a proxy to reach arbitrary network locations and local resources.
The lack of strict URL validation, scheme filtering, and network egress controls causes the server to honor attacker-supplied addresses, violating trust boundaries between public inputs and internal infrastructure.
Potential impact
- May allow access to internal HTTP services that are not publicly exposed
- Could enable retrieval of cloud provider metadata, including credentials or configuration
- Can expose sensitive local filesystem content reachable via supported URL schemes
- May assist in network reconnaissance and enumeration of internal services
- Could provide a foothold for further lateral movement or privilege escalation within the environment
General mitigation guidance
Effective mitigation focuses on treating user-supplied URLs as untrusted and tightly constraining what the server is allowed to reach.
Common patterns include:
- Enforcing strict allow-lists for repository hosts and schemes (e.g., only https:// to known domains)
- Rejecting or sanitizing file:// and other non-HTTP(S) schemes
- Applying network egress policies to prevent access to internal ranges and metadata services
- Separating components that perform outbound network calls into hardened, least-privilege environments
- Logging and rate-limiting outbound requests triggered by user input to reduce abuse potential
How teams detect issues like this
Detection typically involves reviewing both code and runtime behavior for SSRF patterns.
Helpful approaches include:
- Static analysis and manual review for locations where user-controlled URLs are passed to HTTP clients, git, or other network-aware tools
- Security checks in CI that flag use of generic URL handling without host allow-lists or scheme filters
- Monitoring outbound traffic from the application for unusual destinations, such as cloud metadata IPs or internal management ports
- Policy enforcement at the network layer (e.g., firewall rules) to block access to sensitive internal addresses, combined with alerts when violations are attempted

