arXiv:2604.19526cs.CRcs.LG2026-04

用大模型生成混淆的网页攻击代码,靠运行时行为验证质量。

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

  • 结合确定性变换与大模型生成,通过浏览器执行测试行为一致性。
  • 未调优模型行为匹配率仅15%,微调后提升至22%。
  • 强调运行时验证对提升数据质量的关键作用,适合安全检测研究者。

跨站脚本(XSS)仍是持续存在的网络漏洞,因混淆可改变恶意代码的表面形式却保持其行为不变,使传统和基于机器学习的检测系统难以识别。现有生成混淆代码的方法多关注语法多样性,但未必保证行为有效性。本文提出一种基于大语言模型(LLM)的结构化流水线,用于生成与评估混淆的XSS载荷。该流程融合确定性转换与LLM生成,并采用基于浏览器的运行时评估机制,在受控环境中比较载荷的行为表现,而非仅依赖语法相似性。评估显示,未经调优的基线语言模型行为匹配率为0.15,而使用行为保持的源-目标混淆对进行微调后,匹配率提升至0.22。尽管有所改善,结果表明当前LLM仍难以生成真正保留可观测运行时行为的混淆载荷。下游分类器实验进一步表明,加入生成载荷并未提升检测性能;但经过行为筛选的样本可无损引入。研究揭示了生成模型在对抗性安全数据生成中的潜力与局限,强调运行时行为检验对提升生成数据质量的重要性。

原文摘要 · Abstract (English)

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.

网络安全大模型代码生成检测评估

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。