VYPR
researchPublished Sep 16, 2026· 1 source

Cloudflare's ML Model Detects Sophisticated JavaScript Attacks Evading Traditional Scanners

Cloudflare's Client-Side Security model, utilizing a graph neural network, has identified four distinct malicious JavaScript campaigns that bypassed conventional security tools like VirusTotal and URLScan.

Modern e-commerce websites can harbor hidden threats, with malicious JavaScript silently siphoning affiliate revenue, hijacking user searches and clicks, tampering with analytics, or executing commands from remote servers. These attacks often operate beneath the surface, leaving the storefront appearing functional while compromising user trust and business integrity. Cloudflare's Page Shield machine learning (ML) model is designed to expose these "blind spots" by analyzing JavaScript behavior in real-time.

In a recent analysis, Cloudflare's ML model automatically detected eight malicious JavaScript payloads across four distinct operations. Human analysts verified these findings after the system flagged them. Strikingly, when these payloads were subsequently scanned using traditional security tools, seven out of the eight were completely absent from VirusTotal, and URLScan failed to classify any of them as malicious. This highlights a significant gap in signature-based detection methods against evolving threats.

One notable example involved a payload belonging to the broader Lnkr family. A specific version of this script had remained undetected by URLScan for nearly two and a half years, even after a direct scan in January 2024. While VirusTotal eventually flagged it, the timing of its initial classification remains unclear. Cloudflare's ML model, however, identified the same malicious code live on an online retailer's website. This underscores the critical need for proactive detection that goes beyond waiting for known malicious signatures.

The four identified operations presented unique challenges, lacking universal signatures or common obfuscation techniques. One script remained dormant, activating only when specific conditions related to the device, country, time, referrer, or browser state were met. Another hid affiliate-related requests within an invisible iframe, while others intercepted user clicks, suppressed monitoring tools, or conditionally fetched additional code from external servers. Detecting these varied tactics requires continuous browser visibility and an understanding of how script components interact.

Cloudflare's detection methodology relies on a graph neural network (GNN) that analyzes JavaScript not as raw text, but as a structured graph. This approach allows the GNN to understand code relationships, identify buried malicious elements, and detect suspicious patterns even when code is minified, renamed, or partially obfuscated, without needing a known URL or byte signature. This GNN has previously been instrumental in detecting malicious npm packages and in-the-wild Magecart payment skimmers.

To further refine detections and reduce false positives, scripts flagged by the GNN are sent to a lightweight large language model (LLM) on Workers AI for a second opinion. This layered approach maintains high recall while ensuring accuracy. When the LLM corroborates the GNN's findings, customers are alerted to potential threats.

For highly complex scripts, Cloudflare employs a cohort of "frontier models"—an ensemble of automated judges. These models, drawn from various families and running on Workers AI, analyze suspicious scripts independently. Their ability to use restricted JavaScript evaluators helps unpack concealed behaviors. Disagreements among these models are treated as valuable signals, contributing to a weighted voting system that determines the script's classification as benign, payment skimming, other malware, or cryptomining.

These four operations demonstrate the diverse nature of client-side attacks, ranging from affiliate commission theft to the hijacking of analytics data. The ability of Cloudflare's ML model to identify such varied malicious behaviors, which often evade traditional signature-based scanners, highlights the growing importance of behavioral analysis and machine learning in defending modern web applications against sophisticated threats.

Synthesized by Vypr AI