| Título | D-Link DSL-2640B 3.0.6.0.41 OS Command Injection (CWE-78) |
|---|
| Descrição | An OS command injection vulnerability was discovered in D-Link DSL-2640B firmware v3.0.6.0.41
(hardware revision A). The outgoing and incoming IP filter handlers cgiScOutFltAdd() (0x48e65c) and
cgiScInFltAdd() (0x48f8b8) accept the camelCase parameters fltName, protocol, srcAddr, srcMask,
srcPort, dstAddr, dstMask and dstPort and store them in 16-byte structure fields without validation.
When the filter policy is applied, SecFltOutTbl::executeCommand() (0x462b78) and
SecFltInTbl::runiptables() (0x463cf8) format the stored strings into "iptables -%c FORWARD ... -s %s
--sport %s -d %s --dport %s -j DROP" (format strings at 0x4ede2c-0x4ede60) and "iptables -I INPUT 1
-j ACCEPT -i %s %s %s %s %s %s" (0x4edf34), then call bcmSystemNoHang() (0x434f60) which executes
them with /bin/sh -c. No inet_addr()/inet_aton() call exists anywhere on this path; only the subnet
mask is converted to a prefix length, and the address/port strings are used verbatim. Policy
application is driven by BcmWan_monitorInterfaces() (0x44e1bc) -> SecCfgMngr::doIpGlobalPolicy()
(0x458608) -> doOutgoingIpFltPolicy() (0x45867c), i.e. it runs on any device with a WAN interface.
Reproduction of the storage step: curl --get --data-urlencode 'action=add' --data-urlencode
'fltName=g7' --data-urlencode 'protocol=1' --data-urlencode 'srcAddr=;mkdir /var/q1;#'
--data-urlencode 'srcPort=1' --data-urlencode 'dstAddr=x.x.x.x' --data-urlencode 'dstPort=1' -u
admin:admin http://<device>/scoutflt.cmd stores the payload (visible in action=view) and the rule
application executes "iptables -A FORWARD ... -s ;mkdir /var/q1;# ..." as root. The same fields are
char[16] members only 0x80/0xC0 bytes below the saved return address, so over-long values also
produce a stack buffer overflow. The hard-coded account grants access without a valid password.
Proposed CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (8.8). |
|---|
| Fonte | ⚠️ https://github.com/dujiaode/DSL2640B/tree/main/04-scoutflt-scinflt-filter-cmd-injection |
|---|
| Utilizador | qsc19995 (UID 102748) |
|---|
| Submissão | 04/11/2026 14h44 (há 24 dias) |
|---|
| Moderação | 28/11/2026 16h27 (24 days later) |
|---|
| Estado | Aceite |
|---|
| Entrada VulDB | 445115 [D-Link DSL-2640B 3.0.6.0.41 IP Filter scoutflt/scinflt srcAddr Elevação de Privilégios] |
|---|
| Pontos | 20 |
|---|