Git Product home page Git Product logo

trendingtechnology / imaginaryc2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from felixweyne/imaginaryc2

0.0 3.0 0.0 22.21 MB

Imaginary C2 is a python tool which aims to help in the behavioral (network) analysis of malware. Imaginary C2 hosts a HTTP server which captures HTTP requests towards selectively chosen domains/IPs. Additionally, the tool aims to make it easy to replay captured Command-and-Control responses/served payloads.

Python 95.58% Batchfile 3.11% HTML 1.31%

imaginaryc2's Introduction

Imaginary C2

author: Felix Weyne

Imaginary C2 is a python tool which aims to help in the behavioral (network) analysis of malware.
Imaginary C2 hosts a HTTP server which captures HTTP requests towards selectively chosen domains/IPs. Additionally, the tool aims to make it easy to replay captured Command-and-Control responses/served payloads.

By using this tool, an analyst can feed the malware consistent network responses (e.g. C&C instructions for the malware to execute). Additionally, the analyst can capture and inspect HTTP requests towards a domain/IP which is off-line at the time of the analysis.

Imaginary C2

Replay packet captures

Imaginary C2 provides two scripts to convert packet captures (PCAPs) or Fiddler Session Archives into request definitions which can be parsed by imaginary C2. Via these scripts the user can extract HTTP request URLs and domains, as well as HTTP responses. This way, one can quickly replay HTTP responses for a given HTTP request.

Technical details

requirements: Imaginary C2 requires Python 2.7 and Windows.
modules: Currently, Imaginary C2 contains three modules and two configuration files:

Filename Function
1. imaginary_c2.py Hosts python's simple HTTP server. Main module.
2. redirect_to_imaginary_c2.py Alters Windows' host file and Windows' (IP) Routing Table.
3. unpack_fiddler_archive.py & unpack_pcap.py Extracts HTTP responses from packet captures. Adds corresponding HTTP request domains and URLs to the configuration files.
4. redirect_config.txt Contains domains and IPs which needs to be redirected to localhost (to the python HTTP server).
5. requests_config.txt Contains URL path definitions with the corresponding data sources.

request definitions: Each (HTTP) request defined in the request configuration consists of two parameters:

Parameter 1: HTTP request URL path (a.k.a. urlType)

Value Meaning
fixed Define the URL path as a literal string
regex Define a regex pattern to be matched on the URL path

Parameter 2: HTTP response source (a.k.a. sourceType)

Value Meaning
data Imaginary C2 will respond with the contents of a file on disk
python Imaginary C2 will run a python script. The output of the python script defines the HTTP response.

Demo use case: Simulating TrickBot servers

Imaginary C2 can be used to simulate the hosting of TrickBot components and configuration files. Additionally, it can also be used to simulate TrickBot's web injection servers.

How it works:

Upon execution, the TrickBot downloader connects to a set of hardcoded IPs to fetch a few configuration files. One of these configuration files contains the locations (IP addresses) of the TrickBot plugin servers. The Trickbot downloader downloads the plugins (modules) from these servers and decrypts them. The decrypted modules are then injected into a svchost.exe instance.

Example decoded TrickBot configuration files

One of TrickBot's plugins is called injectdll, a plugin which is responsible for TrickBot's webinjects. The injectdll plugin regularly fetches an updated set of webinject configurations. For each targeted (banking) website in the configuration, the address of a webfake server is defined. When a victim browses to a (banking) website which is targeted by TrickBot, his browser secretly gets redirected to the webfake server. The webfake server hosts a replica of the targeted website. This replica website usually is used in a social-engineering attack to defraud the victim.

Imaginary C2 in action:

The below video shows the TrickBot downloader running inside svchost.exe and connecting to imaginary C2 to download two modules. Each downloaded module gets injected into a newly spawned svchost.exe instance. The webinject module tries to steal the browser's saved passwords and exfiltrates the stolen passwords to the TrickBot server. Upon visiting a targeted banking website, TrickBot redirects the browser to the webfake server. In the demo, the webfake server hosts the message: "Default imaginary C2 server response" (full video).

Imaginary C2 simulating TrickBot server

imaginaryc2's People

Contributors

felixweyne avatar

Watchers

James Cloos avatar Trending Technology avatar  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.