Skip to content
RCE Write-up Intermediate

CVE-2018-17456

A malicious .gitmodules file in a Git repository could inject command-line options into the git clone submodule handling, allowing an attacker to execute a shell script when a victim clones the repository. The attacker could run arbitrary code on the victim's machine.

0day.click

Published on 0day.click

I’ve gotten a couple of questions about exploitation for the recent RCE in Git. So here we go with some technical details.

The author, on 0day.click

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

Impact

An attacker could execute arbitrary code on a victim's machine when the victim clones a malicious repository.

What the attacker needed

Victim clones a malicious repository

How it was found

  1. Create a repository with a .gitmodules file containing a crafted submodule entry.
  2. Set the submodule path and url to values that inject a command-line option.
  3. Include a colon in the path to ensure the payload script is executed.
  4. Have the victim clone the repository, triggering the injected command.

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.

Git is a tool for tracking changes in code. When you clone a repository, Git reads a file called .gitmodules to know where to fetch submodules from. Here, a crafted value in that file tricked Git into running a script instead of just fetching code, so opening the repository could run the attacker's program on your computer.

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.