Skip to content
RCE Disclosed report Intermediate

[create-git] RCE via insecure command formatting

The create-git NPM module passed user-supplied input directly into a shell command without validation, allowing an attacker to run arbitrary commands alongside git. A proof of concept showed that a crafted remote origin value could trigger a separate network request to a local endpoint.

mik317 Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 44 hours
  • Fixed in 12 months
  • Disclosed after 13 months

Summary by the program

The create-git NPM module was vulnerable against command injection which was possible since some user supplied inputs were concatenated without proper checks inside a exec() call, which made possible executing arbitrary commands besides the git one (which is used by the tool).

The PoC resulted in:

JavaScript
// poc.js const createGit = require('create-git')

createGit({  ignoreExisting: true,  initialCommitMessage: 'test',  remoteOrigin:
'http://evil.com || curl "http://localhost/RCE"', 
ignoreTemplates: ['Node.gitignore']  })

The vulnerability has been fixed checking the inputted data and using safe functions to execute commands, which replaced exec() occurrences.

The original report as published on HackerOne, by mik317. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

User-controlled input was concatenated into a string passed to exec(), so shell metacharacters could inject additional commands.

Impact

An attacker who can influence the remote origin value could execute arbitrary commands on the machine running the module, though the proof of concept only demonstrated a request to a local endpoint.

What the attacker needed

Control over remote origin input; module used with attacker-influenced value

The fix

The vulnerability was fixed by validating the input and replacing exec() with safer functions to execute commands.

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 report has not been written yet. The Original tab links to the source.

When a program builds a system command by gluing together text from a user, special characters in that text can break out of the intended command and start new ones. Here the module did that with a value like a remote repository address, so an attacker could make the computer run extra commands. The fix was to check the input and use safer ways to start processes.

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 mik317

View all

23 more disclosed reports, best first.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

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.