Cloudflare

How we train AI to uncover malicious JavaScript intent and make web surfing safer

Mar 19, 2025Juan Miguel Cejuela, Zhiyuan Zheng
How we train AI to uncover malicious JavaScript intent and make web surfing safer
SummaryAI, from the source post

Introduced a new AI model for Page Shield that detects specific malicious JavaScript intents (Magecart, crypto mining, malware) by parsing JavaScript into concrete syntax trees (CSTs) using tree-sitter, converting them to an AST-like structure, and feeding this into a message-passing graph convolutional network (MPGCN). The model handles obfuscated code by treating it as is and leveraging graph structure information. The TF-GNN library is used for implementation, with consideration for switching to PyTorch Geometric due to sparse matrix support limitations.

More from the Website Security & Threat Management trail