CVE-2026-80430: CWE-59 Improper Link Resolution Before File Access ('Link Following') in Kovid Goyal kitty
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.
AI Analysis
Technical Summary
This vulnerability arises from improper link resolution before file access in kitty's drag source staging path. Specifically, the function subdir_data_for_drag() in kitty/dnd.c constructs a path string and opens it with safe_open() instead of walking the directory tree component by component. An attacker can declare two entries with the same name: the first a symlink pointing to an arbitrary absolute path and the second a directory. The code ignores mkdirat() failure with EEXIST, causing subsequent path resolution to follow the symlink outside the staging directory. This directory descriptor is then used for creating files and directories, allowing creation at any path writable by the user running kitty. Entry names are sanitized, but symlink targets are not validated. Files are created with O_CREAT | O_WRONLY | O_EXCL and mode 0644, preventing overwriting existing files, and directories with mode 0755, allowing creation of intermediate directories.
Potential Impact
An attacker with the ability to write to the terminal can create files and directories at arbitrary paths writable by the user running kitty, outside the intended staging directory. This could lead to unauthorized file creation, potentially impacting user data or environment. However, existing files cannot be overwritten, and no privilege escalation or remote exploitation is indicated. The attack requires local access and user interaction.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, users should avoid running vulnerable versions (>=0.47.0 <0.49.0) or restrict access to trusted users only. Monitoring for updates from the vendor is recommended.
CVE-2026-80430: CWE-59 Improper Link Resolution Before File Access ('Link Following') in Kovid Goyal kitty
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.
CVSS v4.0
Score 4.6medium
Affected software
Kovid Goyal
kitty
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
This vulnerability arises from improper link resolution before file access in kitty's drag source staging path. Specifically, the function subdir_data_for_drag() in kitty/dnd.c constructs a path string and opens it with safe_open() instead of walking the directory tree component by component. An attacker can declare two entries with the same name: the first a symlink pointing to an arbitrary absolute path and the second a directory. The code ignores mkdirat() failure with EEXIST, causing subsequent path resolution to follow the symlink outside the staging directory. This directory descriptor is then used for creating files and directories, allowing creation at any path writable by the user running kitty. Entry names are sanitized, but symlink targets are not validated. Files are created with O_CREAT | O_WRONLY | O_EXCL and mode 0644, preventing overwriting existing files, and directories with mode 0755, allowing creation of intermediate directories.
Potential Impact
An attacker with the ability to write to the terminal can create files and directories at arbitrary paths writable by the user running kitty, outside the intended staging directory. This could lead to unauthorized file creation, potentially impacting user data or environment. However, existing files cannot be overwritten, and no privilege escalation or remote exploitation is indicated. The attack requires local access and user interaction.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, users should avoid running vulnerable versions (>=0.47.0 <0.49.0) or restrict access to trusted users only. Monitoring for updates from the vendor is recommended.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- Secur0
- Date Reserved
- 2026-08-26T10:49:00.437Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6ab67829f7a7c54106d2774c
Added to database: 09/25/2026, 13:33:29 UTC
Last enriched: 09/25/2026, 13:47:47 UTC
Last updated: 09/25/2026, 16:41:57 UTC
Views: 8
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.