Windows Installed AntiVirus Enumeration - Metasploit


This page contains detailed information about how to use the post/windows/gather/enum_av metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Windows Installed AntiVirus Enumeration
Module: post/windows/gather/enum_av
Source code: modules/post/windows/gather/enum_av.rb
Disclosure date: -
Last modification time: 2022-04-21 11:35:33 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module will enumerate the AV products detected by WMIC

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Stability:

  • crash-safe: Module should not crash the service.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/gather/enum_av

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/gather/enum_av
msf post(enum_av) > show options
    ... show and set options ...
msf post(enum_av) > set SESSION session-id
msf post(enum_av) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/gather/enum_av")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on

Knowledge Base


Vulnerable Application


This module will enumerate all installed AntiVirus applications on the target Windows OS

Verification Steps


  1. Start msfconsole
  2. Get meterpreter session
  3. Do: use post/windows/gather/enum_av
  4. Do: set SESSION <session id>
  5. Do: run

Options


SESSION

The session to run this module on.

Scenarios


Windows 10 (20H2 build 19042.1645)

  [*] Meterpreter session 1 opened (192.168.1.3:4444 -> 192.168.1.4:49178) at 2019-12-10 14:18:44 -0700
  meterpreter > bg
  [*] Backgrounding session 1...

  msf6 > use windows/gather/enum_av
  msf6 post(windows/gather/enum_av) > set session 1
  session => 1
  msf6 post(windows/gather/enum_av) > run

  [*] Found AV product:
  displayName=Windows Defender
  instanceGuid={D68DDC3A-831F-4fae-9E44-DA132C1ACF46}
  pathToSignedProductExe=windowsdefender://
  pathToSignedReportingExe=%ProgramFiles%\Windows Defender\MsMpeng.exe
  productState=401664
  timestamp=Thu, 21 Apr 2022 15:50:46 GMT

  [*] Post module execution completed

Go back to menu.

Msfconsole Usage


Here is how the windows/gather/enum_av post exploitation module looks in the msfconsole:

msf6 > use post/windows/gather/enum_av

msf6 post(windows/gather/enum_av) > show info

       Name: Windows Installed AntiVirus Enumeration
     Module: post/windows/gather/enum_av
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  rageltman <rageltman@sempervictus>

Module stability:
 crash-safe

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on

Description:
  This module will enumerate the AV products detected by WMIC

Module Options


This is a complete list of options available in the windows/gather/enum_av post exploitation module:

msf6 post(windows/gather/enum_av) > show options

Module options (post/windows/gather/enum_av):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on

Advanced Options


Here is a complete list of advanced options supported by the windows/gather/enum_av post exploitation module:

msf6 post(windows/gather/enum_av) > show advanced

Module advanced options (post/windows/gather/enum_av):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/gather/enum_av module can do:

msf6 post(windows/gather/enum_av) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the windows/gather/enum_av post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/gather/enum_av) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

The 'wmic' command doesn't exist on this host!


Here is a relevant code snippet related to the "The 'wmic' command doesn't exist on this host!" error message:

28:	  end
29:	
30:	  # Run Method for when run command is issued
31:	  def run
32:	    if command_exists?('wmic') == false
33:	      print_error("The 'wmic' command doesn't exist on this host!") # wmic is technically marked as deprecated so this command could very well be removed in future releases.
34:	      return
35:	    end
36:	    avs = {}
37:	    cmd = 'wmic /namespace:\\\\root\\SecurityCenter2 path AntiVirusProduct get * /value'
38:	    resp = cmd_exec(cmd, nil, 6000).to_s

ERROR


Here is a relevant code snippet related to the "ERROR" error message:

34:	      return
35:	    end
36:	    avs = {}
37:	    cmd = 'wmic /namespace:\\\\root\\SecurityCenter2 path AntiVirusProduct get * /value'
38:	    resp = cmd_exec(cmd, nil, 6000).to_s
39:	    fail_with(Failure::Unknown, resp) if resp[0..5].upcase == 'ERROR:'
40:	    resp.split("\r\r\n\r\r\n").map do |ent|
41:	      next if ent.strip.empty?
42:	
43:	      print_status("Found AV product:\n#{ent}\n")
44:	      av_note = ent.lines.map(&:strip).map.select { |e| e.length > 1 }.map { |e| e.split('=', 2) }.to_h

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • rageltman <rageltman[at]sempervictus>

Version


This page has been produced using Metasploit Framework version 6.1.41-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.