arXiv:2611.08608cs.CRNov 2026

Manuscript Offprint

arXiv:2611.08608

AutoPYara: Next-Gen YARA Rule Generator for Malware Family Clustering

Mabon Ninan, Nhat Nguyen, Soumyajyoti Dutta, Sidharth Anil, Marcus Botacin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Mabon Ninan*, Nhat Nguyen*, Soumyajyoti Dutta, Sidharth Anil, Marcus Botacin

Texas A&M University

{ninanmm, nmnguy29, soumyajyoti1998, sid.anil, botacin}@tamu.edu

  • Equal Contribution

Abstract—Millions of malware variants threaten users daily, such that clustering these samples is key for fast incident response. AutoYara is the current state-of-the-art for automatic YARA rule generation, but the task remains challenging on realistic datasets, where intra-family diversity and noisy clustering can degrade rule quality. We present AutoPYara, a solution armored with: (1) precise cluster centroid selection based on similarity hashing, and (2) an improved heuristic for estimating subclusters within a malware family using historical VirusTotal data. We implement AutoPYara as an open-source Python package pip install autopyara to support reproducibility and practical use. We show that AutoPYara, (1) increases rule coverage by 14 percentage points; (2) reduces variance by 7.1 percentage points, comparing the average variance AutoPYara exhibits to that of AutoYara; and (3) improves threat-hunting accuracy by 10%. AutoPYara produces robust and effective YARA rules than prior automatic approaches in practical settings.

Index Terms—Malware, Clustering, Similarity Hashing

1. Introduction

Among millions of malware samples threatening users daily, most are variants of the same family. Handling these samples individually does not scale [1]; thus, clustering samples into families is key for fast incident response, as it allows the same remediation to be applied to all family samples [2], [3]. Multiple approaches have been proposed to cluster unknown samples into families, from signatures [4] to Machine Learning (ML) [5]. Despite their individual success, a one-size-fits-all solution for malware family identification remains an open problem. The current State-of-the-Art (SOTA) for this task is AutoYara [6], a hybrid approach that uses ML for determining Indicator of Compromise (IoCs) that uniquely identify the malware, and YARA [7] signatures for the actual matching, being it the industry-standard. It extracts unique N-grams of bytes from goodware and malware to create an extensive database that is further used with a biclustering [8] algorithm to identify unique byte sequences that are only seen in malware. This allows the automatic derivation of rules to match these unique patterns. Although AutoYara

was a step ahead in automating rule generation, we identified key blind spots: (1) AutoYara was evaluated only on cases with known ground truth. In real-world cases, complete ground truth is not available (attackers do not disclose their templates), such that ground truth is just approximated by AntiVirus (AV) companies via labeling strategies. Different labeling strategies lead to different “groundtruths”, hence it is essential to evaluate their impact to understand how sensitive rule generation frameworks (previous and ours) are to these classification uncertainties; (2) AutoYara’s evaluations only considered samples with known patterns aligned to the pre-trained Bloom filters, ignoring that most in-the-wild samples have unknown patterns caused by concept evolution and byte distribution shift, causing rule generation to fail; (3) AutoYara was only evaluated on large cluster sizes, which tend to be more stable. In contrast, in-the-wild samples might be collected at different family sizes, and their impact on rule generation is unknown.

To characterize the impact of these factors on automatic rule generation, we conducted exhaustive experiments on a dataset of ≈71,000\approx 71,000 samples collected over 8 years by an AV company in 3 countries: the US, Brazil, and Japan. We compared the results under different strategies to approximate ground truth: the application of two similarity hashing functions (SSdeep [9] and J-SDhash [10]); and VirusTotal (VT) labels [11]. However, both strategies introduce distinct trade-offs regarding precision and data volume. Despite producing homogeneous clusters, similarity hashing limits sample coverage and introduces methodological variables like the similarity threshold. AV labels are comprehensive and cover most of the dataset, but result in heterogeneous clusters with increased False Positives (FPs).

Our results highlight the need for: (i) methodical standards to evaluate rule generation with high variance and uncertain labels, which we address by introducing guidelines and best practices for experiments; and (ii) algorithmic solutions to address the inefficient handling of heterogeneous data with high variance. Our analysis of AutoYara revealed that: (1) most of the variability in the results arises from the randomness of the original algorithm, which initiates clustering from arbitrary points that may not align well with heterogeneous distributions observed in real scenarios; (2) the AutoYara algorithm underestimates the number of subclusters a malware family has due to the use of the Variational Bayesian Gaussian Mixture Model (VBGMM) [12] algorithm as the guesser for the number of clusters.

This manuscript is the version accepted at IEEE ACSAC 2026 and appearing in the proceedings. Another version of this work exists as an extended version with supplementary appendices.

We propose solving the problem (1) by adding a crafted centroid selection step to the rule generation process. This ensures that the generation always starts from the best possible centroid to cover a heterogeneous distribution of samples, and in (2) we develop a heuristic to replace VBGMM and increase the number of sub-clusters that the malware families are fitted into, allowing heterogeneous samples to be classified in the same family. The heuristic estimates the number of sub-clusters based on historical malware family data obtained from the VirusTotal oracle. To evaluate our contributions, we created AutoPYara, a solution that implements our proposed algorithm. AutoPYara is as efficient as AutoYara, as it shares the same Java backend. However, it is more user-friendly, as it is implemented as a Python frontend and distributed as a PyPI package. Applied to the same dataset, AutoPYara outperforms AutoYara by up to 14%¹ in its best configuration on real-world samples. Our results demonstrate the impact of centroid selection and reopen the possibility of using VT labels for rule generation—not as a labeling strategy, which we show is problematic, but as a heuristic, which we show is powerful.

References (37)