Bug in NetUSB code opens networking devices to remote code execution

Researchers from SEC Consult have published details of a critical kernel stack buffer overflow vulnerability in NetUSB, a software component that provides “USB over IP” functionality and is included in most recent firmware versions of many TP-Link, Netgear, Trendnet, and Zyxel networking devices.

After trying to make the vendor – Taiwanese company KCodes – address the issue for months, SEC Consult first opted for informing TP-Link and Netgear and providing a proof of concept exploit privately.

Then they notified the CERT Coordination Center (CERT/CC) and asked for help in coordinating vulnerability disclosure with other affected vendors, and finally they published a security advisory which does not include the proof of concept exploit code as many vendors have yet to patch the vulnerability.

“USB devices (e.g. printers, external hard drives, flash drives) plugged into a Linux-based embedded system (e.g. a router, an access point or a dedicated ‘USB over IP’ box) are made available via the network using a Linux kernel driver that launches a server (TCP port 20005). The client side is implemented in software that is available for Windows and OS X. It connects to the server and simulates the devices that are plugged into the embedded system locally. The user experience is like that of a USB device physically plugged into a client system,” the researchers explained.

“To establish a server-connection, a simple mutual authentication check needs to be passed […] As part of the connection initiation, the client sends his computer name. This is where it gets interesting: The client can specify the length of the computer name. By specifying a name longer than 64 characters, the stack buffer overflows when the computer name is received from the socket.”

This can result in memory corruption, which can then be exploited by attackers to remotely execute arbitrary code.

The NetUSB technology has several other names depending on the vendor: ReadySHARE, print sharing, USB share port.

“While NetUSB was not accessible from the internet on the devices we own, there is some indication that a few devices expose TCP port 20005 to the internet. We don’t know if this is due to user misconfiguration or the default setting within a specific device. Exposing NetUSB to the internet enables attackers to get access to USB devices of potential victims and this would actually count as another vulnerability,” the researcher noted.

All in all, nearly 100 devices are affected by this vulnerability (list included in the security advisory).

TP-Link already released some fixes, and it’s planning to issue more soon. Netgear is working on them, and has told the researchers that it’s impossible to mitigate the risk in the meantime, as “the TCP port can’t be firewalled nor is there a way to disable the service on their devices.”




Share this