CVE-2026-80430: Improper link resolution in the kitty drag and drop protocol allows a client to create files outside the staging directory
Improper Link Resolution Before File Access in the drag source staging path of the drag and drop protocol in kitty from 0.47.0 before 0.49.0 allows a program writing to the terminal to create files and directories at paths outside the staging directory, because subdirdatafordrag() in kitty/dnd.c resolves a descendant of the staged item tree by constructing a path string and opening it with safeopen(path, ODIRECTORY | ORDONLY, 0) rather than by walking the tree one component at a time, so a client that declares two entries with the same name, the first a symlink whose target is an arbitrary absolute path and the second a directory, causes mkdirat() to fail with EEXIST, which the code ignores, and causes the subsequent path resolution to follow the symlink and return a directory descriptor outside the staging directory, which is then passed as the dirfd argument to addpayload() and used for every further create operation on that item and its descendants. Entry names are sanitised against path separators and dot components, but symlink targets are not validated. Files are created with OCREAT | OWRONLY | OEXCL at mode 0644, so existing files cannot be overwritten, and directories are created with mkdirat() at mode 0755, so the attacker can create intermediate directories that did not previously exist. This results in the creation of files and directories at any path writable by the user running kitty, provided the symlink target is an existing directory.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
kittyto a version that resolves this vulnerability.Fixed in 0.49.0
Event History
Frequently Asked Questions
Which kitty versions are affected?
kitty versions from 0.47.0 up to, but not including, 0.49.0 are affected. Version 0.49.0 is the referenced fixed release.
What does an attacker need to exploit this?
An attacker needs to run or control a program that can write the crafted drag-and-drop protocol data to the terminal. The payload declares duplicate entry names: first a symlink to an arbitrary absolute path, then a directory with the same name.
What is the practical impact of a successful exploit?
The attacker can cause files and directories for the dragged item and its descendants to be created outside kitty's staging directory, under the directory targeted by the symlink. Existing files cannot be overwritten because file creation uses O_EXCL, and created files use mode 0644.