TL;DR
Attackers are using Large Language Models (LLMs) to rewrite Android malware on the fly—preserving the malicious behavior while scrambling the code enough to slash automated detector accuracy by over 60%. Instead of fighting this with blind, random training tweaks, this paper turns the attackers' weapon into a vaccine. By prompting LLMs to synthetically refactor existing malware graphs during training, defenders can proactively inoculate their classifiers against unseen, shape-shifting threats.
What Problem Does This Paper Address?
How do you analyze an Android app containing thousands of methods without drowning in compute? Security researchers typically abstract the program into a Function Call Graph (FCG)—a roadmap where each node is a function (enriched with an LLM code embedding) and directed edges show which function calls which. Graph Neural Networks (GNNs) trained on these maps are remarkably good at spotting known malware families.
Enter LLM-powered metamorphic malware. Today, an attacker can feed malicious code to an LLM and ask for a structurally distinct, functionally identical rewrite. To a GNN trained on static datasets, this rewritten app looks completely alien, causing catastrophic drops in detection accuracy.
Usually, when machine learning models suffer from data scarcity, we use data augmentation. For graphs, standard augmentation means randomly dropping nodes or edges, or injecting random noise into node features. On a code graph, however, randomly deleting functions produces gibberish—programs that wouldn't even compile, let alone mimic how an intelligent LLM restructures logic. Defenders needed a way to generate training variants that are both structurally diverse and semantically coherent as actual software.
Methods
The authors introduce FCGA (Function Call Graph Augmentation), a two-stage pipeline that first pinpoints the most critical parts of an app's call graph and then uses an open-weight code model (Qwen2.5-Coder-7B) to meaningfully refactor them.
Because rewriting thousands of nodes per app is computationally intractable, FCGA first selects target components using either structure-based rules (classic network centrality hubs) or model-aware signals (borrowing explainable AI tools like SubgraphX to ask the GNN which specific nodes actually drive its predictions).
Once selected, FCGA augments the targets across three distinct modes:
- Function-level Rewriting (FCGA-F): The LLM rewrites a single function's Java code—changing variables, APIs, and control flow—while strictly preserving its inputs, outputs, and call signature. The graph topology stays fixed; only the node embeddings change.
- Embedding Perturbation (FCGA-P): A fast, zero-LLM shortcut. Knowing that similar code yields similar embeddings, it analytically adds scaled Gaussian noise to node vectors to keep them at a set cosine similarity from the original.
- Subgraph-level Refactoring (FCGA-S): The heavy hitter. The LLM summarizes what a connected cluster of functions does, and is then given creative freedom to split, merge, or reorganize those functions while keeping the subgraph's outer boundary intact so it stitches cleanly back into the app.
Datasets
The authors evaluate their framework on MNTF (a feature-enriched derivative of MalNet), an established benchmark of decompiled Android malware FCGs embedded via Qwen3-Embedding-0.6B:
- In-Domain (
Tinysplit): Standard train/test splits from the same underlying distribution. - Out-of-Distribution (
Commonsplit): Models covariate shift to test generalization against newly emerging malware variants. - Direct LLM-Rewrite Stress Test: Reproducing a realistic attack (LLMalMorph), the authors used a separate model (Phi-4-Mini-3.8B) to rewrite every node across 100 training and 100 test samples, testing whether Qwen-trained defenses hold up against an entirely different attacker LLM.
Key Insights and Ideas
- The Fidelity-Diversity Tradeoff: What a model needs depends entirely on when you intervene. During pre-training, the GNN is learning basic representations, so broad structural diversity (like non-model-aware FCGA-S, or even aggressive random node-dropping) works best. During low-data fine-tuning, the model's decision boundary is fragile; blind node-dropping destroys accuracy, whereas high-fidelity, model-aware semantic rewrites shine.
- Summarize First, Refactor Second: Directly feeding raw code from multiple functions overwhelms small LLMs. Having the LLM summarize each function's behavior first shifts its reasoning from how code is written to what it accomplishes, unlocking clean topological restructuring.
- Hubs Aren't Always the Culprit: High-degree utility functions dominate graph structure, yet a quiet, low-degree function might harbor the actual malicious payload. Using GNN explainability ensures augmentation targets the model's true blind spots.
Key Results
Tested across four GNN backbones (GCN, GIN, GAT, GraphSAGE), FCGA consistently beat unaugmented and blind-drop baselines:
- Direct Attack Resilience: On unseen Phi-4-rewritten malware, a standard GIN classifier collapsed from 94.7% in-domain accuracy down to 34.0%. Model-aware subgraph refactoring (
FCGA-S + Model) lifted accuracy to 44.0%—a 10 percentage point jump over the baseline and 5–8 points ahead of random drop methods. - OOD Generalization: On the
Commoncovariate-shift benchmark,FCGA-S + Modelboosted GIN accuracy from 57.77% to 62.47% during pre-training (reaching 64.4% in stress-test checkpoints). - Cheap Pre-training Wins: Even on saturated in-domain tests (~92–94%), the closed-form
FCGA-Psqueezed out up to a 1.7% gain on GAT (92.13% to 93.80%) without a single LLM call.
Limitations and Future Work
- Compute Overhead: Running LLM inference across large training corpora isn't cheap—though it is a one-time, offline cost, and ablations show strong returns even with a tiny budget of augmented nodes.
- Small Model Guardrails & Ceiling: The authors relied on a local 7B model because frontier proprietary APIs (like GPT-5 or Claude) trigger safety refusals when handed decompiled malware snippets. Stronger open-weight reasoning models should yield cleaner refactorings.
- Platform Specificity & Static Passes: Experiments were confined to decompiled Android Java bytecode, and augmentations were generated in a single static pass. Extending FCGA to native binaries (Windows PE, Linux ELF) and exploring iterative, adversarial-style multi-round training remain open frontiers.
Summary updated