# CVE-2024-5742: Path traversal in Red Hat Enterprise Linux 10

> Attackers can escalate privileges by replacing Nano emergency files with malicious symlinks during a race condition after a crash.

- **Severity:** Medium 6.7 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 12 Jun 2024
- **Updated:** 15 Oct 2026
- **Also known as:** ALSA-2024:6986, ALSA-2024:9430, AZL-42612, AZL-42619, BELL-CVE-2024-5742, CLSA-2026-1779122764, DEBIAN-CVE-2024-5742, DLA-3831-1, GHSA-ffhx-2rrf-9c23, MGASA-2024-0223, OESA-2024-1735, RHSA-2024:6986, RHSA-2024:9430, RLSA-2024:6986, RLSA-2024:9430, UBUNTU-CVE-2024-5742, USN-7064-1, USN-7064-2, openSUSE-SU-2024:0157-1, openSUSE-SU-2024:0157-2, openSUSE-SU-2024:14034-1

## What is CVE-2024-5742?

CVE-2024-5742 is a medium-severity path traversal vulnerability in Redhat Enterprise Linux, published on 12 Jun 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### 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.

Weakness: CWE-59 (Improper Link Resolution Before File Access)

## Which versions are affected by CVE-2024-5742?

It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nano` | AlmaLinux:8 | All versions | 2.9.8-3.el8_10 |
| `nano` | AlmaLinux:9 | All versions | 5.6.1-6.el9 |
| `nano` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.9.8-3.el8_10 |
| `nano-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.9.8-3.el8_10 |
| `nano-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.9.8-3.el8_10 |
| `nano` | Red Hat:enterprise_linux:9::baseos | All versions | 0:5.6.1-6.el9 |
| `nano-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:5.6.1-6.el9 |
| `nano-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:5.6.1-6.el9 |
| `nano` | Rocky Linux:8 | All versions | 0:2.9.8-3.el8_10 |
| `nano` | Rocky Linux:9 | All versions | 0:5.6.1-6.el9 |
| `nano` | SUSE:Package Hub 15 SP5 | All versions | 7.2-bp156.3.3.1 |
| `nano` | SUSE:Package Hub 15 SP5 | All versions | 7.2-bp156.3.3.1 |
| `nano` | SUSE:Package Hub 15 SP6 | All versions | 7.2-bp156.3.3.1 |
| `nano` | SUSE:Package Hub 15 SP6 | All versions | 7.2-bp156.3.3.1 |
| `nano` | openSUSE:Leap 15.5 | All versions | 7.2-bp156.3.3.1 |
| `nano` | openSUSE:Leap 15.5 | All versions | 7.2-bp156.3.3.1 |
| `nano` | openSUSE:Leap 15.6 | All versions | 7.2-bp156.3.3.1 |
| `nano` | openSUSE:Leap 15.6 | All versions | 7.2-bp156.3.3.1 |
| `nano` | openSUSE:Tumbleweed | All versions | 8.0-2.1 |

Products: Gnu Nano, Redhat Enterprise Linux.

## How do I fix CVE-2024-5742?

Apply the vendor's patch.

## Is CVE-2024-5742 being exploited?

There is no known exploitation of CVE-2024-5742 in the wild and no public exploit code.

## Other vulnerabilities in Redhat Enterprise Linux

- [CVE-2026-6843](https://insights.sbomify.com/CVE-2026-6843/): Nano: nano: format string vulnerability leads to denial of service (medium 5.5)
- [CVE-2010-1161](https://insights.sbomify.com/CVE-2010-1161/): Race condition in n/a (low 3.7)
- [CVE-2010-1160](https://insights.sbomify.com/CVE-2010-1160/): Path traversal in n/a (low 1.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-5742 and fix it if it is affected.

What it is: CVE-2024-5742 is a medium-severity path traversal vulnerability in Redhat Enterprise Linux, published on 12 Jun 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-5742 in the wild and no public exploit code.

Affected product: Redhat Enterprise Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-5742/ (Markdown: https://insights.sbomify.com/CVE-2024-5742/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-5742
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-5742
- OSV: https://osv.dev/vulnerability/CVE-2024-5742

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-5742/
Summaries are generated and may contain mistakes; the official description above is the record.
