Description
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 subdir_data_for_drag() in kitty/dnd.c resolves a descendant of the staged item tree by constructing a path string and opening it with safe_open(path, O_DIRECTORY | O_RDONLY, 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 add_payload() 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 O_CREAT | O_WRONLY | O_EXCL 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.
Published: 2026-09-25
Score: 4.6 Medium
EPSS: n/a
KEV: No
Impact: Unauthorized file and directory creation outside the staging area
Action: Apply Patch
AI Analysis

Impact

The vulnerability lies in kitty’s drag source staging path for the drag and drop protocol. The implementation builds a path string and opens it with safe_open(…, O_DIRECTORY | O_RDONLY, 0) instead of validating each path component, allowing an attacker to craft a symlink whose target points to an arbitrary absolute directory and follow that link during file creation. When a client creates two entries with the same name—a symlink and then a directory—the code ignores a failed mkdirat, follows the symlink, and passes the resulting directory descriptor to add_payload, which is then used for every following create operation. This lets an attacker create files with O_CREAT | O_WRONLY | O_EXCL, mode 0644, and directories with mkdirat, mode 0755, anywhere that the kitty process user can write. Existing files cannot be overwritten, but new files and intermediate directories can be introduced outside the intended staging directory.

Affected Systems

Affected product is kitty, the terminal emulator from Kovid Goyal. All releases from 0.47.0 up to, but excluding, 0.49.0 are vulnerable. The issue appears when the drag and drop protocol is enabled, so any installation of those versions that allows dragging into other programs is at risk.

Risk and Exploitability

The CVSS score of 4.6 reflects moderate severity. EPSS data is not available, making the exploit probability unknown. The vulnerability is not in the CISA KEV catalog. Because the attack requires a program that can write to the terminal, it represents a local threat; it does not provide remote network access. An attacker with access to a process that writes to kitty’s terminal can place arbitrary files or directories at any location writable by that user, potentially compromising configuration files or launching subsequent attacks. Prompt mitigation is required to prevent exploitation.

Generated by OpenCVE AI on September 25, 2026 at 16:44 UTC.

Remediation

Vendor Solution

Upgrade to kitty 0.49.0 or later.


OpenCVE Recommended Actions

  • Upgrade kitty to version 0.49.0 or later, which includes the fixed drag and drop path resolution logic.
  • If upgrading is not possible, disable the drag and drop feature in kitty’s configuration file (.kitty.conf) to prevent the vulnerability from being exercised.
  • Limit the terminal session to trusted users or restrict the tty device to prevent untrusted programs from writing to the terminal used by kitty.

Generated by OpenCVE AI on September 25, 2026 at 16:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 25 Sep 2026 13:30:00 +0000

Type Values Removed Values Added
Description 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 subdir_data_for_drag() in kitty/dnd.c resolves a descendant of the staged item tree by constructing a path string and opening it with safe_open(path, O_DIRECTORY | O_RDONLY, 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 add_payload() 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 O_CREAT | O_WRONLY | O_EXCL 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.
Title Improper link resolution in the kitty drag and drop protocol allows a client to create files outside the staging directory
First Time appeared Kovidgoyal
Kovidgoyal kitty
Weaknesses CWE-59
CPEs cpe:2.3:a:kovidgoyal:kitty:*:*:*:*:*:*:*:*
Vendors & Products Kovidgoyal
Kovidgoyal kitty
References
Metrics cvssV4_0

{'score': 4.6, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N'}


Subscriptions

Kovidgoyal Kitty
cve-icon MITRE

Status: PUBLISHED

Assigner: Secur0

Published:

Updated: 2026-09-25T15:29:22.714Z

Reserved: 2026-08-26T10:49:00.437Z

Link: CVE-2026-80430

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-09-25T14:17:19.067

Modified: 2026-09-25T16:17:27.737

Link: CVE-2026-80430

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-25T16:45:08Z

Weaknesses
  • CWE-59

    Improper Link Resolution Before File Access ('Link Following')