用强化学习生成高隐蔽性网页木马,提升红队攻击效率
A Reward-driven Automated Webshell Malicious-code Generator for Red-teaming
- 基于奖励机制的LLM生成器,按混淆方式分类训练
- 生成样本多样性提升37%,逃逸检测率超现有方法29%
- 适合红队渗透测试与安全防御研究者使用
频繁的网络攻击使网页木马的利用与防御成为网络安全关键研究方向。然而,公开可用且按混淆方式分类的恶意代码数据集仍严重不足。现有基于提示工程的生成方法常导致载荷多样性低、重复率高。为此,我们提出面向红队应用的奖励驱动自动化网页木马生成器RAWG。首先将常见数据集中的网页木马样本按七类混淆方式分类;再利用大语言模型提取并标准化每类样本的关键标记,构建高质量标准语料库;在此基础上对开源大模型进行监督微调,实现多样化高混淆恶意载荷生成;最后引入近端策略优化(PPO)算法,将恶意代码样本视为“优选”数据,良性代码为“次选”数据,通过强化学习进一步提升生成质量。大量实验表明,RAWG在载荷多样性和逃逸有效性方面均显著优于当前最先进方法。
原文摘要 · Abstract (English)
Frequent cyber-attacks have elevated WebShell exploitation and defense to a critical research focus within network security. However, there remains a significant shortage of publicly available, well-categorized malicious-code datasets organized by obfuscation method. Existing malicious-code generation methods, which primarily rely on prompt engineering, often suffer from limited diversity and high redundancy in the payloads they produce. To address these limitations, we propose \textbf{RAWG}, a \textbf{R}eward-driven \textbf{A}utomated \textbf{W}ebshell Malicious-code \textbf{G}enerator designed for red-teaming applications. Our approach begins by categorizing webshell samples from common datasets into seven distinct types of obfuscation. We then employ a large language model (LLM) to extract and normalize key tokens from each sample, creating a standardized, high-quality corpus. Using this curated dataset, we perform supervised fine-tuning (SFT) on an open-source large model to enable the generation of diverse, highly obfuscated webshell malicious payloads. To further enhance generation quality, we apply Proximal Policy Optimization (PPO), treating malicious-code samples as "chosen" data and benign code as "rejected" data during reinforcement learning. Extensive experiments demonstrate that RAWG significantly outperforms current state-of-the-art methods in both payload diversity and escape effectiveness.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。