We find that graph neural networks are useful for classifying JavaScript structures, while LLM-generated embeddings separately help select diverse scripts for annotation.
“Finding malicious scripts is like finding a needle in a haystack; they are anomalies among plenty of otherwise benign JavaScript. This naturally results in a highly imbalanced dataset. For example, our Magecart-labeled scripts only account for ~6% of the total dataset.”
Because malicious scripts are a small minority and benign scripts can be obfuscated too, careful selection and labeling shape what a classifier learns; representative examples matter as much as model architecture.