The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-45444

CVE-2021-45444: Zsh Prompt Expansion RCE Vulnerability

CVE-2021-45444 is a remote code execution vulnerability in Zsh that allows attackers to execute arbitrary code through recursive PROMPT_SUBST expansion. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-45444 Overview

CVE-2021-45444 is a code execution vulnerability affecting Zsh (Z Shell) versions prior to 5.8.1. The vulnerability exists in the shell's prompt handling mechanism, where an attacker who controls command output displayed within the prompt can achieve arbitrary code execution. This occurs due to recursive PROMPT_SUBST expansion, which processes escape sequences like %F arguments in an unsafe manner.

The Z Shell is a popular Unix shell used as an interactive login shell and command interpreter, notably serving as the default shell on macOS since Catalina. This widespread deployment significantly expands the potential impact of this vulnerability across enterprise and consumer environments.

Critical Impact

Attackers controlling command output in Zsh prompts can achieve arbitrary code execution through recursive PROMPT_SUBST expansion, affecting millions of macOS and Linux systems.

Affected Products

  • Zsh versions before 5.8.1
  • Apple macOS (multiple versions including Catalina 10.15.7 and later releases)
  • Apple Mac OS X 10.15.7 with various security updates
  • Fedora 34 and 35
  • Debian Linux 9.0, 10.0, and 11.0

Discovery Timeline

  • 2022-02-14 - CVE-2021-45444 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-45444

Vulnerability Analysis

This vulnerability stems from unsafe handling of prompt expansion in Zsh when the PROMPT_SUBST option is enabled. The PROMPT_SUBST feature allows parameter expansion, command substitution, and arithmetic expansion within shell prompts. However, when command output containing specially crafted escape sequences (such as %F arguments) is incorporated into the prompt, Zsh recursively expands these sequences without proper sanitization.

The recursive nature of this expansion creates a dangerous situation where attacker-controlled data can be interpreted as shell commands. This is particularly concerning because many Zsh configurations include command output in prompts—for example, displaying Git branch information, current directory status, or other dynamic content.

The vulnerability requires local access and user interaction, as the attacker must have some control over content that appears in the user's prompt. Common attack scenarios include manipulating Git repository names, file names, or other sources of data that users commonly display in their shell prompts.

Root Cause

The root cause is the recursive expansion behavior of PROMPT_SUBST in Zsh. When processing prompt strings, Zsh performs multiple rounds of expansion without adequate bounds checking or sanitization of embedded escape sequences. The %F argument (used for foreground color specification) and similar prompt escapes can trigger unintended code execution when they appear in command output that gets substituted into the prompt.

This represents a classic case of insufficient input validation where user-controlled or externally-sourced data is processed as code rather than data.

Attack Vector

The attack vector is local, requiring the attacker to influence content that appears in the victim's shell prompt. Practical exploitation scenarios include:

The attacker crafts a malicious repository name, directory name, or other content that will be displayed in the victim's prompt through command substitution. When the victim navigates to or interacts with this content, the malicious escape sequences are processed by Zsh's recursive PROMPT_SUBST expansion, leading to code execution in the context of the user's shell session.

For example, if a user's prompt configuration includes Git branch information via $(git branch) or similar command substitution, an attacker who creates a repository with a specially crafted branch name containing malicious %F sequences could trigger code execution when the user enters that repository.

The vulnerability mechanism exploits the recursive expansion behavior in Zsh's prompt processing. When PROMPT_SUBST is enabled, sequences containing format specifiers like %F undergo multiple expansion passes, allowing carefully crafted payloads to break out of the intended color specification context and execute arbitrary commands. For detailed technical analysis, refer to the Ryotak Advisory #63.

Detection Methods for CVE-2021-45444

Indicators of Compromise

  • Unusual Zsh prompt configurations containing unexpected %F or other format specifiers from external sources
  • Suspicious directory or file names containing Zsh escape sequences in repositories or file systems
  • Unexpected command execution or process spawning correlated with shell prompt rendering
  • Anomalous behavior when navigating to directories with unusual naming patterns

Detection Strategies

  • Monitor for Zsh processes executing unexpected child commands during prompt rendering cycles
  • Audit .zshrc, .zshenv, and other Zsh configuration files for prompt definitions that include unsanitized external command output
  • Implement file integrity monitoring on Zsh configuration directories
  • Deploy endpoint detection rules for suspicious Zsh behavior patterns involving escape sequence processing

Monitoring Recommendations

  • Enable command logging and audit trails for shell sessions to detect anomalous execution patterns
  • Monitor system calls from Zsh processes for unexpected execve or similar calls during interactive sessions
  • Implement behavioral analysis to detect code execution triggered by directory navigation or prompt updates
  • Review Git repositories and file systems for content containing potential exploit payloads

How to Mitigate CVE-2021-45444

Immediate Actions Required

  • Upgrade Zsh to version 5.8.1 or later immediately across all affected systems
  • Audit existing Zsh configurations for prompt definitions that incorporate external command output
  • Review and sanitize any custom prompt configurations that use PROMPT_SUBST with dynamic content
  • Apply vendor-specific patches for macOS, Debian, and Fedora systems as detailed in their respective security advisories

Patch Information

The vulnerability is addressed in Zsh version 5.8.1 and later. Multiple vendors have released patches addressing this vulnerability:

  • Zsh Project: Fixed in version 5.8.1 - see Zsh Release Notes
  • Apple: Addressed in macOS security updates - see Apple Support Article HT213255, HT213256, and HT213257
  • Debian: Security updates available via Debian Security Advisory DSA-5078 and Debian LTS Announcement
  • Fedora: Updates available for Fedora 34 and 35 via Fedora Package Announcements

Workarounds

  • Disable the PROMPT_SUBST option in Zsh configurations if not required: add setopt NO_PROMPT_SUBST to .zshrc
  • Sanitize all external command output before including it in prompt definitions
  • Avoid using dynamic command substitution in prompts when sourcing from untrusted content
  • Use static prompt configurations without embedded command execution until patching is complete
bash
# Disable PROMPT_SUBST as a temporary workaround
# Add to ~/.zshrc or /etc/zsh/zshrc
setopt NO_PROMPT_SUBST

# Or explicitly sanitize prompt variables
# Replace dynamic content with static alternatives
PS1='%n@%m:%~$ '

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechZsh

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.11%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • NVD-CWE-noinfo
  • Technical References
  • Full Disclosure May 2022 Post 33

  • Full Disclosure May 2022 Post 35

  • Full Disclosure May 2022 Post 38

  • Debian LTS Announcement 00020

  • Fedora Package Announcement Message

  • Fedora Package Announcement Message

  • Apple Support Article HT213255

  • Apple Support Article HT213256

  • Apple Support Article HT213257

  • Ryotak Advisory #63

  • Debian Security Advisory DSA-5078

  • Zsh Release Notes
  • Latest CVEs
  • CVE-2025-52479: HTTP.jl & URIs.jl CRLF Injection Flaw

  • CVE-2026-31740: Linux Kernel Race Condition Vulnerability

  • CVE-2026-31743: Linux Kernel Buffer Overflow Vulnerability

  • CVE-2026-31744: Linux Kernel NULL Pointer Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English