HoneyCode: Automating Deceptive Software Repositories with Deep Generative Models

David D. Nguyen, David Liebowitz, Surya Nepal, Salil S. KanhereHICSS 2021

Introduction

Cyber deception is a proactive defense strategy that uses honeypots—decoy systems and data—to detect and study attackers. For deception to be effective, these decoys must be indistinguishable from real assets. In the context of software development, this means creating fake repositories that look like legitimate internal projects. However, manual creation of such "honeyfiles" is unscalable, and using real code risks leaking intellectual property.

HoneyCode addresses this challenge by introducing a machine learning framework that automatically generates realistic, synthetic software repositories. These repositories feature believable directory structures, filenames, and source code tailored to an organization's specific style without containing any actual proprietary data.

The Triple Network Architecture

The core of HoneyCode is a specialized architecture that generates a repository through three sequential, conditioned stages:

1. Tree Recurrent Network (TRN)

Traditional graph generation models often struggle with tree structures, frequently producing invalid graphs with cycles or isolated nodes. HoneyCode introduces the Tree Recurrent Network (TRN) to solve this. The TRN treats the directory structure as a tree and uses a multinomial distribution to ensure every new node has exactly one parent, guaranteeing 100% tree validity.

Mapping a directory tree to its matrix representation for the TRN.

To capture the conventions of software organization, the TRN incorporates a "depth feature." This allows the model to learn that certain directories (like src) typically appear at the root, while others are nested deeper. The generation process is sequential, where the state of the existing tree informs the creation of the next node.

The sequential training process of the TRN, predicting the next node (label) based on the current tree structure (input).

2. Folder and File Name Generator

Once the structure is defined, a character-level Gated Recurrent Unit (GRU) network generates names for each node. This generator is conditioned on the node’s depth and type (file vs. folder). This conditioning ensures that top-level folders receive names like test or docs, while files in deep subdirectories receive contextually appropriate names like runtests.jl.

3. Content Generator

The final stage involves generating the "pocket litter"—the actual content within the files. Another character-level GRU is used, conditioned on the file extension (e.g., .jl, .md, .yml). This allows the model to mimic the syntax of different languages and documentation formats. While the code is not functionally correct, it is syntactically realistic enough to pass a cursory inspection by an attacker.

Evaluation and Results

The models were trained on a dataset of 3,254 public Julia repositories from GitHub. Evaluation focused on structural accuracy and distributional similarity.

  • Structural Accuracy: The TRN achieved 100% tree validity, significantly outperforming general-purpose graph generators like GRAN, which only managed 13.6%.
  • Distributional Similarity: Using Maximum Mean Discrepancy (MMD), the TRN showed a 90-92% reduction in degree MMD and a 75-86% reduction in depth MMD compared to baseline random generators, indicating a high degree of structural realism.
  • Qualitative Realism: The system successfully generated standard filenames such as Project.toml and LICENSE, and produced Julia code snippets with realistic function definitions and indentation.

Conclusion and Future Work

HoneyCode demonstrates the feasibility of using deep generative models to automate the creation of high-fidelity deceptive assets. By focusing on structural constraints (trees) and hierarchical conditioning (depth), it produces repositories that are both valid and convincing.

Future research will focus on improving inter-file consistency—ensuring that import statements in one file correspond to other generated files—and scaling the content generator to handle a wider variety of programming languages and file types simultaneously.

Summary updated

BibTeX
@inproceedings{nguyen2021honeycode,
  author = {David D. Nguyen and David Liebowitz and Surya Nepal and Salil S. Kanhere},
  title = {{HoneyCode: Automating Deceptive Software Repositories with Deep Generative Models}},
  booktitle = {HICSS},
  year = {2021},
}
Figure