cbcvebase.
CVE-2023-22809
published 2023-01-18

CVE-2023-22809: 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…

PriorityP183high7.8CVSS 3.1
AVLACLPRLUINSUCHIHAH
ITWEXPLOITVulnCheck KEV
Exploited in the wild
EPSS
55.37%
98.9th percentile
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.

Affected

24 ranges
VendorProductVersion rangeFixed in
applemacos< 13.413.4
applemacos_ventura
debiandebian_linux
debiandebian_linux
debiansudo< sudo 1.9.12p2-1 (bookworm)sudo 1.9.12p2-1 (bookworm)
fedoraprojectfedora
fedoraprojectfedora
msrccbl2_sudo_1.9.12p2-1_on_cbl_mariner_2.0
msrccm1_sudo_1.9.12p2-1_on_cbl_mariner_1.0
paloaltocloud_ngfw
paloaltopan-os
paloaltoprisma_access
paloaltoprisma_sd-wan_ion
sudo_projectsudo
sudo_projectsudo>= 0 < 1.9.5p2-3+deb11u11.9.5p2-3+deb11u1
sudo_projectsudo>= 0 < 1.9.12p2-11.9.12p2-1
sudo_projectsudo>= 0 < 1.9.12p2-11.9.12p2-1
sudo_projectsudo>= 0 < 1.9.12p2-11.9.12p2-1
sudo_projectsudo>= 0 < 1.8.21p2-3ubuntu1.51.8.21p2-3ubuntu1.5
sudo_projectsudo>= 0 < 1.8.31-1ubuntu1.41.8.31-1ubuntu1.4
sudo_projectsudo>= 0 < 1.9.9-1ubuntu2.21.9.9-1ubuntu2.2
sudo_projectsudo>= 0 < 1.8.9p5-1ubuntu1.5+esm71.8.9p5-1ubuntu1.5+esm7
sudo_projectsudo>= 0 < 1.8.16-0ubuntu1.10+esm11.8.16-0ubuntu1.10+esm1
sudo_projectsudo>= 1.8.0 < 1.9.121.9.12

Detection & IOCsextracted from sources · hover to see the quote

commandEDITOR='vim -- /path/to/extra/file' sudoedit <file>
commandEDITOR="vim -- /etc/sudoers" sudoedit <permitted-file>
path/etc/sudoers
commandsudo -l | grep -E "sudoedit|sudo -e" | grep -E '\(root\)|\(ALL\)|\(ALL : ALL\)'
  • Monitor for sudoedit or 'sudo -e' invocations where SUDO_EDITOR, VISUAL, or EDITOR environment variables contain '--' followed by an additional file path, indicating an attempt to append arbitrary files to the edit list.
  • Alert on any sudoedit process where the editor environment variable (SUDO_EDITOR/VISUAL/EDITOR) contains the string ' -- ' (space-dash-dash-space), as this is the specific bypass mechanism used to defeat sudo's file-list protection.
  • Detect privilege escalation attempts by monitoring for unexpected writes to /etc/sudoers or sudoers.d files by processes spawned under sudoedit, especially when the writing user is not root.
  • On Ubuntu 22.04 and 22.10 systems, treat sudoedit abuse as higher risk; the Metasploit module specifically targets sudo 1.9.9-1ubuntu2 on Ubuntu 22.04 and 1.9.11p3-1ubuntu1 on Ubuntu 22.10.
  • Use pspy or equivalent process monitoring to detect when sensitive files (e.g., virtualenv activate scripts, cron-executed scripts) are modified by lower-privileged users via sudoedit, which may indicate CVE-2023-22809 exploitation.
  • ·The vulnerability only affects users who are already authorized by the sudoers policy to edit at least one file via sudoedit; it is not exploitable without an existing sudoedit permission entry.
  • ·A sudoers mitigation exists: adding 'Defaults!sudoedit env_delete+="SUDO_EDITOR VISUAL EDITOR"' prevents user-specified editors from being used, blocking the attack vector without patching.
  • ·Affected sudo versions are 1.8.0 through 1.9.12p1; the fix is present in 1.9.12p2 and later. Version checks in exploit tooling use the regex '(1\.8.*|1\.9\.[0-9]1?(p[1-3])?|1\.9\.12p1)' to confirm vulnerability.

CVSS provenance

nvdv3.17.8HIGHCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
osv7.8HIGH
vulncheck7.8HIGH
vendor_debian7.8HIGH
vendor_msrc7.8HIGH
vendor_oracle7.8HIGH
vendor_redhat7.8HIGH
vendor_ubuntu7.8HIGH
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.