Cobalt Strike Configuration Extractor and Parser
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:
csce: Parses all known Beacon config settings to JSON, mimicing the Malleable C2 profile structure.
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:
length (in bytes)
offset from the beginning of the config section
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.
Metadata
Release files for libcsce 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| libcsce-0.1.0.tar.gz | 20.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| libcsce-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / libcsce-0.1.0.tar.gz
| Download URL | libcsce-0.1.0.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6368804be2adb2af65b7eaed9d2c1082e50bf65d55b4e8bc0dcd9aa68365723
|
|
BLAKE2b-256 checksum How to use checksums |
8432cea16d30b5b5379a19f9fe1e1d410f32d6ac4a25872f6ab59c5570fb8bbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2
|
Release files / libcsce-0.1.0-py3-none-any.whl
| Download URL | libcsce-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
057e99f88a698f140eb4489bc0807db7b6a37d67f68d8114c862f212453bbd1c
|
|
BLAKE2b-256 checksum How to use checksums |
8e574d33dda72ecfb9803cad73139339cf8b8fa3cad99dd465f63b88519ca02d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2
|
Security for libcsce 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.