Giter Club home page Giter Club logo

etw-beaconhunter's Introduction

BeaconHunter

Behavior based monitoring and hunting tool built in C# leveraging ETW tracing. Blue teamers can use this tool to detect and respond to potential Cobalt Strike beacons. Red teamers can use this tool to research ETW bypasses and discover new processes that behave like beacons.

Author: Andrew Oliveau (@AndrewOliveau)

image

TL;DR

Beacon implants injected in a benign process live in a thread with a Wait:DelayExecution state (probably related to Cobalt Strike's sleep). Find all processes that contain a thread in a Wait:DelayExecution state. Then, leverage ETW tracing to specifically monitor suspicious thread activity:

  • HTTP/HTTPS callbacks
  • DNS queries
  • File system (cd,ls,upload,rm)
  • Process termination (kill)
  • Shell commands (run,execute)

Score suspicious behavior. Log, display, and take action against them.

Building / Installation

Pre-compiled

Release

or git clone and go to Release folder.

.NET Framework version

4.5

Nuggets:

Tools -> NuGet Package Manager -> Package Manager Console

  • Install-Package ConsoleTables -Version 2.4.2
  • Install-Package Microsoft.Diagnostics.Tracing.TraceEvent -Version 2.0.64
  • Install-Package System.Runtime.InteropServices.RuntimeInformation -Version 4.3.0

Running BeaconHunter

  • Open PowerShell or CMD as an Administrator
  • .\BeaconHunter.exe

MONITOR

Network Beacon Score
  • Score is determined by calculating the time difference between beacon callbacks (delta), then calculating the 1st derivative of delta, and then feeding the answer to an inverse function 100/x where x is the 1st derivative of delta. (Note: There is probably a better way, but it works)

image

IP and PORT Stats

image

DNS Queries

  • Helpful to detect DNS beacons.

image

Directory Change

image

New Uploaded Files

image

Shell Commands

  • Detects PPID spoofing

image

ACTION

Suspend Thread ID - Manual

image

Suspend Thread ID - Automated

  • Set a score threshold. If Network Beacon Scores goes above threshold, BeaconHunter will automatically suspend the thread.

image

References

etw-beaconhunter's People

Contributors

3lp4tr0n avatar aholdeno 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.