# CVE-2026-42851: Kitty terminal emulator remote code execution via geninclude directive

Source: https://junglewise.ai/threats/cve-2026-42851-kitty-terminal-emulator-remote-code-execution-via-geninclude  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-12. Updated: 2026-06-12  
License: CC BY 4.0 with a link back

CVE-2026-42851 · Severity: high · CVSS 7.8 · Published 2026-06-12

Kitty, a popular high-performance terminal emulator, contains a vulnerability that allows malicious code to run automatically when a user views certain text. If a user displays a specially crafted file or connects to a malicious server using 'cat', 'less', or SSH, an attacker can execute commands on the user's computer with their full permissions. This could lead to total system compromise, data theft, or the installation of malware without any warning or approval prompts.

## Quick answers

**Is CVE-2026-42851 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-42851 being exploited in the wild.

**How severe is CVE-2026-42851?** High severity, with a CVSS score of 7.8, published 12 June 2026.

**Which products and versions are affected?** kovidgoyal kitty < 0.47.0.

**Is there a fix for CVE-2026-42851?** A patch was published on 2026-06-12: Version 0.47.0 released to address the vulnerability Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-42851 attacked?** It is attacked with local access or over the network, in a network appliance.

**Am I affected by CVE-2026-42851?** Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A vulnerability exists in kitty's handling of the private Device Control String (DCS) sequence '@kitty-edit|'. An attacker can bypass existing security mitigations by using the '--color' option within this sequence to trigger the 'geninclude' configuration directive. Because 'geninclude' uses 'runpy.run_path()' to process .py files, an attacker who can write bytes to the terminal (via SSH, log files, or 'cat') can force the kitty process to execute arbitrary Python code in-process. The attack requires no special permissions, remote-control settings, or user interaction beyond the victim viewing the malicious output. The issue is fixed in version 0.47.0.

## Affected products

- kovidgoyal kitty < 0.47.0

## Timeline

- 2026-05-19: advisory: GitHub advisory GHSA-w98g-hpvr-r332 published
- 2026-06-12: disclosed: CVE-2026-42851 published to NVD
- 2026-06-12: patched: Version 0.47.0 released to address the vulnerability

## References

- [https://github.com/kovidgoyal/kitty/security/advisories/GHSA-w98g-hpvr-r332](https://github.com/kovidgoyal/kitty/security/advisories/GHSA-w98g-hpvr-r332)
