Summary
A server-side request forgery vulnerability in GitHub Enterprise Server allowed malicious pre-receive hook code to impersonate an internal service and redirect trusted requests to a privileged service. Under specific repository access and networking conditions, successful exploitation could result in remote code execution on the GitHub Enterprise Server instance.
Affected context
The vulnerability occurs in GitHub Enterprise Server deployments where pre-receive hook networking is enabled. Risk is present when an attacker has site administrator privileges or write access to a repository containing a configured pre-receive hook, and when insufficient network isolation allows hook-originated requests to reach privileged internal services.
Exploit preconditions
- Attack surface: Network requests initiated by repository pre-receive hook code
- Required access: Site administrator privileges or write access to a repository with a configured pre-receive hook
- Trigger point: Execution of the pre-receive hook while networking is enabled
- Why exploitation is possible: Weak network isolation permits hook code to impersonate an internal service and redirect trusted requests toward a privileged service
Why this happens
The underlying issue is insufficient isolation between user-influenced pre-receive hook execution and privileged internal services. Requests originating from hook code were trusted or routable in a way that allowed them to access internal service functionality beyond the hook's intended authority. This behavior maps to CWE-918: Server-Side Request Forgery, where an attacker can influence a server-side component to make requests to unintended internal destinations.
Potential impact
- An attacker could execute code with elevated privileges on the GitHub Enterprise Server instance
- Internal services could be accessed or impersonated
- Repository confidentiality and integrity could be affected
- The GitHub Enterprise Server environment could be further compromised
- Administrative controls or hosted development workflows could be disrupted
General mitigation guidance
Mitigation generally focuses on reducing trust between hook execution environments and privileged internal services.
Common defensive patterns include:
- Disabling pre-receive hook networking when it is not required
- Enforcing strict egress filtering and network segmentation for hook processes
- Using explicit service allowlists rather than broad internal network reachability
- Separating hook execution from privileged services and authentication contexts
- Applying least-privilege identities and narrowly scoped credentials to hook workloads
- Treating all repository-controlled hook code as untrusted input
- Restricting repository write permissions and reviewing configured hooks
These controls reduce the likelihood that a hook can impersonate an internal component or reach privileged functionality.
How teams detect issues like this
Organizations can look for this vulnerability class through:
- Static analysis and code review rules for server-side request destinations influenced by repository content
- Review of pre-receive hook configuration, execution permissions, and network access
- Network telemetry identifying hook processes making requests to internal or administrative services
- Egress policies that alert on unexpected destinations, metadata endpoints, or privileged service interfaces
- Audit logs correlating repository writes, hook execution, and unusual administrative activity
- Automated security review tools that flag SSRF-prone request handling and missing network boundaries

