CVE-2026-100867 in spaceship-prompt
Summary
by MITRE • 09/27/2026
spaceship-prompt through 4.22.5 fails to sanitize control characters from project manifest version fields before rendering them in the zsh prompt. Attackers can embed ANSI/OSC escape sequences in version fields of package manifests to manipulate terminal output, rewrite window titles, or spoof displayed text when victims enter the directory.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 09/27/2026
The vulnerability identified in spaceship-prompt versions through 4.22.5 represents a significant security flaw rooted in insufficient input sanitization within the shell prompt rendering engine. As an open-source Zsh theme designed to display rich contextual information, including project metadata such as version numbers from package manifests like package.json or Cargo.toml, the tool processes these fields directly for visual output. The core technical failure lies in the absence of rigorous filtering mechanisms for control characters and escape sequences embedded within these manifest files. When a user navigates into a directory containing a maliciously crafted manifest, the prompt engine interprets raw ANSI/OSC (Operating System Command) escape codes as executable terminal instructions rather than literal text strings. This behavior violates the principle of least privilege by allowing untrusted data from project directories to influence the interactive shell environment directly.
From an operational perspective, this flaw enables a variety of malicious activities that can compromise both system integrity and user security posture. An attacker who controls or influences the contents of a shared repository or a downloaded package can embed specific escape sequences within version fields. Upon execution, these sequences allow for terminal output manipulation, which may include rewriting window titles to mimic legitimate applications, thereby facilitating social engineering attacks where users are tricked into believing they are interacting with trusted software interfaces. Furthermore, attackers can spoof displayed text by injecting hidden commands or visual artifacts that obscure the actual prompt state, potentially leading users to execute unintended shell commands under false pretenses. This type of attack is particularly dangerous in collaborative development environments where developers frequently switch between directories and rely on accurate contextual information provided by their shells.
The technical classification of this vulnerability aligns with CWE-16, which pertains to Configuration Errors involving improper handling of input data that leads to unintended behavior. Specifically, the failure to sanitize control characters falls under the broader category of injection vulnerabilities where untrusted data is treated as executable code or commands by the terminal emulator. In terms of offensive security frameworks, this exploit vector maps closely to MITRE ATT&CK technique T1059.004, which covers Command and Scripting Interpreter abuse via shell metacharacters and escape sequences. The attack relies on the victim's trust in their environment configuration, exploiting the fact that modern terminal emulators are designed to interpret these codes for legitimate purposes such as color coding or status updates, without verifying the source of the data triggering them.
Mitigation strategies must focus on both immediate remediation and long-term defensive programming practices. The primary solution is to upgrade spaceship-prompt to a version greater than 4.22.5 where this sanitization logic has been implemented. For environments unable to update immediately, users should exercise extreme caution when navigating directories containing manifests from untrusted sources or public repositories with lax security standards. Developers contributing to projects that utilize such prompts should ensure their manifest files do not contain any non-printable characters or escape sequences in version fields. Additionally, terminal emulators can be configured to restrict the execution of certain OSC commands if supported by the specific emulator software, adding a layer of defense-in-depth against this class of prompt injection attacks.