CAPEv2: Malware Configuration And Payload Extraction
CAPE: Malware Configuration And Payload Extraction
CAPE is a malware sandbox. It is derived from Cuckoo and is designed to automate the process of malware analysis with the goal of extracting payloads and configuration from malware. This allows CAPE to detect malware based on payload signatures, as well as automating many of the goals of malware reverse engineering and threat intelligence.
CAPE can detect a number of malware techniques or behaviors, as well as specific malware families, from its initial run on a sample. This detection may then trigger a further run with a specific package, in order to extract the malware payload and possibly its configuration, for further analysis.
CAPE works by controlling malware via a bespoke debugger and API hooks. Detection to trigger a CAPE package can be based on API or Yara signatures. The debugger uses Yara signatures or API hooks to allow breakpoints to be set on individual instructions, memory regions, or function calls. Once a region of interest is reached, it can be manipulated and dumped for processing and analysis, and possibly configuration parsing.
The techniques or behaviors that CAPE detects and has packages for include:
- Process injection
- Shellcode injection
- DLL injection
- Process Hollowing
- Process Doppelganging
- Decompression of executable modules in memory
- Extraction of executable modules or shellcode in memory
Packages for these behaviors will dump the payloads being injected, extracted, or decompressed for further analysis. This is often the malware payload in unpacked form.
CAPE automatically creates a process dump for each process, or, in the case of a DLL, the DLL’s module image in memory. This is useful for samples packed with simple packers, where often the module image dump is fully unpacked. Yara signatures may trigger the process dumps, possibly resulting in submission with a specific package or configuration parsing.
CAPE also has a package that can dynamically unpack samples that use ‘hacked’ (modified) UPX, very popular with malware authors. These samples are run in CAPE’s debugger until their OEP (original entry point), whereupon they are dumped, fixed and their imports are automatically reconstructed, ready for analysis.
Currently, CAPE has specific packages dumping configuration and payloads for the following malware families:
- PlugX
- EvilGrab
- Sedreco
- Cerber
- TrickBot
- Hancitor
- Ursnif
- QakBot
CAPE has config parsers/decoders for the following malware families, whose payloads are automatically extracted by a behavioral package:
- Emotet
- RedLeaf
- ChChes
- HttpBrowser
- Enfal
- PoisonIvy
- Screech
- TSCookie
- Dridex
- SmokeLoader
Many other malware families have their payloads automatically extracted by behavioral packages, for which CAPE uses Yara signatures to detect the payloads. This list is growing and includes:
- Azorult, Formbook, Ryuk, Hermes, Shade, Remcos, Ramnit, Gootkit, QtBot, ZeroT, WanaCry, NetTraveler, Locky, BadRabbit, Magniber, Redsip, Kronos, PetrWrap, Kovter, Azer, Petya, Dreambot, Atlas, NanoLocker, Mole, Codoso, Cryptoshield, Loki, Jaff, IcedID, Scarab, Cutlet, RokRat, OlympicDestroyer, Gandcrab, Fareit, ZeusPanda, AgentTesla, Imminent, Arkei, Sorgu, tRat, T5000, TClient, TreasureHunter.