CVE-2026-72913 Overview
CVE-2026-72913 is a command injection vulnerability [CWE-77] in Kitty, a cross-platform GPU-based terminal emulator. Versions prior to 0.48.2 process @kitty-echo and @kitty-ssh Device Control String (DCS) sequences without authentication. The handle_remote_echo and handle_remote_ssh handlers in kitty/window.py write attacker-controlled data directly to the child shell's stdin. Chaining these handlers produces a newline-terminated command that the shell executes when a user displays untrusted terminal content, such as cating a malicious file or viewing remote logs.
Critical Impact
Attackers can execute arbitrary shell commands on a victim's system by convincing them to display crafted terminal output in a vulnerable Kitty session.
Affected Products
- Kitty terminal emulator versions prior to 0.48.2
- kitty/window.py DCS handlers (handle_remote_echo, handle_remote_ssh)
- kittens/ssh/utils.pyget_ssh_data function
Discovery Timeline
- 2026-08-10 - CVE-2026-72913 published to NVD
- 2026-08-11 - Last updated in NVD database
Technical Details for CVE-2026-72913
Vulnerability Analysis
Kitty processes Device Control String sequences that route data to internal handlers. The @kitty-echo DCS handler passes printable shell command characters to the child shell's stdin without validating the source or authenticating the request. The @kitty-ssh DCS handler invokes get_ssh_data in kittens/ssh/utils.py, which appends a newline character to its output.
An attacker chains the two handlers to construct a full shell command line. The echo handler injects the command characters and the SSH handler supplies the terminating newline. The shell then executes the assembled command in the user's active session. This vulnerability [CWE-77] falls under the Command Injection class of flaws.
Root Cause
The DCS handlers trust any data reaching the terminal, including bytes originating from files, network streams, or remote hosts. Kitty lacks a check that distinguishes attacker-supplied terminal data from legitimate control sequences issued by the user's own shell or kitten helpers.
Attack Vector
Exploitation requires local user interaction. The victim must render attacker-controlled bytes in a vulnerable Kitty window. Common delivery methods include:
- Viewing a malicious file with cat, less -R, or a pager
- Reading logs that contain attacker-supplied strings
- Connecting via SSH to a compromised host that emits crafted DCS sequences
The following patch fragments show the fix that constrains the echo canary to numeric characters only, breaking the command-assembly primitive.
// kittens/ssh/main.go - restrict canary characters
if err != nil {
return
}
- canary, err := secrets.TokenHex()
+ canary, err := secrets.TokenAlphabet(secrets.DEFAULT_NUM_OF_BYTES_FOR_TOKEN, "0123456789")
if err != nil {
return
}
Source: GitHub Commit 9dca948
// tools/utils/secrets/tokens.go - add math/big for constrained token generation
"crypto/rand"
"encoding/hex"
"fmt"
+ "math/big"
"github.com/emmansun/base64"
)
Source: GitHub Commit 9dca948
Detection Methods for CVE-2026-72913
Indicators of Compromise
- Unexpected @kitty-echo or @kitty-ssh DCS sequences in log files, terminal recordings, or captured output
- Shell history entries containing commands the user did not type, appearing immediately after viewing files or remote sessions
- Kitty child processes spawning shells or interpreters with unusual argument patterns
Detection Strategies
- Inspect terminal session recordings and log aggregators for the byte patterns \eP@kitty-echo and \eP@kitty-ssh originating from untrusted files or network streams
- Correlate Kitty process telemetry with subsequent child process creation events to identify commands not initiated by keyboard input
- Alert on Kitty binaries below version 0.48.2 inventoried across managed workstations and developer endpoints
Monitoring Recommendations
- Track process ancestry for Kitty sessions and flag shell descendants that execute after file rendering commands such as cat, tail, or less
- Ingest endpoint process telemetry into a centralized data lake to hunt across users for anomalous Kitty-spawned commands
- Monitor package manager and Homebrew logs for Kitty version rollbacks that would reintroduce the vulnerability
How to Mitigate CVE-2026-72913
Immediate Actions Required
- Upgrade Kitty to version 0.48.2 or later on every workstation, developer machine, and jump host
- Audit shell history and system logs on hosts running vulnerable Kitty builds for commands the user cannot account for
- Restrict rendering of untrusted files and remote logs until the upgrade is complete
Patch Information
The fix is released in Kitty v0.48.2. The upstream commit 9dca948e9bec3c926ab3370f2cd10f9b9b10821f constrains the echo canary alphabet and hardens the DCS handlers so attacker-supplied data cannot be chained into a shell command. Additional detail is available in the GitHub Security Advisory GHSA-ccp2-q4v6-rw94 and the Kitty changelog.
Workarounds
- Avoid using cat, tail, or other raw output commands on files from untrusted sources inside Kitty until patched
- Pipe untrusted content through sanitizers such as cat -v or less with control-sequence filtering to strip DCS bytes
- Disable SSH connections from vulnerable Kitty clients to hosts of unknown provenance
# Verify installed Kitty version and upgrade if below 0.48.2
kitty --version
# Example upgrade paths
brew upgrade kitty # macOS via Homebrew
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
# Strip escape sequences when viewing untrusted files
cat -v /path/to/untrusted.log | less
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

