LLM-generated XSS obfuscations preserve runtime behavior only 22% of the time
LLMs can generate obfuscated XSS payloads that retain original behavior, but success rates are low
AI/ML arXiv 21 Apr 2026 Measurement Prototype evidence
Published as “Evaluating LLM-Generated Obfuscated XSS Payloads for Machine Learning-Based Detection”
Why it matters
Behavior-filtered LLM-generated XSS samples can be added to training data without hurting detection, but they currently offer little performance gain.
Summary
Fine-tuning an LLM on behavior-filtered XSS obfuscation pairs raises the runtime behavior match rate from 0.15 to 0.22 (a 46.7% relative gain). The improvement is modest: only about one-fifth of generated payloads preserve the original script’s execution, and downstream XSS detection performance changes little. The paper’s evidence comes from a 1,000-chain dataset with 200 manually evaluated samples; no abstract was provided, so details may be incomplete.
What they found 2
- Fine-tuning improves runtime behavior match rate from 0.15 to 0.22
“The fine-tuned model achieves a match rate of 0.22, corresponding to a 46.7% relative improvement over the baseline.”
- Adding generated payloads does not materially change downstream detection performance
“The model trained on original data alone slightly outperforms the augmented conditions, but the differences are marginal.”
Caveats 4
- The absolute match rate remains low (only 22% of generated payloads preserve behavior).
- Generated samples form a very small fraction of the overall dataset, so they do not improve detector performance.
- However, the low absolute match rate shows that current LLMs still struggle to preserve execution behavior reliably.
- the generated samples represent a very small fraction of the full dataset, so the classifier is dominated by the original data distribution.
What’s new here 4
- A pipeline that filters LLM-generated payloads by actual browser execution behavior before fine-tuning.
- A browser-based runtime evaluation metric that measures functional equivalence rather than syntactic similarity.
- Empirical assessment of how behavior-filtered generated samples affect a downstream Random Forest XSS detector.
- Analysis of which deterministic transformation pairs yield higher validity rates.