Sudoedit Bypass
CVE-2023-22809
Theory
Sudo uses user-provided environment variables to let its users select their editor of choice. The content of these variables extends the actual command passed to the sudo_edit() function. However, the latter relies on the presence of the --
argument to determine the list of files to edit. The injection of an extra --
argument in one of the authorized environment variables can alter this list and lead to privilege escalation by editing any other file with privileges of the RunAs user. This issue occurs after the sudoers policy validation. - Synacktiv
The vulnerability affect sudo versions 1.8.0 to 1.9.12p1.
Practice
To exploit, sudo version must be vulnerable (1.8.0 to 1.9.12p1)
You must be able to run sudoedit with sudo
And env_delete shouldn't be set to affected variables:
References
Last updated