Summary
GuardDog's programmatic remote project scanning path performs unsafe string rewriting on attacker-controlled repository URLs and then issues outbound requests that include the caller's GitHub credentials.
If an attacker can influence the repository URL GuardDog scans, they may be able to trigger SSRF and capture the GH_TOKEN used by GuardDog, potentially compromising the caller's GitHub account or automation tokens.
Affected context
This vulnerability affects environments where GuardDog (versions 1.0.0 to 2.9.0) is used programmatically to scan remote projects and is configured to authenticate to GitHub using a GH_TOKEN or similar credentials.
The issue arises specifically when the repository URL being scanned can be influenced by an external party (for example, user-supplied project URLs, CI inputs, or integration hooks) and GuardDog then rewrites and requests that URL while attaching GitHub credentials.
Exploit preconditions
- Attack surface: Programmatic API or code paths that invoke GuardDog's remote project scanning with externally influenced repository URLs.
- Required access: Ability to control or manipulate the repository URL provided to GuardDog (e.g., via user input, CI configuration, or compromised integration).
- Trigger point: GuardDog's remote scanning routine performs a naive string replacement on the repository URL and initiates an outbound HTTP(S) request including the GH_TOKEN in the request context.
- Why exploitation is possible: The URL rewrite logic does not validate the destination or enforce an allowlist, causing GuardDog to send authenticated requests to attacker-controlled endpoints, enabling SSRF and token capture.
Why this happens
The core issue is an insecure URL handling pattern where attacker-influenced repository URLs are modified using blind string replacement and then used as the target of authenticated network requests.
Because no robust validation, normalization, or allowlisting is applied, and authentication headers or tokens are attached by default, GuardDog's scanning logic effectively acts as a privileged HTTP client that can be redirected to arbitrary endpoints.
This aligns with CWE-918: Server-Side Request Forgery (SSRF), where a server-side component issues HTTP requests to user-chosen destinations, exposing internal resources or sensitive credentials.
Potential impact
- Exposure of GH_TOKEN or equivalent GitHub credentials to an attacker-controlled endpoint
- Unauthorized access to the caller's GitHub repositories, organizations, or actions workflows, depending on token scope
- Tampering with source code, pull requests, or security workflows associated with the compromised token
- Lateral movement into other systems integrated with the affected GitHub account or CI/CD environment
- Abuse of the compromised token for supply chain attacks, such as publishing malicious code or modifying release artifacts
General mitigation guidance
Effective mitigation focuses on constraining outbound requests and decoupling sensitive credentials from untrusted destinations:
- Treat all repository URLs as untrusted input and perform strict validation, including scheme, host, and path checks before issuing any network requests.
- Implement allowlists for domains and protocols that GuardDog is permitted to contact (e.g., only GitHub's official domains over HTTPS).
- Avoid naive string replacement for URL rewriting; instead, parse URLs with robust libraries and reconstruct them from controlled components.
- Ensure that authentication tokens (such as GH_TOKEN) are only attached when the destination is verified as trusted and expected.
- Consider using scoped, least-privilege tokens for scanning tasks, limiting damage if a token is inadvertently exposed.
- Where possible, separate the logic that constructs URLs from the logic that attaches credentials, reducing the chance of sending secrets to untrusted endpoints.
How teams detect issues like this
To detect and monitor issues like this, organizations can:
- Use static analysis or linters to flag code paths that:
- Accept externally influenced URLs and
- Perform network requests with attached authentication headers or tokens.
- Add code review checks around URL construction and outbound HTTP clients, paying attention to string-based URL rewriting and missing host validation.
- Implement centralized HTTP client wrappers that enforce domain allowlists and log any deviation or unexpected destination.
- Monitor network telemetry from CI/CD or scanning environments for outbound requests to unusual domains, especially when accompanied by authentication headers.
- Integrate automated security scanning tools into CI pipelines to detect SSRF-prone patterns and unsafe credential handling in tooling and scripts.

