What the Fork? Finding and Analyzing Malware in GitHub Forks

Alan Cao, Brendan Dolan-Gavitt2022

Abstract

Initial ssdeep-based binary similarity dataset for the paper "What the Fork? Finding and Analyzing Malware in GitHub Forks".

Introduction

GitHub is the backbone of modern open-source development, and its "fork" feature is essential for collaboration. However, researchers have identified a dangerous security "blind spot": forks are not indexed for public search unless they have more stars than the parent repository. This creates a "dark matter" problem where threat actors can fork a popular project, inject malware into the repository tree or the "Releases" section, and use GitHub’s reputable domain to host malicious payloads. Because these forks are hidden from search and often go unmonitored by the original project maintainers, they serve as an ideal, stealthy infrastructure for phishing, adware, and cryptomining campaigns.

Methodology: Fork Sentry

To combat this threat, we developed Fork Sentry, an automated system for Fork Integrity Analysis. The system follows a multi-stage pipeline to find malicious activity within the vast number of forks on the platform.

System architecture of the Fork Sentry pipeline, illustrating the flow from repository metadata to automated alerting.

The Fork Sentry pipeline includes several key stages:

  1. Typosquatting Detection: Using Levenshtein distance to flag fork owners with names suspiciously similar to original maintainers (e.g., nicehashe vs. nicehash).
  2. Artifact Gathering: Crawling both the repository file tree and the "Releases" page for compiled executables and shell scripts.
  3. Binary Similarity Hashing: Utilizing the ssdeep fuzzy hashing algorithm to identify similar malware samples across different forks, helping link different attacks to the same threat actor.
  4. Malware Analysis: Scanning flagged files via ClamAV (for known signatures) and capa (to detect suspicious capabilities like anti-debugging or packing).
  5. Automated Alerting: Generating alerts for maintainers and providing data for takedown requests to GitHub Trust & Safety.

Results and Findings

The researchers focused their evaluation on 35 popular cryptocurrency-related projects, scanning a total of 68,879 individual forks.

Table summarizing the malicious forks detected across different project categories, including core implementations, miners, and wallets.

Key results from the study include:

  • Detection Success: Fork Sentry identified 26 malicious forks. These were split almost evenly between the Repository Tree (14) and Releases (12), proving that scanners must look beyond just the source code.
  • Financial Impact: The study linked several forks to a persistent threat actor who successfully mined over $200,000 (76.46 ETH) using a custom-packed Go-based miner.
  • Targeting: Interestingly, 22 out of the 26 malicious forks targeted Linux, suggesting attackers are focusing on cloud servers and containers for high-performance cryptomining.
  • Evasion Techniques: Attackers employed sophisticated "anti-analysis" tricks, such as custom packing and checking for debuggers (ptrace), to hide their activities.

Discussion and Future Work

While Fork Sentry is a powerful tool, it has limitations. It currently focuses on compiled binaries and scripts rather than direct source code modifications. Additionally, GitHub’s API rate limits can slow down large-scale crawling. Future work aims to explore more robust hashing methods like TLSH to prevent similarity evasion and to expand the scan beyond cryptocurrency to the entire GitHub ecosystem.

Conclusion

The discovery of active, profitable malicious campaigns within GitHub forks highlights a critical gap in open-source security. By implementing automated monitoring systems like Fork Sentry, maintainers can better protect their projects and users from these stealthy supply chain attacks.

Summary updated

BibTeX
@misc{cao2022what,
  author = {Alan Cao and Brendan Dolan-Gavitt},
  title = {{What the Fork? Finding and Analyzing Malware in GitHub Forks}},
  year = {2022},
  doi = {10.14722/madweb.2022.23001},
}
Figure