CVE-2024-5742
Medium · 6.7CVSS
6.7
EPSS
0.3%
Published
Jun 12, 2024
CISA due date
—
Cloudanix analysis
Killing the editor while it is saving a backup file can let someone else on the same computer secretly redirect that backup to damage or control important files.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- High
- Impact
- Privilege Gain
- Component
- Application
- Class
- Privilege Escalation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw permits a local attacker to replace an emergency save file created by the editor with a malicious symlink; when the editor is terminated abruptly the file is written using the privileges of the running user, enabling the symlink to redirect the write and potentially overwrite or create files with elevated privileges.
Why it matters to the business
Attackers on the same system can gain unauthorized control over files or processes, leading to full compromise of user accounts or escalation to higher privileges; while not yet seen in ransomware the issue affects any environment running the vulnerable editor and increases operational risk until fixed.
How an attack unfolds
An attacker first creates a symlink in a world-writable directory pointing to a sensitive target file; the victim user then runs the editor on a file and is killed before saving, triggering the emergency file write that follows the attacker-controlled symlink and performs the privileged operation.
How to fix it
Upgrade to a version containing commit c1eb2ddf0f8075faddc5f7c3d39feae3e8e9d6b4 or later; until the update can be applied avoid running the editor with elevated privileges and ensure temporary directories have appropriate permissions.
How to confirm the fix worked
Confirm the installed binary or source matches a fixed commit hash; review process termination handling and temporary-file creation logic in the editor code to verify symlink-safe behavior.
Typical attack path
- Create a symlink from the expected emergency filename to a privileged target
- Wait for or induce the editor process to be killed while editing
- Trigger the emergency-save code path that writes using the running user's permissions
- Leverage the resulting file modification or creation for further privilege escalation
How to detect it
Review system logs for editor processes that terminated abnormally; inspect temporary directories for unexpected symlinks created around the time of editor crashes or kills; correlate file ownership changes on sensitive targets with editor emergency-save events.
What your security team should do
- Apply the listed fixed commit immediately on all affected systems
- Scan for any locally compiled or packaged instances of the editor
- Add monitoring for unexpected symlink creation in editor temporary directories
- Restrict use of the editor under privileged accounts until patched
The record
A vulnerability was found in GNU Nano that allows a possible privilege escalation through an insecure temporary file. If Nano is killed while editing, a file it saves to an emergency file with the permissions of the running user provides a window of opportunity for attackers to escalate privileges through a malicious symlink.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | nano | 0 | 2.9.8-3.el8_10 |
| AlmaLinux:9 | nano | 0 | 5.6.1-6.el9 |
| Debian:10 | nano | 0 | 3.2-3+deb10u1 |
| Debian:11 | nano | 0 | 5.4-2+deb11u3 |
| Debian:12 | nano | 0 | 7.2-1+deb12u1 |
| Debian:13 | nano | 0 | 8.0-1 |
| Mageia:9 | nano | 0 | 7.2-1.1.mga9 |
| Red Hat:enterprise_linux:8::baseos | nano | 0 | 0:2.9.8-3.el8_10 |
| Red Hat:enterprise_linux:8::baseos | nano-debuginfo | 0 | 0:2.9.8-3.el8_10 |
| Red Hat:enterprise_linux:8::baseos | nano-debugsource | 0 | 0:2.9.8-3.el8_10 |
| Red Hat:enterprise_linux:9::baseos | nano | 0 | 0:5.6.1-6.el9 |
| Red Hat:enterprise_linux:9::baseos | nano-debuginfo | 0 | 0:5.6.1-6.el9 |
| Red Hat:enterprise_linux:9::baseos | nano-debugsource | 0 | 0:5.6.1-6.el9 |
| Rocky Linux:8 | nano | 0 | 0:2.9.8-3.el8_10 |
| Rocky Linux:9 | nano | 0 | 0:5.6.1-6.el9 |
| SUSE:Package Hub 15 SP5 | nano | 0 | 7.2-bp156.3.3.1 |
| SUSE:Package Hub 15 SP6 | nano | 0 | 7.2-bp156.3.3.1 |
| Ubuntu:20.04:LTS | nano | 0 | 4.8-1ubuntu1.1 |
| Ubuntu:22.04:LTS | nano | 0 | 6.2-1ubuntu0.1 |
| Ubuntu:24.04:LTS | nano | 0 | 7.2-2ubuntu0.1 |
| Ubuntu:24.10 | nano | 0 | 8.0-1 |
| Ubuntu:Pro:14.04:LTS | nano | 0 | 2.2.6-1ubuntu1+esm1 |
| Ubuntu:Pro:16.04:LTS | nano | 0 | 2.5.3-2ubuntu2+esm1 |
| Ubuntu:Pro:18.04:LTS | nano | 0 | 2.9.3-2ubuntu0.1~esm1 |
| openSUSE:Leap 15.5 | nano | 0 | 7.2-bp156.3.3.1 |
| openSUSE:Leap 15.6 | nano | 0 | 7.2-bp156.3.3.1 |
| openSUSE:Tumbleweed | nano | 0 | 8.0-2.1 |
Related vulnerabilities
- CVE-2026-40556 Rejected reason: This CVE ID has been rejected or withdrawn by its CVE Numbering… Also affects nano
- CVE-2026-6843 A flaw was found in nano. Also affects nano
- CVE-2026-6842 A flaw was found in nano. Also affects nano
- CVE-2026-113724 virtualenv is a tool for creating isolated virtual python environments. CWE-59
- CVE-2026-113716 virtualenv is a tool for creating isolated virtual python environments. CWE-59
- CVE-2026-55480 OpenPrinting CUPS is an open source printing system for Linux and other Unix-like… CWE-59
- CVE-2026-90954 A flaw was found in BusyBox's dpkg-deb archive extraction. CWE-59
- CVE-2026-109274 ImageMagick before 7.1.2-32 contains a time-of-check time-of-use symlink race… CWE-59