ArXiv TLDR

Evaluating LLM-Generated Obfuscated XSS Payloads for Machine Learning-Based Detection

🐦 Tweet
2604.19526

Divyesh Gabbireddy, Suman Saha

cs.CRcs.LGcs.SE

TLDR

LLMs struggle to generate behavior-preserving obfuscated XSS payloads, underscoring the need for runtime validation in adversarial security data generation.

Key contributions

  • Developed a pipeline for generating and evaluating LLM-based obfuscated XSS payloads.
  • Introduced a browser-based runtime evaluation to verify payload behavior, not just syntax.
  • Found LLMs struggle to generate behavior-preserving XSS obfuscations (max 0.22 match rate).
  • Showed generated payloads didn't improve XSS detection, but filtered ones didn't degrade it.

Why it matters

XSS remains a critical web vulnerability, with obfuscation making detection challenging. This paper shows LLMs currently struggle to generate behavior-preserving obfuscated payloads. It emphasizes the vital importance of runtime behavior checks for creating high-quality adversarial data in security research.

Original Abstract

Cross-site scripting (XSS) remains a persistent web security vulnerability, especially because obfuscation can change the surface form of a malicious payload while preserving its behavior. These transformations make it difficult for traditional and machine learning-based detection systems to reliably identify attacks. Existing approaches for generating obfuscated payloads often emphasize syntactic diversity, but they do not always ensure that the generated samples remain behaviorally valid. This paper presents a structured pipeline for generating and evaluating obfuscated XSS payloads using large language models (LLMs). The pipeline combines deterministic transformation techniques with LLM-based generation and uses a browser- based runtime evaluation procedure to compare payload behavior in a controlled execution environment. This allows generated samples to be assessed through observable runtime behavior rather than syntactic similarity alone. In the evaluation, an untuned baseline language model achieves a runtime behavior match rate of 0.15, while fine-tuning on behavior-preserving source-target obfuscation pairs improves the match rate to 0.22. Although this represents a measurable improvement, the results show that current LLMs still struggle to generate obfuscations that preserve observed runtime behavior. A downstream classifier evaluation further shows that adding generated payloads does not improve detection performance in this setting, although behavior- filtered generated samples can be incorporated without materially degrading performance. Overall, the study demonstrates both the promise and the limits of applying generative models to adversarial security data generation and emphasizes the importance of runtime behavior checks in improving the quality of generated data for downstream detection systems.

📬 Weekly AI Paper Digest

Get the top 10 AI/ML arXiv papers from the week — summarized, scored, and delivered to your inbox every Monday.