Abstract
Where can we find malware source code? This question is motivated by a real need: there is a dearth of malware source code, which impedes various types of security research. Our work is driven by the following insight: public archives, like GitHub, have a surprising number of malware repositories. Capitalizing on this opportunity, we propose SourceFinder, a supervised-learning approach to identify repositories of malware source code efficiently. We evaluate and apply our approach using 97K repositories from GitHub. First, we show that our approach identifies malware repositories with 89% precision and 86% recall using a labeled dataset. Second, we use SourceFinder to identify 7,504 malware source code repositories, which arguably constitutes the largest malware source code database. Finally, we study the fundamental properties and trends of the malware repositories and their authors. The number of such repositories appears to be growing by an order of magnitude every 4 years, and 18 malware authors seem to be "professionals" with well-established online reputations. We argue that our approach and our large repository of malware source code can be a catalyst for research studies which are currently not possible.
The Problem: A Scarcity of Source Code
Security researchers face a major bottleneck: a severe lack of malware source code. While databases containing malware binaries (compiled executables) are plentiful, the original source code is much harder to find. This source code is the "ground truth" required to understand complex attack techniques and to evaluate the effectiveness of defensive tools like decompilers and anti-virus engines.
The researchers behind SourceFinder realized that many developers—including malicious ones—publicly host their code on platforms like GitHub. However, with over 32 million public repositories, finding actual malware amidst the noise of legitimate software and security tutorials is a massive manual challenge.
Methodology: The SourceFinder Pipeline
SourceFinder is a multi-stage pipeline designed to automate the discovery of malware source code from massive archives. The process involves:
- Retrieval: Using a set of 137 malware-related keywords (e.g., "ransomware," "Mirai") to pull an initial pool of ~97,000 candidate repositories.
- NLP Preprocessing: Cleaning text from repository titles, descriptions, and README files using stemming and noise filtering.
- Feature Engineering: Comparing text representation methods. Interestingly, a traditional Bag-of-Words (BoW) model outperformed complex word embeddings, as repository metadata is often too short for deep learning models to find meaningful context.
- Classification: Testing several models to distinguish between malware and non-malware repositories.
- Source Code Heuristic: A final check for specific file extensions (C++, Python, etc.) and a requirement of at least 75% source code content to ensure the repository isn't just a description of malware.
Key Results and Performance
SourceFinder achieved high accuracy in identifying malware repositories. Among the models tested, Multinomial Naive Bayes (NB) was the most effective, striking the best balance between precision and recall.
The tool identified 7,504 malware source code repositories, creating what is likely the largest database of its kind. For comparison, the well-known "theZoo" archive contains only about 80 source code repositories. Keyloggers were the most common type of malware found (679 repos), followed by backdoors and viruses.
Insights into the Malware Ecosystem
The study revealed several critical trends within the public malware landscape:
- Exponential Growth: The number of malware repositories on GitHub appears to be growing by an order of magnitude every four years, suggesting the platform is an increasingly popular hub for malware collaboration.
- The "Professional" Hacker: The authors identified 18 "professional" malware authors who use consistent usernames across GitHub and underground hacking forums, using the platform to build a "brand" and establish credibility.
- Target Demographics: While Windows and Linux remain the primary targets, there has been a significant rise in IoT and iPhone-related malware repositories since 2014.
Limitations and Future Work
While effective, SourceFinder faces potential evasion; authors could obfuscate their repositories with benign descriptions. Additionally, the tool does not yet distinguish between original creators and mirrors. Future work will look toward expanding the approach to platforms like GitLab and BitBucket and analyzing how malware families evolve as they are shared and modified by different authors.
Summary updated