Skip to content
RCE Write-up Advanced

⚙️ Remote Code Execution in GitLab — The Tale of a Rogu

GitLab's 'Import from GitHub' feature cached repository metadata fetched from an external API, and later deserialised that cached data without validating it. An authenticated low-privilege user could supply a crafted API response containing a serialised payload and achieve remote code execution on the GitLab host.

Abhishek meena Follow

Published on medium.com

When you hear “Import from GitHub,” you probably imagine convenience — GitLab pulling in your repositories with just a click. But what if that same friendly feature could be used to execute arbitrary commands on your server?

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 caching layer stored attacker-influenced remote API data as serialised objects and a later component deserialised them without a trust check, crossing a trust boundary.

Impact

Remote code execution on the GitLab host under the service account, which could expose repositories, secrets and CI/CD tokens and allow lateral movement.

What the attacker needed

An authenticated low-privilege account; ability to trigger the GitHub import flow; attacker-controlled API response

The fix

GitLab released patches and backported fixes; operators should upgrade, and more generally avoid generic object deserialisers for external data.

How it was found

  1. Run a fake GitHub API that returns malicious repository metadata.
  2. Trigger a GitLab import so the metadata object, including the serialised payload, is cached.
  3. GitLab later deserialises the cached object in a context that executes the payload.

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.

GitLab can copy your projects in from GitHub. To do that it asks GitHub for details about the project and stores the answer for a while. The bug was that it trusted that stored answer completely, so someone who pretended to be GitHub could slip in instructions that GitLab later ran as real commands on its own 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 Abhishek meena

View all

4 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.