fix the cve-2022-1292

This commit is contained in:
hzero1996 2022-05-16 21:33:45 +08:00
parent 1a07a63743
commit cb9b09f07d
2 changed files with 81 additions and 1 deletions

76
CVE-2022-1292.patch Normal file
View File

@ -0,0 +1,76 @@
From e5fd1728ef4c7a5bf7c7a7163ca60370460a6e23 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tomas@openssl.org>
Date: Tue, 26 Apr 2022 12:40:24 +0200
Subject: [PATCH] c_rehash: Do not use shell to invoke openssl
Except on VMS where it is safe.
This fixes CVE-2022-1292.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
---
tools/c_rehash.in | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/tools/c_rehash.in b/tools/c_rehash.in
index 421fd89..e7cb5fa 100644
--- a/tools/c_rehash.in
+++ b/tools/c_rehash.in
@@ -152,6 +152,23 @@ sub check_file {
return ($is_cert, $is_crl);
}
+sub compute_hash {
+ my $fh;
+ if ( $^O eq "VMS" ) {
+ # VMS uses the open through shell
+ # The file names are safe there and list form is unsupported
+ if (!open($fh, "-|", join(' ', @_))) {
+ print STDERR "Cannot compute hash on '$fname'\n";
+ return;
+ }
+ } else {
+ if (!open($fh, "-|", @_)) {
+ print STDERR "Cannot compute hash on '$fname'\n";
+ return;
+ }
+ }
+ return (<$fh>, <$fh>);
+}
# Link a certificate to its subject name hash value, each hash is of
# the form <hash>.<n> where n is an integer. If the hash value already exists
@@ -161,10 +178,12 @@ sub check_file {
sub link_hash_cert {
my $fname = $_[0];
- $fname =~ s/'/'\\''/g;
- my ($hash, $fprint) = `"$openssl" x509 $x509hash -fingerprint -noout -in "$fname"`;
+ my ($hash, $fprint) = compute_hash($openssl, "x509", $x509hash,
+ "-fingerprint", "-noout",
+ "-in", $fname);
chomp $hash;
chomp $fprint;
+ return if !$hash;
$fprint =~ s/^.*=//;
$fprint =~ tr/://d;
my $suffix = 0;
@@ -202,10 +221,12 @@ sub link_hash_cert {
sub link_hash_crl {
my $fname = $_[0];
- $fname =~ s/'/'\\''/g;
- my ($hash, $fprint) = `"$openssl" crl $crlhash -fingerprint -noout -in '$fname'`;
+ my ($hash, $fprint) = compute_hash($openssl, "crl", $crlhash,
+ "-fingerprint", "-noout",
+ "-in", $fname);
chomp $hash;
chomp $fprint;
+ return if !$hash;
$fprint =~ s/^.*=//;
$fprint =~ tr/://d;
my $suffix = 0;
--
2.19.1

View File

@ -2,7 +2,7 @@
Name: openssl
Epoch: 1
Version: 1.1.1f
Release: 15
Release: 16
Summary: Cryptography and SSL/TLS Toolkit
License: OpenSSL and SSLeay and GPLv2+
URL: https://www.openssl.org/
@ -91,6 +91,7 @@ Patch80: bugfix-Don-t-Overflow-when-printing-Thawte-Strong-Extranet-.patch
Patch81: CVE-2021-4160.patch
Patch82: CVE-2022-0778-Add-a-negative-testcase-for-BN_mod_sqrt.patch
Patch83: CVE-2022-0778-Fix-possible-infinite-loop-in-BN_mod_sqrt.patch
Patch84: CVE-2022-1292.patch
BuildRequires: gcc make lksctp-tools-devel coreutils util-linux zlib-devel
@ -268,6 +269,9 @@ make test || :
%{_pkgdocdir}/html/
%changelog
* Mon May 16 2022 wangcheng <wangcheng156@huawei.com> - 1:1.1.1f-16
- fix CVE-2022-1292
* Mon Mar 21 2022 wangcheng156 <wangcheng156@huawei.com> - 1:1.1.1f-15
- fix CVE-2022-0778