Skip to content
RCE Write-up Advanced

Securing GitHub: Wiz Research uncovers Remote Code Execution in GitHub.com and GitHub Enterprise Server (CVE-2026-3854)

An injection flaw in GitHub's internal X-Stat header allowed any authenticated user to execute arbitrary commands on backend servers via a single git push. On GitHub.com this gave code execution on shared storage nodes with access to millions of repositories; on GitHub Enterprise Server it granted full server compromise.

Sagi Tzadik Follow

Published on wiz.io

Wiz Research uncovered a critical vulnerability (CVE-2026-3854) in GitHub's internal git infrastructure that could have affected both GitHub.com and GitHub Enterprise Server. By exploiting an injection flaw in GitHub's internal protocol, any authenticated user could execute arbitrary commands on GitHub's backend…

Sagi Tzadik, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the git proxy embedded user-controlled push option values into the semicolon-delimited X-Stat header without sanitising semicolons, and downstream services trusted every field in that header, allowing last-write-wins injection of security-critical settings.

Impact

On GitHub.com, the flaw allowed remote code execution on shared storage nodes, potentially exposing millions of repositories; on GHES it granted full server compromise, and at the time of writing 88% of instances were still vulnerable.

What the attacker needed

An authenticated GitHub account; push access to a repository; a standard git client

The fix

GitHub mitigated the issue on GitHub.com and released patches for all supported GHES versions; administrators should upgrade to a fixed version.

How it was found

  1. Authenticate to GitHub or GHES and prepare a repository you can push to.
  2. Use git push with a crafted push option containing semicolons and injected X-Stat fields.
  3. Inject a non-production rails_env value to switch to the unsandboxed hook execution path.
  4. Inject custom_hooks_dir to control the base directory for hook script lookup.
  5. Inject repo_pre_receive_hooks with a path traversal sequence to point to an arbitrary binary.
  6. On GitHub.com, additionally inject the enterprise-mode flag to reach the custom hooks code path.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you push code to GitHub, your request passes through several internal services that share information using a header called X-Stat. The first service copied your git push options into that header without removing semicolons, which are used to separate fields. By including a semicolon in a push option, an attacker could add their own security settings and trick the system into running commands on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Sagi Tzadik

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.