Search papers, labs, and topics across Lattice.
This paper introduces a pipeline that uses LLMs to generate obfuscated XSS payloads, combining deterministic transformations with LLM-based generation. The pipeline evaluates the generated payloads by comparing their runtime behavior in a controlled browser environment, rather than relying solely on syntactic similarity. Results show that while fine-tuning improves the behavior match rate (from 0.15 to 0.22), current LLMs still struggle to consistently generate behavior-preserving XSS obfuscations, and these generated payloads do not improve downstream classifier performance.
LLMs can generate XSS payloads, but even after fine-tuning, they struggle to preserve the original runtime behavior, highlighting a key challenge in using LLMs for adversarial security data generation.
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.