Skip to main content

Cobalt Strike configuration extractor and parser library and scripts.

Project description

Overview

Pure Python library and set of scripts to extract and parse configurations (configs) from Cobalt Strike Beacons. The library, libcsce, contains classes for building tools to work with Beacon configs. There are also two CLI scripts included that use the library to parse Beacon config data:

  1. csce: Parses all known Beacon config settings to JSON, mimicing the Malleable C2 profile structure.

  2. list-cs-settings: Attempts to find by brute-force the associated Cobalt Strike version, and all settings/their types, of a Beacon config. This script is useful for conducting research on Beacon samples.

Installation

Install from Pypi (preferred method)

> pip install libcsce

Install from GitHub with Pip

> pip install git+ssh://git@github.com/strozfriedberg/cobaltstrike-config-extractor.git#egg=libcsce

Install from Cloned Repo

> git clone ssh://git@github.com/strozfriedberg/cobaltstrike-config-extractor.git
> cd libcsce
> pip install .

Dependencies

The only external non-development dependency is pefile, which is required to decrypt Beacon configs from the .data section of PE files. Requires Python 3.6+.

Development dependencies include those specified in pyproject.toml as well as:

Getting Started

csce

Both of the CLI scripts support extracting Beacon configs from PE files (DLLs/EXEs) and memory dumps where a Beacon was running. To parse a Beacon PE file to JSON, use csce:

> csce --pretty <path/to/file.{exe,dll,bin,dmp}>

By default, the script will try to parse the Beacon as version 3 and, if that fails, try version 4. You can specify a version manually via the -v flag to save cycles if you know the Beacon is version 4 (using -v 3 doesn’t technically save cycles because the script tries that version first by default).

list-cs-settings

To discover new settings and while conducting research, sometimes it’s useful to extract possible all settings and their types from a Beacon sample. Use list-cs-settings to detect by brute-force the Cobalt Strike version and all settings/types:

> list-cs-settings <path/to/file.{exe,dll,bin,dmp}>

This script produces JSON where the top-level key is the Cobalt Strike version number, which points to a mapping from setting number to information about that setting, including:

  1. length (in bytes)

  2. offset from the beginning of the config section

  3. fundamental type (short, int, str)

Contributing

Stroz Friedberg wants to work with the security community to make these open source tools the most comprehensive available for working with Cobalt Strike Beacons. If you encounter a bug, have research to share on Beacons, spot a typo in the documentation, want to request new functionality, etc. please submit an issue! If you want to contribute code or documentation to the project, please submit a PR and we will review it! All contributions will be subject to the license included in the repo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libcsce-0.1.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libcsce-0.1.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file libcsce-0.1.0.tar.gz.

File metadata

  • Download URL: libcsce-0.1.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for libcsce-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6368804be2adb2af65b7eaed9d2c1082e50bf65d55b4e8bc0dcd9aa68365723
MD5 69bcdac34393e4a40d7a2823f38b0808
BLAKE2b-256 8432cea16d30b5b5379a19f9fe1e1d410f32d6ac4a25872f6ab59c5570fb8bbf

See more details on using hashes here.

File details

Details for the file libcsce-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: libcsce-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for libcsce-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 057e99f88a698f140eb4489bc0807db7b6a37d67f68d8114c862f212453bbd1c
MD5 29081326012a5f51b1cc4d3aa29c1a28
BLAKE2b-256 8e574d33dda72ecfb9803cad73139339cf8b8fa3cad99dd465f63b88519ca02d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page