package/sudo: fix CVE-2022-43995
Sudo 1.8.0 through 1.9.12, with the crypt() password backend, contains a plugins/sudoers/auth/passwd.c array-out-of-bounds error that can result in a heap-based buffer over-read. This can be triggered by arbitrary local users with access to Sudo by entering a password of seven characters or fewer. The impact could vary depending on the compiler and processor architecture. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
4721367deb
commit
2663449036
53
package/sudo/0001-Fix-CVE-2022-43995.patch
Normal file
53
package/sudo/0001-Fix-CVE-2022-43995.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From bd209b9f16fcd1270c13db27ae3329c677d48050 Mon Sep 17 00:00:00 2001
|
||||
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
|
||||
Date: Fri, 28 Oct 2022 07:29:55 -0600
|
||||
Subject: [PATCH] Fix CVE-2022-43995, potential heap overflow for passwords < 8
|
||||
characters. Starting with sudo 1.8.0 the plaintext password buffer is
|
||||
dynamically sized so it is not safe to assume that it is at least 9 bytes in
|
||||
size. Found by Hugo Lefeuvre (University of Manchester) with ConfFuzz.
|
||||
|
||||
[Retrieved from:
|
||||
https://github.com/sudo-project/sudo/commit/bd209b9f16fcd1270c13db27ae3329c677d48050]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
plugins/sudoers/auth/passwd.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/plugins/sudoers/auth/passwd.c b/plugins/sudoers/auth/passwd.c
|
||||
index b2046eca2..0416861e9 100644
|
||||
--- a/plugins/sudoers/auth/passwd.c
|
||||
+++ b/plugins/sudoers/auth/passwd.c
|
||||
@@ -63,7 +63,7 @@ sudo_passwd_init(struct passwd *pw, sudo_auth *auth)
|
||||
int
|
||||
sudo_passwd_verify(struct passwd *pw, char *pass, sudo_auth *auth, struct sudo_conv_callback *callback)
|
||||
{
|
||||
- char sav, *epass;
|
||||
+ char des_pass[9], *epass;
|
||||
char *pw_epasswd = auth->data;
|
||||
size_t pw_len;
|
||||
int matched = 0;
|
||||
@@ -75,12 +75,12 @@ sudo_passwd_verify(struct passwd *pw, char *pass, sudo_auth *auth, struct sudo_c
|
||||
|
||||
/*
|
||||
* Truncate to 8 chars if standard DES since not all crypt()'s do this.
|
||||
- * If this turns out not to be safe we will have to use OS #ifdef's (sigh).
|
||||
*/
|
||||
- sav = pass[8];
|
||||
pw_len = strlen(pw_epasswd);
|
||||
- if (pw_len == DESLEN || HAS_AGEINFO(pw_epasswd, pw_len))
|
||||
- pass[8] = '\0';
|
||||
+ if (pw_len == DESLEN || HAS_AGEINFO(pw_epasswd, pw_len)) {
|
||||
+ strlcpy(des_pass, pass, sizeof(des_pass));
|
||||
+ pass = des_pass;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Normal UN*X password check.
|
||||
@@ -88,7 +88,6 @@ sudo_passwd_verify(struct passwd *pw, char *pass, sudo_auth *auth, struct sudo_c
|
||||
* only compare the first DESLEN characters in that case.
|
||||
*/
|
||||
epass = (char *) crypt(pass, pw_epasswd);
|
||||
- pass[8] = sav;
|
||||
if (epass != NULL) {
|
||||
if (HAS_AGEINFO(pw_epasswd, pw_len) && strlen(epass) == DESLEN)
|
||||
matched = !strncmp(pw_epasswd, epass, DESLEN);
|
@ -23,6 +23,9 @@ SUDO_CONF_OPTS = \
|
||||
--without-interfaces \
|
||||
--with-env-editor
|
||||
|
||||
# 0001-Fix-CVE-2022-43995.patch
|
||||
SUDO_IGNORE_CVES += CVE-2022-43995
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
|
||||
define SUDO_INSTALL_PAM_CONF
|
||||
$(INSTALL) -D -m 0644 package/sudo/sudo.pam $(TARGET_DIR)/etc/pam.d/sudo
|
||||
|
Loading…
Reference in New Issue
Block a user