CVE-2023-22809
NixOS vulnerability analysis and mitigation

Overview

In Sudo versions 1.8.0 through 1.9.12p1, a vulnerability was discovered in the sudoedit feature (CVE-2023-22809) that allows a local attacker to edit arbitrary files by manipulating environment variables. The vulnerability was discovered by Matthieu Barjole and Victor Cutillas of Synacktiv and was publicly disclosed on January 18, 2023 (Sudo Advisory, OSS Security).

Technical details

The vulnerability exists in sudo's -e option (sudoedit) where it mishandles extra arguments passed through user-provided environment variables (SUDOEDITOR, VISUAL, and EDITOR). The issue occurs because a user-specified editor may contain a "--" argument that defeats a protection mechanism, for example using EDITOR='vim -- /path/to/extra/file'. This allows bypassing the intended file restrictions ([Sudo Advisory](https://www.sudo.ws/security/advisories/sudoeditany/)).

Impact

When successfully exploited, this vulnerability allows a local user with sudoedit privileges to edit arbitrary files on the system, potentially leading to privilege escalation. The attacker can modify files outside their authorized scope, which could result in system compromise (Debian Advisory, Gentoo Advisory).

Mitigation and workarounds

The vulnerability was fixed in sudo version 1.9.12p2. For systems that cannot immediately update, a workaround exists by adding 'Defaults!sudoedit envdelete+="SUDOEDITOR VISUAL EDITOR"' to the sudoers file. For specific files, a CmndAlias can be used to restrict editor access ([Sudo Advisory](https://www.sudo.ws/security/advisories/sudoeditany/)).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

“Best User Experience I have ever seen, provides full visibility to cloud workloads.”
David EstlickCISO
“Wiz provides a single pane of glass to see what is going on in our cloud environments.”
Adam FletcherChief Security Officer
“We know that if Wiz identifies something as critical, it actually is.”
Greg PoniatowskiHead of Threat and Vulnerability Management