Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') The advisory has been revoked - it doesn't affect any version of package bun  (opens in a new tab)


Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.07% (23rd 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 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-BUN-9510752
  • published22 Jul 2025
  • disclosed23 Mar 2025
  • creditLiran Tal

Introduced: 23 Mar 2025

CVE-2025-8022  (opens in a new tab)
CWE-78  (opens in a new tab)
First added by Snyk

Amendment

This was deemed not a vulnerability.

Overview

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in the $ shell API due to improper neutralization of user input. An attacker can exploit this by providing specially crafted input that includes command-line arguments or shell metacharacters, leading to unintended command execution.

Note:

Bun Shell does not invoke /bin/sh, or any other interpreter, for template literals created with the $ function. Each ${…} interpolation is treated as a single argument. The security responsibility for this usage pattern lies with the calling application, which must ensure the sanitization and validation of any untrusted arguments before passing them to the executed commands. Therefore, the potential for command injection is not a flaw within Bun itself; rather, it is an argument injection that is contingent on its implementation by the consuming application.

PoC

import { $ } from "bun";

const userRepository = `--upload-pack=env>hello;`;
const refs = await $`git ls-remote ${userRepository} main`.text();

References