
High Vulnerability (7.5) - CAPEv2 reporting/mongodb.py and reporting/jsondump.py allow denial-of-analysis when deeply nested or oversized behavior documents trigger orjson serialization errors or MongoDB BSON size/nesting limits, causing truncated or missing analysis reports.
A High-Severity Denial-of-analysis vulnerability affects reporting/mongodb.py and reporting/jsondump.py in CAPEv2 (commit 52e4b43, on 2025-05-17) allows attackers who can submit samples to cause incomplete or missing behavioral analysis reports by generating deeply nested or oversized behavior data that trigger MongoDB BSON limits or orjson recursion errors when the sample executes in the sandbox.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HThe root cause of this vulnerability lies in CAPEv2’s handling of large, deeply nested behavior reports generated during dynamic malware analysis.
MongoDB BSON Document Size Limit:
CAPEv2 uses MongoDB to store analysis reports, which have a 16 MB BSON document size limit [1].
When reports exceed this size, often due to extensive process trees, API calls, or recursive data, the database rejects the insert, causing report generation to fail.
MongoDB Nesting Depth Limit:
MongoDB also enforces a maximum nesting depth of 100 levels per BSON document.
Recursive malware behaviors can easily exceed this, leading to insert failures even when the document size is under 16 MB.
Python JSON Serialization Limits:
CAPEv2 relies on Python’s orjson library to serialize results into JSON.
Deeply nested or recursive structures cause the serializer to hit Python’s recursion limits, leading to serialization failures and aborted report generation [2].
Pruning and Error Handling:
CAPEv2 attempts to mitigate these issues by pruning large portions of the report progressively (removing child nodes or entire process subtrees).
However, this is insufficient when behavior complexity surpasses pruning thresholds, resulting in repeated failures to save the report.
This is a denial-of-analysis vulnerability in CAPEv2 that can cause the dynamic analysis engine to fail to capture or report behavioral activity. Exploitation allows adversaries to bypass behavioral detection and produce incomplete or missing analysis reports.
In pipelines that depend on CAPEv2 for triage or threat intelligence enrichment, this flaw can lead to:
CAPEv2 — repository: https://github.com/kevoreilly/CAPEv2
Relevant commit / build information
52e4b43a2cb508d3483819042cf8e4d8348f3a05[email protected])masterenzok/updates-01The following table presents evidence from multiple analysis tasks, showing how increasing complexity and duration lead to MongoDB and serialization failures, resulting in incomplete or missing behavior reports.
Table 1: CAPEv2 analysis results showing correlation between task complexity, report size, and failure conditions.
Spawns 5,000 processes and performs multi‑round XOR decryption at runtime to emulate realistic evasion. For custom builds (different recursion rounds, key lengths, or process volumes), contact the authors for a custom version.
Run the demo:
poc\vathos_demo.exe <IP> <PORT>
Make sure a listener is running on the specified IP/PORT (e.g., nc, ncat, Metasploit, or any C2 listener) to observe connection attempts. In a properly functioning sandbox the connection attempt would be visible; under the denial-of-analysis conditions described, the connection may not appear in CAPEv2 reports.
180+ secondsOptions to vary:
full-proc-memory-dumpsimport-reconstruction-proc-dumpsstore_compressed = yes and store_compressed = noEnsure MongoDB and orjson are using their default limits for these tests.
As process-tree depth and complexity increase, reporting failures may occur such as:
orjson recursion limit reachedCAPEv2 may:
Figure 1 - Backend logs shows JSON dump warnings, orjson/serialization errors and MongoDB OperationFailure entries

Figure 2 - Dashboard: failed_analysis

Figure 3 - Behavioral tab: "Sorry! No behavior."

| Timeout (sec) | Custom Settings | Duration (sec) | Logged Processes | BSON Logs (Files / Size) | Report.json Size (KB) | Errors / Warnings | Behavior Status |
|---|
| 60 | enforce-timeout | 413 | 24 | 25 / 126 KB | 613 | – | Behavior OK |
| 60 | – | 252 | 38 | 39 / 200 KB | 923 | – | Behavior OK |
| 60 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout, syscall | 230 | 42 | 43 / 230 KB | 1054 | – | Behavior OK |
| 100 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout, syscall | 330 | 61 | 62 / 318 KB | 1482 | – | Behavior OK |
| 100 | – | 277 | 81 | 82 / 493 KB | 2032 | – | Behavior OK |
| 120 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout, syscall | 340 | 72 | 73 / 383 KB | 1793 | – | Behavior OK |
| 120 | – | – | 88 | 89 / 475 KB | 2228 | – | Behavior OK |
| 180 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout, syscall | 414 | 90 | 91 / 492 KB | 2356 | MongoDB Code 15 | No behavior |
| 180 | – | 323 | 88 | 89 / 475 KB | 2228 | – | Behavior OK |
| 200 | – | 413 | 119 | 120 / 645 KB | 3174 | MongoDB Code 15 | No behavior |
| 200 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout | – | – | 144 / 726 KB | – | Recursion limit reached, MongoDB Code 15 | Failed reporting |
| 300 | – | 513 | 146 | 147 / 779 KB | 3676 | MongoDB Code 15 | No behavior |
| 300 | full-proc-memory-dumps, import-reconstruction-proc-dumps, enforce-timeout, syscall | – | – | 167 / 892 KB | – | Recursion limit reached, MongoDB Code 15 | Failed reporting |