From nobody Thu Feb 15 21:30:36 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TbSsS6xbCz5BHMH; Thu, 15 Feb 2024 21:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TbSsS4h9Wz4Sdp; Thu, 15 Feb 2024 21:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7gycz8+/iBHndwYYh7Qdv2EeBIFaRJVOhZ47nR3KXOA=; b=EGKiLKCaLU/CzUu6oU7rqNGck2u4eWIVSI9bA1B7CX58hnWAZysiF1sSnSZ6cTqNxQkgAU fwVahg4JUClUBWcOCWNEa/tydW/g0BGkpF7u+7Nk8QydFNJJuhlyqotAHxQsQX+wnKNmFu 71OfAxrG5akThch2YWiY/q0d7heaxGdMr+/NXJqOlG/hJjrSrftdxXpq8wwUuDODvDZU5q iLAB/FkU48ncxVSduLGdAKQyGE8SngWSsJb9AiFzaCJehgL9wACJb9t/pLbSSrsMTn2DRY hAe5KM9G+6O6LEKzFUf3F779HlVCm3IGyV0kXGGGE9zYjlllhS3xEa3wEePWwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708032636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7gycz8+/iBHndwYYh7Qdv2EeBIFaRJVOhZ47nR3KXOA=; b=kDq66oDFUhOPIt3HBDzZtr/RBYUxarEx/PCMibp3PR8jyxBhyI5fQGeIzVlIKa5t6NHS1k dBLj7GeUlzwI+3K1QhgTPRAaUl0slH3/xcyWm2kMqCGaZuK3Rl9Jh6JVnp3wIoPTowTEJX uNYcZgbr/myNPl0esUnUG0HGQQZEbI0fPMyi4RDLFQBC00U6B9nPeVqAih5GXVkD4VUoZY aD7VSmgl4/Fkd0KhFmZoTRUD/N1nHIezUM59npZXlisjvY+yfoy1Z8uU5pY2igWFmx51pz O5yb7mte4k/vjlw2TljRgBv74qd3GiOKHUeOJ2UKo9nNMSGxytLcnaCTNYz7og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708032636; a=rsa-sha256; cv=none; b=QbfzvvRXOF4pNnTJ9T8TATozGXGvcwtlENO6gviY1Rj2V7NoPUzPK0HkztNUjwRGetI/L6 1hdQrH4nzFJPLvRtkFWu4Wr53aZJYCUfLVeQDNeSKGcTALIVT4kXTl755Ey+cEXMcglHmM BkgmAAZsevbp8umVq+I1dOKg+8TrAZfHA6fzzjE6q7BCjo8fwtoEDtulZIclVOov64tPiY mDgxXsVliOHyqpHU/6Rv5tSdFrC27q3XA/UdLsFKvB0U906L9F4rQfnMV06KFvPoGBsJwQ 9slg7n/E3eEWk6MwqLujM7m/+OYrVjmkFqYxc/H78z993ulpSNc0HBJUe4LjUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TbSsS3lkFzy0d; Thu, 15 Feb 2024 21:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41FLUaRK063527; Thu, 15 Feb 2024 21:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41FLUac3063524; Thu, 15 Feb 2024 21:30:36 GMT (envelope-from git) Date: Thu, 15 Feb 2024 21:30:36 GMT Message-Id: <202402152130.41FLUac3063524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 9286d46a794f - main - heimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9286d46a794f25482880d29864a8901ef6666fae Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9286d46a794f25482880d29864a8901ef6666fae commit 9286d46a794f25482880d29864a8901ef6666fae Author: Cy Schubert AuthorDate: 2024-02-15 00:54:46 +0000 Commit: Cy Schubert CommitDate: 2024-02-15 21:27:55 +0000 heimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech() Apply upstream 22749e918 to fix a buffer overflow. Upstream notes: If len_len is equal to total_len - 1 (i.e. the input consists only of a 0x60 byte and a length), the expression 'total_len - 1 - len_len - 1', used as the 'len' parameter to der_get_length(), will overflow to SIZE_MAX. Then der_get_length() will proceed to read, unconstrained, whatever data follows in memory. Add a check to ensure that doesn't happen This is similar to samba CVE-2022-3437. Reported by: emaste Security: CVE-2022-41916 Obtained from: upstream 22749e918 MFC after: 1 week --- crypto/heimdal/lib/gssapi/krb5/decapsulate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/heimdal/lib/gssapi/krb5/decapsulate.c b/crypto/heimdal/lib/gssapi/krb5/decapsulate.c index 343a3d7acb97..7a18708a633a 100644 --- a/crypto/heimdal/lib/gssapi/krb5/decapsulate.c +++ b/crypto/heimdal/lib/gssapi/krb5/decapsulate.c @@ -56,6 +56,8 @@ _gsskrb5_get_mech (const u_char *ptr, return -1; if (total_len < 1 + len_len + 1) return -1; + if (total_len < 1 + len_len + 1) + return -1; p += len_len; if (*p++ != 0x06) return -1;