Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-54057

CVE-2026-54057: Kovidgoyal Kitty RCE Vulnerability

CVE-2026-54057 is a remote code execution flaw in Kovidgoyal Kitty terminal that allows attackers to inject unsanitized input. This post covers technical details, affected versions, security impact, and mitigation.

Published:

CVE-2026-54057 Overview

CVE-2026-54057 affects Kitty, a cross-platform GPU-based terminal emulator developed by kovidgoyal. The vulnerability exists in versions prior to 0.47.3. Kitty's OSC 21 (color-control) query reply reflects attacker-controlled bytes, including newline characters, into the shell's input stream without sanitization. An attacker who can deliver crafted terminal escape sequences to a victim's terminal can inject commands that the shell may execute. The flaw is classified under CWE-94: Improper Control of Generation of Code. Version 0.47.3 fixes the issue.

Critical Impact

Attackers can inject arbitrary commands into a user's shell by delivering crafted OSC 21 escape sequences, leading to local code execution in the victim's terminal session.

Affected Products

  • Kovidgoyal Kitty terminal emulator versions prior to 0.47.3
  • All platforms supported by Kitty (Linux, macOS)
  • Shell sessions that process OSC 21 color-control replies

Discovery Timeline

  • 2026-06-12 - CVE-2026-54057 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2026-54057

Vulnerability Analysis

The vulnerability resides in Kitty's handling of OSC 21 escape sequences. Operating System Command (OSC) 21 is a control sequence used to query or set terminal color values. When the terminal receives an OSC 21 query, it constructs a reply and writes it back to the shell's input stream (stdin). The reply construction does not sanitize attacker-controlled bytes embedded in the query. Newline characters and other control bytes pass through unchanged.

Because the reply is delivered to the shell's input, any newline byte triggers command execution in interactive shells. An attacker who can cause the victim's terminal to render a malicious payload, such as through cat-ing a crafted file, viewing a log entry, or printing remote SSH output, can drive arbitrary commands into the shell. This pattern is a classic terminal escape injection issue.

Root Cause

The root cause is missing input sanitization in the OSC 21 reply path. The terminal echoes attacker-controlled query content back to the shell verbatim. Control bytes including \n and \r are not filtered or escaped. Refer to the Kitty GHSA-5gmr-9gwg-hhq6 advisory for upstream technical details.

Attack Vector

Exploitation requires local user interaction. The victim must render attacker-controlled content in a vulnerable Kitty terminal. Common delivery channels include log files, file contents printed to the terminal, SSH session output from a compromised host, or chat clients that pass through escape sequences. Once the OSC 21 query is rendered, the malicious reply is injected into the shell's input buffer, and a trailing newline causes the shell to execute the injected text as a command.

No verified public exploit code is available at this time. The vulnerability mechanism is described in the upstream security advisory.

Detection Methods for CVE-2026-54057

Indicators of Compromise

  • Unexpected shell history entries containing commands the user did not type, often preceded by escape sequence artifacts
  • Files, logs, or network output containing raw \\x1b]21; OSC 21 sequences with embedded newline (\\x0a) or carriage return (\\x0d) bytes
  • Kitty terminal versions below 0.47.3 reported by kitty --version on user endpoints

Detection Strategies

  • Inventory installed Kitty versions across Linux and macOS endpoints and flag any release earlier than 0.47.3
  • Inspect content destined for terminal rendering, including log shipping pipelines and message-of-the-day banners, for embedded OSC 21 sequences with control bytes
  • Correlate process execution telemetry with shell history to identify commands that were executed without a corresponding parent input event

Monitoring Recommendations

  • Monitor endpoint process trees for unexpected child processes spawned from interactive shells running inside Kitty
  • Alert on file reads or cat operations against untrusted files immediately preceded by anomalous shell command execution
  • Track package manager events that install or update the kitty package to verify remediation status

How to Mitigate CVE-2026-54057

Immediate Actions Required

  • Upgrade Kitty to version 0.47.3 or later on all affected endpoints
  • Restart any running Kitty sessions after the upgrade to ensure the patched binary is in use
  • Audit recently rendered untrusted content, including logs and SSH session output, for signs of OSC 21 injection attempts

Patch Information

The maintainer released a fix in Kitty version 0.47.3 that sanitizes OSC 21 reply bytes before writing them to the shell input. See the GitHub Security Advisory GHSA-5gmr-9gwg-hhq6 for the official remediation details.

Workarounds

  • Avoid rendering untrusted file content, logs, or remote output in Kitty until the upgrade to 0.47.3 is applied
  • Use tools such as less -R with caution, or pipe untrusted input through filters that strip escape sequences before display
  • Disable or restrict OSC color-control sequence processing where configuration permits, until patching is complete
bash
# Verify installed Kitty version and upgrade
kitty --version

# Example upgrade on macOS via Homebrew
brew upgrade kitty

# Example upgrade on Arch Linux
sudo pacman -Syu kitty

# Strip escape sequences from untrusted input before display
cat untrusted.log | sed 's/\\x1b\[[0-9;]*[a-zA-Z]//g; s/\\x1b\][^\\x07]*\\x07//g'

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.