From patchwork Tue Nov 15 08:48:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hitendra Prajapati X-Patchwork-Id: 15480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE05C433FE for ; Tue, 15 Nov 2022 08:48:24 +0000 (UTC) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mx.groups.io with SMTP id smtpd.web12.3487.1668502096456138368 for ; Tue, 15 Nov 2022 00:48:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@mvista.com header.s=google header.b=VMNyZ+ba; spf=pass (domain: mvista.com, ip: 209.85.210.179, mailfrom: hprajapati@mvista.com) Received: by mail-pf1-f179.google.com with SMTP id q9so13515052pfg.5 for ; Tue, 15 Nov 2022 00:48:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mUGVWPewWW1L5+aBEieCDJra7B42BYQQZRhjKFRxIpA=; b=VMNyZ+baTsRj7/SiPvyDK1Dx9gFz+OZG9Yqf2kM+6uvPDoBwcVPmnocr7RdZxEPSQ2 m7ooU5dIUAoERp4afCoDIiVObkFUIAn3wT9VmtfCSaW0UeL+Px4rxep0yHJ4juZNoySz 9x4P+tSVRuOEm0jy8cqT+b5prYVBy/YqjDSBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mUGVWPewWW1L5+aBEieCDJra7B42BYQQZRhjKFRxIpA=; b=mrUsFPy38N55IpEuM1aKjDiUGDTIzwAPbCFzEHjIi1AtHyUnlwPzTqnss0uX28ucrQ WztyH0LV31ZrsfgO5jCG3dN9l9WR8JNfvab7FSxMr6KYCttqz9BTPUxLbAyLrwFJCSQ2 2dFYn4YMBNF6f3pNnf65XncgkgYEuUbzPj1Sc55sJebJ8qBTGZD2dlkeW2be1UEe6Vk+ ESdBsAqcDEF/IB2Hv+/laRA+R/DNYCplTdSqeE5mNUQ7Mzejyo9mbnsihWkwPDYV3SKF 8VL4FxT0y05EmGmshKYgxLgFhTvlBfJhO1CeUOna8+azRu8uEmvIsVZ377Vt9vBor5eS puow== X-Gm-Message-State: ANoB5pnQwnNW2WpKeOh2XXYH7otVFCSt53wwktcoXFrnLc+yOK7lU6kW 0YaKCL/Yt9EwLjp78Pmrx0eJnz8T8tHiVg== X-Google-Smtp-Source: AA0mqf41kBYgOoDkFkdqrenPaJWEOeaGYKZjIJ7/mMPlL8UpJ2u16S23PbrWvCHxWqrRanZO6sxU1w== X-Received: by 2002:a63:5c45:0:b0:439:6dfb:3bc3 with SMTP id n5-20020a635c45000000b004396dfb3bc3mr14906945pgm.167.1668502095442; Tue, 15 Nov 2022 00:48:15 -0800 (PST) Received: from MVIN00024 ([43.249.234.235]) by smtp.gmail.com with ESMTPSA id u7-20020a17090341c700b001782a0d3eeasm9230005ple.115.2022.11.15.00.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 00:48:15 -0800 (PST) Received: by MVIN00024 (sSMTP sendmail emulation); Tue, 15 Nov 2022 14:18:09 +0530 From: Hitendra Prajapati To: openembedded-core@lists.openembedded.org Cc: Hitendra Prajapati Subject: [dunfell][PATCH] sudo: CVE-2022-43995 heap-based overflow with very small passwords Date: Tue, 15 Nov 2022 14:18:07 +0530 Message-Id: <20221115084807.44099-1-hprajapati@mvista.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 15 Nov 2022 08:48:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/173267 Upstream-Status: Backport from https://github.com/sudo-project/sudo/commit/bd209b9f16fcd1270c13db27ae3329c677d48050 Signed-off-by: Hitendra Prajapati --- .../sudo/sudo/CVE-2022-43995.patch | 59 +++++++++++++++++++ meta/recipes-extended/sudo/sudo_1.8.32.bb | 1 + 2 files changed, 60 insertions(+) create mode 100644 meta/recipes-extended/sudo/sudo/CVE-2022-43995.patch diff --git a/meta/recipes-extended/sudo/sudo/CVE-2022-43995.patch b/meta/recipes-extended/sudo/sudo/CVE-2022-43995.patch new file mode 100644 index 0000000000..1336c7701d --- /dev/null +++ b/meta/recipes-extended/sudo/sudo/CVE-2022-43995.patch @@ -0,0 +1,59 @@ +From e1554d7996a59bf69544f3d8dd4ae683027948f9 Mon Sep 17 00:00:00 2001 +From: Hitendra Prajapati +Date: Tue, 15 Nov 2022 09:17:18 +0530 +Subject: [PATCH] CVE-2022-43995 + +Upstream-Status: Backport [https://github.com/sudo-project/sudo/commit/bd209b9f16fcd1270c13db27ae3329c677d48050] +CVE: CVE-2022-43995 +Signed-off-by: Hitendra Prajapati + +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 03c7a16..76a7824 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); +-- +2.25.1 + diff --git a/meta/recipes-extended/sudo/sudo_1.8.32.bb b/meta/recipes-extended/sudo/sudo_1.8.32.bb index 8d16ec2538..10785beedf 100644 --- a/meta/recipes-extended/sudo/sudo_1.8.32.bb +++ b/meta/recipes-extended/sudo/sudo_1.8.32.bb @@ -4,6 +4,7 @@ SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ file://0001-Include-sys-types.h-for-id_t-definition.patch \ file://0001-Fix-includes-when-building-with-musl.patch \ + file://CVE-2022-43995.patch \ " PAM_SRC_URI = "file://sudo.pam"