Malware code is smaller, less documented, and more complex per function than benign code
Malware developers exhibit distinct coding habits reflected in lower documentation, smaller size, and higher cyclomatic complexity per function compared to benign developers
Security & privacy arXiv 4 Jun 2026 Measurement Real-world evidence
Published as “Exploring the connection between coding habits and cognitive styles in malware developers”
Why it matters
The identified coding shortcuts and higher vulnerability density suggest potential defensive opportunities, but the lack of a strong distinguishing signal limits immediate practical exploitation for malware attribution or detection.
Summary
Malware source code is on average smaller, less documented, and has higher cyclomatic complexity per function, uses fewer abstraction mechanisms, and contains more vulnerability types that benign code typically avoids, but overall the metrics do not differ enough from benign software to be a clear distinguishing signal. The study analyzes 658 leaked malware projects and 249 benign open-source projects using static analysis tools, but the findings are limited to a 70% subset of malware due to tool language support.
What they found 3
- Malware code is generally smaller, less documented, and has higher cyclomatic complexity per function.
“Our findings reveal that malware code is generally smaller, less documented, and exhibits higher cyclomatic complexity per function, with reduced use of abstraction mechanisms such as classes and closures.”
- Malware exhibits more vulnerability types that benign code typically avoids.
“Vulnerability analysis further reveals that malware exhibits more issues of the types that benign code typically avoids, suggesting a minimal investment in secure development practices.”
- Overall code-quality metrics do not deviate enough from benign software to be distinctive.
“it does not deviate significantly from benign software enough to be distinctive.”
Caveats 3
- The claim of distinct coding patterns is qualified by the observation that code-quality metrics do not deviate significantly from benign software.
- We explicitly acknowledge this coverage limitation, namely the structural and metricbased conclusions drawn in this study represent this specific 70% subset
- we applied an outlier filter to the dataset using the standard IQR criterion ... to reduce the influence of extreme values and avoid potential misinterpretation of the results
What’s new here 3
- Combines static application security testing (SAST) with traditional software code metrics to study malware source code.
- Analyzes a large, multi-language corpus of leaked malware (658 projects) alongside carefully matched benign open-source projects.
- Interprets code quality and vulnerability patterns as behavioral indicators of malware developers' motivations and risk tolerances.