当前位置:   article > 正文

Centos7修复OpenSSL 安全漏洞 (CVE-2022-0778)

cve-2022-0778

前言:

centos7环境下OpenSSL拒绝服务漏洞(CVE-2022-0778)
漏洞影响范围:

  • OpenSSL1.0.2
  • OpenSSL1.1.1
  • OpenSSL3.0
    OpenSSL拒绝服务漏洞(CVE-2022-0778):该漏洞是由于OpenSSL中的BN_mod_sqrt()函数存在解析错误,由于证书解析发生在证书签名验证之前,因此任何解析外部提供的证书场景都可能受到拒绝服务攻击,攻击者可在未授权的情况下通过构造特定证书来触发无限循环,执行拒绝服务攻击,最终使服务器无法提供服务。

修复步骤:

openssl官网

https://www.openssl.org/source/
在这里插入图片描述
查看系统版本、内核及openssl版本如下

[root@sdd ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)
You have new mail in /var/spool/mail/root
[root@sdd ~]# uname -a
Linux sdd 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@sdd ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
[root@sdd ~]# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

按照官网提示我们的openssl版本为OpenSSL 1.0.2k-fips,需要下载升级到最新的3.0.8版本;
在这里插入图片描述
下载最新版本3.0.8

下载软件上传到要升级的服务器
上传并解压
[root@idss ~]# tar zvxf openssl-3.0.8.tar.gz
[root@idss ~]# cd openssl-3.0.5
  • 1
  • 2

在这里插入图片描述
查看安装文档INSTALL.md
在这里插入图片描述

编译安装

1.先建配置文件夹

[root@idss openssl-3.0.8]# mkdir -p /usr/local/openssl
  • 1

2.配置安装
./config --prefix=/usr/local/openssl
提示如下

[root@idss openssl-3.0.8]# ./config --prefix=/usr/local/openssl
/usr/bin/env: perl: No such file or directory
  • 1
  • 2
检查perl

安装perl-ExtUtils-CBuilder perl-ExtUtils-
MakeMaker,先下载需要安装的依赖包,然后使用rpm强制完成perl的安装,此方式可以离线拷贝文件到内网机器,进行perl安装

[root@idss ~]# mkdir -p myperl
[root@idss ~]# yum install --downloadonly --downloaddir=/root/myperl  perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
[root@idss ~]# cd myperl
[root@idss myperl]# rpm -ivh *.rpm --force --nodeps
  • 1
  • 2
  • 3
  • 4

检查perl安装成功如下

[root@idss myperl]# perl -v

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 44 registered patches, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
检查gcc
[root@idss ~]# mkdir -p mygcc
[root@sdd ~]# yum install --downloadonly --downloaddir=/root/mygcc  gcc
[root@sdd ~]# cd /root/mygcc
[root@sdd mygcc]# rpm -ivh *.rpm --force --nodeps
  • 1
  • 2
  • 3
  • 4

检查gcc安装成功如下

[root@idss mygcc]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
再次编译安装
[root@idss ~]# cd openssl-3.0.8
[root@idss openssl-3.0.8]# ./config --prefix=/usr/local/openssl/
  • 1
  • 2

显示如下,提示successfully就预编译成功了

[root@idss openssl-3.0.8]# ./config --prefix=/usr/local/openssl/
Configuring OpenSSL version 3.0.8 for target linux-x86_64
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created Makefile.in
Created Makefile
Created include/openssl/configuration.h

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL.md file first)      ***
***                                                                ***
**********************************************************************
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

接下来进行make编译和安装,时间会长一些

make && make install
  • 1

![make编译安装完成](https://img-
blog.csdnimg.cn/0144f3db00fa4be9a36095ba2bd5e173.png)

备份和配置软链接

mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib64/libssl.so.3 /usr/lib/libssl.so.3
ln -s /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib/libcrypto.so.3
ldconfig
执行过程如下

[root@idss openssl-3.0.8]# mv /usr/bin/openssl /usr/bin/openssl.old
[root@idss openssl-3.0.8]# mv /usr/include/openssl /usr/include/openssl.old
mv: cannot stat ‘/usr/include/openssl’: No such file or directory
[root@idss openssl-3.0.8]# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
[root@idss openssl-3.0.8]# ln -s /usr/local/openssl/include/openssl /usr/include/openssl
[root@idss openssl-3.0.8]# ln -s /usr/local/openssl/lib64/libssl.so.3 /usr/lib/libssl.so.3
[root@idss openssl-3.0.8]# ln -s /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib/libcrypto.so.3
[root@idss openssl-3.0.8]# ldconfig
[root@idss openssl-3.0.8]# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
检查安装后的openssl版本
[root@idss openssl-3.0.8]# openssl version
OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)
  • 1
  • 2

附件
perl安装包(我的主页下载,审核中,后续附上安装包连接)
gcc安装包(我的主页下载,审核中,后续附上安装包连接)

学习网络安全技术的方法无非三种:

第一种是报网络安全专业,现在叫网络空间安全专业,主要专业课程:程序设计、计算机组成原理原理、数据结构、操作系统原理、数据库系统、 计算机网络、人工智能、自然语言处理、社会计算、网络安全法律法规、网络安全、内容安全、数字取证、机器学习,多媒体技术,信息检索、舆情分析等。

第二种是自学,就是在网上找资源、找教程,或者是想办法认识一-些大佬,抱紧大腿,不过这种方法很耗时间,而且学习没有规划,可能很长一段时间感觉自己没有进步,容易劝退。

如果你对网络安全入门感兴趣,那么你需要的话可以点击这里

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/847566
推荐阅读
相关标签