作者:k2yk
日期:2017/11/13
最后更新日期:2017/11/15
0x00 漏洞描述
在 2017 年 11 月 12 日 NVD公布了关于 wget 的多个漏洞的情报,这里做一个wget缓冲区溢出漏洞的分析。在 wget 版本小于1.19.2 的情况下,wget 在处理重定向时,会调用 http.c:skip_short_body()
函数, 解析器在解析块时会使用 strtol()
函数读取每个块的长度,但不检查块长度是否为非负数。解析器试图通过使用 MIN()
函数跳过块的前512个字节,最终传递参数到 connect.c:fd_read()
中。由于 fd_read()
仅会接受一个int参数,在攻击者试图放入一个负参数时,块长度的高32位被丢弃,使攻击者可以控制 fd_read()
中的长度参数,产生整形缓冲区溢出漏洞。
影响范围
影响版本为:wget <=1.19.1
影响系统范围如下:
Ubuntu Ubuntu Linux 17.10
Ubuntu Ubuntu Linux 17.04
Ubuntu Ubuntu Linux 16.04 LTS
Ubuntu Ubuntu Linux 14.04 LTS
Redhat Virtualization Host 4
Redhat Enterprise Linux Workstation 7
Redhat Enterprise Linux Server for ARM 7
Redhat Enterprise Linux Server - TUS 7.4
Redhat Enterprise Linux Server - Extended Update Support 7.4
Redhat Enterprise Linux Server - AUS 7.4
Redhat Enterprise Linux Server - 4 Year Extended Update Support 7.4
Redhat Enterprise Linux Server (for IBM Power LE) - 4 Year Extended Update Support 7.4
Redhat Enterprise Linux for Scientific Computing 7
Redhat Enterprise Linux for Power, little endian - Extended Update Supp 7.4
Redhat Enterprise Linux for Power, little endian 7
Redhat Enterprise Linux for Power, big endian - Extended Update Support 7.4
Redhat Enterprise Linux for Power, big endian 7
Redhat Enterprise Linux for IBM z Systems - Extended Update Support 7.4
Redhat Enterprise Linux for IBM z Systems 7
Redhat Enterprise Linux EUS Compute Node 7.4
Redhat Enterprise Linux Desktop 7
Redhat Enterprise Linux 7
GNU wget 0
在实际测试过程中,这个漏洞会因为某些系统修改过wget而导致无法复现。
0x01 漏洞分析
环境复现
现在本地搭建一个漏洞复现环境,漏洞复现过程这里推荐两个方案,一个是漏洞发现作者在git 上进行发布的dockerfile ,另外一个是自己进行编译的版本。
- CVE-2017-13089 的git 环境地址 https://github.com/r1b/CVE-2017-13089
- 使用方法
# Build the container
docker build -t cve201713089 .
# OR ...
docker pull robertcolejensen/cve201713089
# Play around in the container, `src` will be mounted at `/opt/CVE-2017-13089/src`
./run.sh
# Run the included DoS PoC
./run.sh dos
# Run the included exploit PoC (wip)
./run.sh exploit
- 其次就是通过自己编译进行复现
shell
# 获取wget
wget ftp://ftp.gnu.org/gnu/wget/wget-1.19.1.tar.gz
# 解压
tar zxvf wget-1.19.1.tar.gz
#进入目录
cd wget-1.19.1
点击收藏 | 0
关注 | 1