Giter Club home page Giter Club logo

wmi_detector's Introduction

WMI_Detector

This repository contains scripts used to find evidence in WMI repositories, specifically OBJECTS.DATA files located at:

  • C:\WINDOWS\system32\wbem\Repository\OBJECTS.DATA
  • C:\WINDOWS\system32\wbem\Repository\FS\OBJECTS.DATA

wmi_detector.py

wmi_detector.py is designed to find WMI persistence via FitlerToConsumerBindings solely by keyword searching the OBJECTS.DATA file without parsing the full WMI repository.

This script can detect FilterToConsumerBindings that are deleted and remain in unallocated WMI space. I did the test in a lab environment and was able to spot the previous deleted FilterToConsumerBindings.

Based on work of David Pany: PyWMIPersistenceFinder.py

https://github.com/davidpany/WMI_Forensics

Usage

wmi_detector.py <OBJECTS.DATA file>

The output is json based in the following format for each binding:

{
  "<consumer name>-<filter name>": {
    "binding_details": {
      "event_consumer_name": "<consumer name",
      "event_filter_name": "<filter name>"
    },
    "binding_name": "<consumer name>-<filter name>",
    "consumers": [
      {
        "consumer_arguments": "<command>",
        "consumer_name": "<consumer name>-",
        "consumer_type": "CommandLineEventConsumer"
      }
    ],
    "filters": [
      {
        "filter_name": "<filter name>",
        "filter_query": "<query>"
      }
    ],
    "info": ""
  }
}

An example:

{
  "Malicious Consumer-Malicious Filter": {
    "binding_details": {
      "event_consumer_name": "Malicious Consumer",
      "event_filter_name": "Malicious Filter"
    },
    "binding_name": "Malicious Consumer-Malicious Filter",
    "consumers": [
      {
        "consumer_arguments": "powershell.exe -Command IEX \"'echo ciao | Out-File -FilePath C:\\salve.txt'\"",
        "consumer_name": "Malicious Consumer",
        "consumer_type": "CommandLineEventConsumer"
      }
    ],
    "filters": [
      {
        "filter_name": "Malicious Filter",
        "filter_query": "SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_Process\" AND TargetInstance.Name = \"notepad.exe\""
      }
    ],
    "info": ""
  },
  "SCM Event Log Consumer-SCM Event Log Filter": {
    "binding_details": {
      "event_consumer_name": "SCM Event Log Consumer",
      "event_filter_name": "SCM Event Log Filter"
    },
    "binding_name": "SCM Event Log Consumer-SCM Event Log Filter",
    "consumers": [
      "NTEventLogEventConsumer ~ SCM Event Log Consumer ~ sid ~ Service Control Manager"
    ],
    "filters": [
      {
        "filter_name": "SCM Event Log Filter",
        "filter_query": "select * from MSFT_SCMEventLogEvent"
      }
    ],
    "info": "Common binding based on consumer and filter names,possibly legitimate"
  }
}

Contact

Massimiliano Dal Cero - Digital Defense - 2024

Linkedin: https://www.linkedin.com/in/dalcero

Please send comments, bug reports, and questions to @massimiliano-dalcero or push changes directly to GitHub

wmi_detector's People

Contributors

massimiliano-dalcero avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.