| Title | Wavlink Router Firmware WN551X3-A-M51X3_V251020-WO Command Injection |
|---|
| Description | An OS command injection vulnerability (CWE-78) was identified in the WAVLINK WN551X3-A (AX3000) router, firmware M51X3_V251020-WO-182e965 (OpenWrt-based, ARM aarch64/musl).
The web management interface is a lighttpd front-end (ports 80/443) that proxies dynamic *.csp requests to a back-end service, /bin/ioos, listening on 127.0.0.1:81 and running as root. ioos dispatches requests by the "opt" parameter. The handler for fname=sys & opt=dns_resolution (function sub_41a430, file /bin/ioos) performs a DNS lookup test: it takes the user-controlled "data" request parameter, passes it through a validator (sub_420c80), then embeds it UNQUOTED into a shell command passed to popen():
snprintf(buf, 0x100, "nslookup %s 2>/dev/null", data); // 0x41a540
popen(buf, "r"); // runs as root
The validator (sub_420c80) only rejects the semicolon character ";" - it does NOT reject newline ("\n") or pipe ("|"). Because %s is unquoted and a newline is a command separator in sh -c, a "data" value such as x.x.x.x\nid>/tmp/p causes popen to execute "nslookup x.x.x.x" on the first line and "id>/tmp/p" on the next line, executing an arbitrary OS command with root privileges and leading to full compromise of the device. This is a distinct root cause from the openvpn_cli_group / wireguard_cli_group injections (single-quoted "uci set") in the same firmware: here the vendor added a validator but it is incomplete (misses newline), showing there is no central input-sanitisation layer.
Exploitation requires reaching ioos and passing its login check. Two vectors: (a) the dispatcher (cgi_protocol_handler) trusts the IP-FROM request header and sets the login flag to 1 whenever IP-FROM equals "127.0.0.1", with NO token required - exploitable from loopback or any SSRF that can reach 127.0.0.1:81 (this vector was VERIFIED on this firmware, command executed as uid=0); (b) through the lighttpd front door with a valid token (default web password is "admin"). ioos' custom HTTP parser quirks: spaces must be sent as %20 (not "+") and the IP-FROM header must precede Content-Type.
Proof of concept (loopback/SSRF vector - VERIFIED):
POST /index.csp?token=x HTTP/1.1
Host: 127.0.0.1:81
IP-FROM: 127.0.0.1
Content-Type: application/x-www-form-urlencoded
fname=sys&opt=dns_resolution&function=set&data=x.x.x.x%0aid>/tmp/p%0a
Response: { "opt":"dns_resolution", "fname":"sys", "function":"set", "ip":"", "error":0 }
The file /tmp/p on the device then contains: uid=0(root) gid=0(root) groups=0(root)
(Note: data=...;... is rejected with error 10002 - the validator catches ";"; the newline bypass data=...\n... returns error 0 and executes the injected command.)
The vulnerability was dynamically verified against the firmware emulated with qemu-aarch64 user-mode emulation; the injected id command executed with root privileges (uid=0) through the dns_resolution handler via the loopback-bypass vector. A ready-to-run Python EXP is published alongside the advisory. |
|---|
| User | llsss (UID 96233) |
|---|
| Submission | 08/09/2026 08:46 (4 months ago) |
|---|
| Moderation | 11/01/2026 16:49 (3 months later) |
|---|
| Status | Accepted |
|---|
| VulDB entry | 429670 [WAVLINK WN551X3-A M51X3_V251020-WO-182e965 DNS Resolution /bin/ioos sub_41a430 data os command injection] |
|---|
| Points | 20 |
|---|