# CVE-2023-22809: Privilege escalation in n/a

> A local attacker can escalate privileges by manipulating editor environment variables in sudoedit to append arbitrary files to the processing list.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/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:** Not needed
- **Fix available:** Yes
- **Published:** 18 Jan 2023
- **Updated:** 4 Apr 2025
- **Also known as:** ALPINE-CVE-2023-22809, ALSA-2023:0282, ALSA-2023:0284, AZL-13030, CLSA-2023-1675984342, CLSA-2023-1675984682, CLSA-2023-1675985375, CLSA-2023-1675985571, CLSA-2023-1675986271, DEBIAN-CVE-2023-22809, DLA-3272-1, DSA-5321-1, GHSA-3vwp-294x-6v9c, MGASA-2023-0025, OESA-2023-1049, RHSA-2023:0280, RHSA-2023:0281, RHSA-2023:0282, RHSA-2023:0283, RHSA-2023:0284, RHSA-2023:0287, RHSA-2023:0291, RHSA-2023:0292, RHSA-2023:0293, RHSA-2023:3262, RHSA-2023:3264, RHSA-2023:3276, RLSA-2023:0282, RLSA-2023:0284, SUSE-SU-2023:0100-1, SUSE-SU-2023:0101-1, SUSE-SU-2023:0114-1, SUSE-SU-2023:0115-1, SUSE-SU-2023:0116-1, SUSE-SU-2023:0117-1, UBUNTU-CVE-2023-22809, USN-5811-2, USN-5811-3, openSUSE-SU-2024:12638-1

## What is CVE-2023-22809?

CVE-2023-22809 is a high-severity vulnerability in Apple Macos, published on 18 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

In Sudo before 1.9.12p2, the sudoedit (aka -e) feature mishandles extra arguments passed in the user-provided environment variables (SUDO_EDITOR, VISUAL, and EDITOR), allowing a local attacker to append arbitrary entries to the list of files to process. This can lead to privilege escalation. Affected versions are 1.8.0 through 1.9.12.p1. The problem exists because a user-specified editor may contain a "--" argument that defeats a protection mechanism, e.g., an EDITOR='vim -- /path/to/extra/file' value.

Weakness: CWE-269 (Improper Privilege Management)

## Which versions are affected by CVE-2023-22809?

It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sudo` | AlmaLinux:8 | All versions | 1.8.29-8.el8_7.1 |
| `sudo` | AlmaLinux:9 | All versions | 1.9.5p2-7.el9_1.1 |
| `sudo-python-plugin` | AlmaLinux:9 | All versions | 1.9.5p2-7.el9_1.1 |
| `sudo` | Red Hat:enterprise_linux:7::client | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:7::client | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-devel` | Red Hat:enterprise_linux:7::client | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-devel` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo` | Red Hat:enterprise_linux:7::server | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:7::server | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-devel` | Red Hat:enterprise_linux:7::server | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo-devel` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.8.23-10.el7_9.3 |
| `sudo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.8.29-8.el8_7.1 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.8.29-8.el8_7.1 |
| `sudo-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.8.29-8.el8_7.1 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-python-plugin` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-python-plugin-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo-python-plugin-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.9.5p2-7.el9_1.1 |
| `sudo` | Red Hat:rhel_aus:7.4::server | All versions | 0:1.8.19p2-12.el7_4.3 |
| `sudo-debuginfo` | Red Hat:rhel_aus:7.4::server | All versions | 0:1.8.19p2-12.el7_4.3 |
| `sudo-devel` | Red Hat:rhel_aus:7.4::server | All versions | 0:1.8.19p2-12.el7_4.3 |
| `sudo` | Red Hat:rhel_aus:7.6::server | All versions | 0:1.8.23-3.el7_6.3 |
| `sudo-debuginfo` | Red Hat:rhel_aus:7.6::server | All versions | 0:1.8.23-3.el7_6.3 |
| `sudo-devel` | Red Hat:rhel_aus:7.6::server | All versions | 0:1.8.23-3.el7_6.3 |
| `sudo` | Red Hat:rhel_aus:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |
| `sudo-debuginfo` | Red Hat:rhel_aus:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |
| `sudo-devel` | Red Hat:rhel_aus:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |
| `sudo` | Red Hat:rhel_aus:8.2::baseos | All versions | 0:1.8.29-5.el8_2.2 |
| `sudo-debuginfo` | Red Hat:rhel_aus:8.2::baseos | All versions | 0:1.8.29-5.el8_2.2 |
| `sudo-debugsource` | Red Hat:rhel_aus:8.2::baseos | All versions | 0:1.8.29-5.el8_2.2 |
| `sudo` | Red Hat:rhel_e4s:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |
| `sudo-debuginfo` | Red Hat:rhel_e4s:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |
| `sudo-devel` | Red Hat:rhel_e4s:7.7::server | All versions | 0:1.8.23-4.el7_7.4 |

Products: Apple Macos, Debian Debian Linux, Fedoraproject Fedora, Sudo Project Sudo.

## How do I fix CVE-2023-22809?

Upgrade to a fixed version.

## Is CVE-2023-22809 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22809 exists.

Public exploit code:

- A script to automate privilege escalation with CVE-2023-22809 vulnerability (github_poc): https://github.com/n3m1sys/CVE-2023-22809-sudoedit-privesc
- https://github.com/M4fiaB0y/CVE-2023-22809 (github_poc): https://github.com/M4fiaB0y/CVE-2023-22809
- CVE-2023-22809 Linux Sudo (github_poc): https://github.com/P4x1s/CVE-2023-22809-sudo-POC
- https://github.com/asepsaepdin/CVE-2023-22809 (github_poc): https://github.com/asepsaepdin/CVE-2023-22809
- Analysis & Exploit (github_poc): https://github.com/Chan9Yan9/CVE-2023-22809
- Running this exploit on a vulnerable system allows a local attacker to gain a root shell on the machine. (github_poc): https://github.com/Toothless5143/CVE-2023-22809

## Other vulnerabilities in Apple Macos

- [CVE-2026-65400](https://insights.sbomify.com/CVE-2026-65400/): Apple macOS Improper Authentication (critical 9.8, exploited in the wild)
- [CVE-2024-44146](https://insights.sbomify.com/CVE-2024-44146/): Security feature bypass in macOS (critical 10.0)
- [CVE-2024-44148](https://insights.sbomify.com/CVE-2024-44148/): Security feature bypass in macOS (critical 10.0)
- [CVE-2023-38586](https://insights.sbomify.com/CVE-2023-38586/): Security feature bypass in macOS (critical 10.0)
- [CVE-2023-40455](https://insights.sbomify.com/CVE-2023-40455/): Security feature bypass in macOS (critical 10.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-22809 and fix it if it is affected.

What it is: CVE-2023-22809 is a high-severity vulnerability in Apple Macos, published on 18 Jan 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22809 exists.

Affected product: Apple Macos. 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-2023-22809/ (Markdown: https://insights.sbomify.com/CVE-2023-22809/index.md)
```

## Sources

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

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