Summary
GitHub Enterprise Server contained a command injection issue where user-controlled git push option values were improperly sanitized before being embedded into internal service headers.
An attacker with push access to a repository could craft special push option values that injected additional internal metadata fields, ultimately enabling remote code execution on the GitHub Enterprise Server instance under certain backend processing conditions.
Affected context
This vulnerability arises in GitHub Enterprise Server when handling git push operations that include custom push options.
The problem manifests in internal services that transform user-supplied push option values into structured headers using a delimiter-based format.
When the same delimiter character is permitted in user input and is not neutralized, the internal header parsing logic can be confused, treating attacker-controlled content as additional trusted metadata fields.
Exploit preconditions
- Attack surface: Git push operations against a vulnerable GitHub Enterprise Server instance.
- Required access: Valid push access (e.g., collaborator, team member, or any account allowed to push) to a repository on the instance.
- Trigger point: A git push that includes specially crafted push options whose values contain delimiter characters and malicious payload content.
- Why exploitation is possible: Internal components take the raw push option values and compose service headers using a delimiter that is not properly escaped or validated.
This allows an attacker to break out of the intended field and inject new internal metadata segments that can influence downstream processing, potentially ending in command execution in backend services.
Why this happens
The core issue is improper neutralization of special elements (CWE-77) in a context where user input is translated into internal header fields and subsequently influences command or process execution.
Instead of treating push option values as opaque data and strictly encoding or escaping delimiter characters, the implementation directly concatenates them into a custom header format that uses a specific delimiter.
Because the same delimiter is allowed in user-controlled values, the header parser interprets attacker-supplied content as additional structured fields.
In downstream processing, these injected fields can end up in command-line arguments, configuration directives, or service invocations in a way that lets attacker-controlled strings be interpreted as part of a command or instruction, enabling remote code execution.
Potential impact
- Remote execution of arbitrary code within the GitHub Enterprise Server environment.
- Compromise of the GitHub Enterprise Server instance, including repositories and configuration data.
- Lateral movement to other internal services or hosts reachable from the compromised server.
- Exfiltration or tampering of source code, secrets stored in repositories, or automation credentials.
- Disruption of CI/CD workflows and potential software supply-chain attacks originating from the compromised GitHub Enterprise Server.
General mitigation guidance
Mitigations center on strict separation of user data from control metadata and ensuring that user input cannot alter internal protocol or command structure.
Recommended defensive patterns include:
- Treat push option values as untrusted, opaque data and never as fragments of internal header syntax or command-line templates.
- Use robust encoding or escaping routines whenever user data is embedded into structured fields (headers, delimited strings, command arguments, configuration files).
- Avoid custom delimiter-based serialization formats for internal headers when safer structured representations (e.g., JSON with strict parsing, typed RPC parameters) are available.
- When command execution is required, use parameterized APIs that separate executable paths and argument lists from data, and never concatenate raw input into shell commands.
- Apply least-privilege principles to the processes handling push operations so that, even if parsing logic fails, the blast radius of any unexpected behavior is minimized.
How teams detect issues like this
Detection can focus both on code-level patterns and on anomalous runtime behavior.
Static and code review approaches:
- Search for code that constructs internal headers or protocol frames via string concatenation that includes user-supplied push option values.
- Flag any use of delimiter-based formats where user-controlled values are allowed to contain the same delimiter without escaping.
- Review paths where metadata derived from push options is passed to process execution APIs, configuration loaders, or scripting engines.
- Use static analysis rules that identify potential command injection when untrusted input flows into shell invocation functions or command templates.
Policy and automated checks:
- Enforce secure coding guidelines that prohibit raw string concatenation of user input into headers, command lines, or configuration statements.
- Integrate application security testing tools in CI that can model taint flows from git push-related inputs to command execution sinks.
- Monitor server logs for unusual or malformed push options and internal header values as potential indicators of attempted exploitation.

