Vulnerability · Published Jun 12, 2024 · Assigned by redhat

CVE-2024-5742Nano: running `chmod` and `chown` on the filename allows malicious user to replace the emergency file with a malicious symlink to a root-owned file

Medium 6.7

In plain English

A medium-severity security flaw in nano. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 28% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.7Medium
Exploit odds (30 days)0.3%top 71.9% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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 & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8nano2.9.8-3.el8_10ALSA-2024:6986
AlmaLinux:9nano5.6.1-6.el9ALSA-2024:9430
Debian:12nano7.2-1+deb12u1DEBIAN-CVE-2024-5742
Debian:13nano8.0-1DEBIAN-CVE-2024-5742
Debian:14nano8.0-1DEBIAN-CVE-2024-5742
Rocky Linux:8nano0:2.9.8-3.el8_10RLSA-2024:6986
Rocky Linux:9nano0:5.6.1-6.el9RLSA-2024:9430
Ubuntu:22.04:LTSnano6.2-1ubuntu0.1USN-7064-1
Ubuntu:22.04:LTSnano6.2-1ubuntu0.1UBUNTU-CVE-2024-5742
Ubuntu:24.04:LTSnano7.2-2ubuntu0.1UBUNTU-CVE-2024-5742
Ubuntu:24.04:LTSnano7.2-2ubuntu0.1USN-7064-1

Affected products (as reported)

VendorProductVersions
nano see references
Red Hat Red Hat Enterprise Linux 8 see references
Red Hat Red Hat Enterprise Linux 9 see references
Red Hat Red Hat Enterprise Linux 10 see references
Red Hat Red Hat Enterprise Linux 6 see references
Red Hat Red Hat Enterprise Linux 7 see references

Weakness: CWE-59 · Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H

References