Skip to content
RCE Write-up Advanced

I Was Treating Header Injection as Low-Impact.

A git push option value was copied verbatim into an internal header that downstream services parsed by splitting on semicolons, letting a user inject extra fields. By overriding fields that control sandboxing and hook paths, an attacker could run arbitrary code as the git service user on GitHub Enterprise Server and, after injecting one more flag, on GitHub.com.

medium.com

Published on medium.com

You send a request, add a \r\n, and boom — your input shows up as a new header. Or you throw a ; in a value and suddenly there's a second key-value pair staring back at you.

Abhishek meena, on medium.com

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 push option value was concatenated into a semicolon-delimited internal header without encoding, and the downstream parser used last-write-wins, so injected keys silently overrode trusted ones.

Impact

An attacker could run arbitrary code as the git service user, potentially reaching every repository and secret on the storage node, though the researchers only validated with their own test accounts.

What the attacker needed

Ability to push to a repository; push option support on the server

The fix

GitHub fixed it by percent-encoding semicolons at the boundary and removed the unnecessary production code path.

How it was found

  1. Push to a repository with a push option whose value contains a semicolon and a field assignment.
  2. The git proxy copies the option into the internal header, and the downstream parser splits it into extra fields.
  3. Inject a value that changes the environment away from production, removing the sandbox.
  4. Inject a custom hooks directory and a hook definition whose script path traverses to a chosen binary.
  5. On GitHub.com, also inject the enterprise-mode flag so the custom hooks path is reached.
  6. The hook runs the chosen binary as the git user, confirming code execution.

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 one program passes data to another, it often packs several values into one long line, separated by a character such as a semicolon. If a user's text is dropped into that line without cleaning, the user can add their own semicolons and fake extra values. Here the fake values changed security settings, so the server ended up running the attacker's chosen program.

What is RCE?

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

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.