Skip to content
Snippets Groups Projects
Commit 6974b6e1 authored by Natanael Copa's avatar Natanael Copa
Browse files

community/sudo: backport fix for CVE-2022-43995

(cherry picked from commit 6de85be8)
parent baf47b6e
No related branches found
No related tags found
2 merge requests!54607main/sofia-sip: backport support for forking SIP calls,!41733community/linux-edge: fix build on x86_64
...@@ -8,14 +8,15 @@ if [ "${pkgver%_*}" != "$pkgver" ]; then ...@@ -8,14 +8,15 @@ if [ "${pkgver%_*}" != "$pkgver" ]; then
else else
_realver=$pkgver _realver=$pkgver
fi fi
pkgrel=0 pkgrel=1
pkgdesc="Give certain users the ability to run some commands as root" pkgdesc="Give certain users the ability to run some commands as root"
url="https://www.sudo.ws/sudo/" url="https://www.sudo.ws/sudo/"
arch="all" arch="all"
license="custom ISC" license="custom ISC"
makedepends="zlib-dev bash mandoc" makedepends="zlib-dev bash mandoc"
subpackages="$pkgname-doc $pkgname-dev" subpackages="$pkgname-doc $pkgname-dev"
source="https://www.sudo.ws/dist/sudo-$_realver.tar.gz" source="https://www.sudo.ws/dist/sudo-$_realver.tar.gz
CVE-2022-43995.patch"
options="suid" options="suid"
builddir="$srcdir/sudo-$_realver" builddir="$srcdir/sudo-$_realver"
...@@ -68,4 +69,5 @@ package() { ...@@ -68,4 +69,5 @@ package() {
sha512sums=" sha512sums="
34ee165baa2e37ba2530901d49bf0dad30159f27aeccd2519d4719bf93be8281edff71220a49ba2e41dacaa3c58031de1464df48d75a8caea7b9568a76f80b67 sudo-1.9.12.tar.gz 34ee165baa2e37ba2530901d49bf0dad30159f27aeccd2519d4719bf93be8281edff71220a49ba2e41dacaa3c58031de1464df48d75a8caea7b9568a76f80b67 sudo-1.9.12.tar.gz
47f7b14663a2e98dc98190346361f447c4a0b71fa3074d2c9dcaf15ef0cac7621bea27e25cced6f6005ada4deb4b11521dc418bf25bca18b70feafc6f7e6f359 CVE-2022-43995.patch
" "
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.
---
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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment