Rapid7 VulnDB

D-Link DIR-645 / DIR-815 diagnostic.php Command Execution

Back to Search

D-Link DIR-645 / DIR-815 diagnostic.php Command Execution



Some D-Link Routers are vulnerable to OS Command injection in the web interface. On DIR-645 versions prior 1.03 authentication isn't needed to exploit it. On version 1.03 authentication is needed in order to trigger the vulnerability, which has been fixed definitely on version 1.04. Other D-Link products, like DIR-300 rev B and DIR-600, are also affected by this vulnerability. Not every device includes wget which we need for deploying our payload. On such devices you could use the cmd generic payload and try to start telnetd or execute other commands. Since it is a blind OS command injection vulnerability, there is no output for the executed command when using the cmd generic payload. A ping command against a controlled system could be used for testing purposes. This module has been tested successfully on DIR-645 prior to 1.03, where authentication isn't needed in order to exploit the vulnerability.


  • Michael Messner <devnull@s3cur1ty.de>
  • juan vazquez <juan.vazquez@metasploit.com>





Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/dlink_diagnostic_exec_noauth
msf exploit(dlink_diagnostic_exec_noauth) > show targets
msf exploit(dlink_diagnostic_exec_noauth) > set TARGET < target-id >
msf exploit(dlink_diagnostic_exec_noauth) > show options
    ...show and set options...
msf exploit(dlink_diagnostic_exec_noauth) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security