CVE-2021-21384: Null characters not escaped in shescape

shescape Updated 02 Oct 2025

Summary

18/03/2021
Yes i
High
6.3

CVE-2021-21384: Null characters not escaped. Affects shescape versions < 1.1.3. Fixed in 1.1.3. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Shescape is an npm package used for defending against shell injection attacks. It provides a function called 'quote' that escapes special characters in a shell command. However, prior to version 1.1.3, shescape did not properly escape null characters, leaving the system vulnerable to shell injection attacks if an attacker managed to insert a null character into the payload.

Vulnerability Detail

The vulnerability in shescape allows an attacker to bypass shell injection defenses by inserting null characters into the payload. This can lead to arbitrary command execution and potential compromise of the system. The impact is particularly severe on Windows systems. An example payload demonstrating the vulnerability is provided in the vulnerability details.

How To Fix

Latest published version: 3.0.2 as of 23 Oct 2026

npm install shescape@3.0.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.1.3

This is the first release that contains the fix.

npm install shescape@1.1.3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not immediately feasible, a temporary workaround is to manually strip out null characters from the payload using the following code:

const sanitizedPayload = payload.replace(/\u{0}/gu, '');

Conclusion

The vulnerability in shescape that allowed bypassing shell injection defenses by inserting null characters has been fixed in version 1.1.3. It is recommended to upgrade to this version or later to ensure the security of your system. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for shescape →

Share this vulnerability

FAQ

The vulnerability allows an attacker to bypass shell injection defenses and execute arbitrary commands, potentially leading to system compromise.

You can fix this vulnerability by upgrading to shescape version 1.1.3 or later.

Yes, you can manually strip out null characters from the payload using the provided code snippet.

No, only versions prior to 1.1.3 are affected. Upgrading to version 1.1.3 or later will fix the vulnerability.

You can find more information about this vulnerability in the provided vulnerability details or by contacting the package maintainers.

Related vulnerabilities

Recent vulnerabilities recorded for shescape.

How To Fix

Latest published version: 3.0.2 as of 23 Oct 2026

npm install shescape@3.0.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.1.3

This is the first release that contains the fix.

npm install shescape@1.1.3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback