Skip to main content

Detects and extracts obfuscated, embedded content from files.

Project description

Malcarve

Detects and extracts obfuscated, embedded content from files.

Overview

Malcarve is a tool for detecting and extracting obfuscated, embedded content from files. In particular it is targeted at extracting malicious payloads such as those contained in malware attack documents and droppers.

This version of malcarve has been adapted from https://github.com/shendo/malcarve. Some functionality has been simplified and improved, while other functionality has been removed.

Installation

Malcarve requires gcc to compile its components written in C:

sudo apt install gcc

Note that only linux x86_64 is supported.

Install using pip:

pip install malcarve-cbl

If installed in editable mode, the C compilation script will need to be manually called:

./malcarve-cbl/malcarve_cbl/ext/build.sh
pip install -e malcarve-cbl

Usage

Binary data can be checked for embedded and/or encrypted data via carve_buffer():

from malcarve_cbl.malcarve_cbl import FoundFormat, carve_buffer

data: bytes = b"abYWJjWVdKakVmTG4wTjZBNlB1RWxwcGxaVTVLU1RzNlRSTVM1N2pRMmRlNDk0eUIwRzEzQ1ZZNExEY1hHT1NP"

found_formats: list[FoundFormat] = carve_buffer(data)
print(found_formats[0].content.decode())
print(found_formats[0].encoding_info.encoding_offsets_string)
print(found_formats[0].encoding_info.keyed_encoding_string)

Output:

https://exampleurl.com/this/is/an/example
base64(0x0-0x56)->base64(0x2-0x41)->xor(0x6-0x2f)
xor(key:0x79, bytes:1, increment:13)

In this case, malcarve found an url which had been xor'd, then base64 encoded twice. the xor was identified as being a 2 byte incrementing xor where every time a set of 2 bytes were encoded, the key incremented by 13. The starting key was 0x79.

Acknowledgements

This repository was based off of https://github.com/shendo/malcarve

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

malcarve_cbl-10.0.2.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

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

malcarve_cbl-10.0.2-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file malcarve_cbl-10.0.2.tar.gz.

File metadata

  • Download URL: malcarve_cbl-10.0.2.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for malcarve_cbl-10.0.2.tar.gz
Algorithm Hash digest
SHA256 0589af3032a85ad09f9e94cfd30eb6f6c57e8d9fe31c5c3dfe4793e30dd9d4ed
MD5 6a29f0d77f476da84d618aa1c6726736
BLAKE2b-256 2d4f3f0f56b40aab85e817054f3330bf551da70e99134bf34660dbf9ae34f09f

See more details on using hashes here.

File details

Details for the file malcarve_cbl-10.0.2-py3-none-any.whl.

File metadata

  • Download URL: malcarve_cbl-10.0.2-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for malcarve_cbl-10.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e8f27b99c8376da7db0246729b95bb9532430d5813a0028cef70d1b3e116109e
MD5 6c1c660099f22e614b99f39940df8204
BLAKE2b-256 c568518d51b1a15096cde4643645e751df6585090074d614666b925be9ff71d7

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