Skip to main content
CenXiv.org
此网站处于试运行阶段,支持我们!
我们衷心感谢所有贡献者的支持。
贡献
赞助
cenxiv logo > cs > arXiv:2507.10054

帮助 | 高级搜索

计算机科学 > 软件工程

arXiv:2507.10054 (cs)
[提交于 2025年7月14日 ]

标题: 使用大语言模型的显式漏洞生成:超越对抗攻击的研究

标题: Explicit Vulnerability Generation with LLMs: An Investigation Beyond Adversarial Attacks

Authors:Emir Bosnak, Sahand Moslemi, Mayasah Lami, Anil Koyuncu
摘要: 大型语言模型(LLMs)越来越多地被用作代码助手,但当明确要求生成不安全代码时,它们的行为仍知之甚少。 尽管之前的研究集中在无意的漏洞或对抗性提示技术上,但本研究考察了一个更直接的威胁场景:当提示直接或间接时,开源LLMs生成易受攻击的代码。 我们提出了一种双实验设计:(1)动态提示,系统地在结构化模板中变化漏洞类型、用户角色和直接性;(2)反向提示,从真实的易受攻击代码样本中推导提示,以评估漏洞再现的准确性。 我们使用ESBMC静态分析评估了三个开源7B参数模型(Qwen2、Mistral和Gemma),以评估漏洞的存在性和生成漏洞类型的正确性。 结果表明,所有模型经常生成易受攻击的输出,其中Qwen2的正确率最高。 用户角色显著影响成功率,学生角色比专业角色更容易产生漏洞,而直接提示略为有效。 漏洞再现与循环复杂度呈倒U型关系,在中等范围内达到峰值。 我们的发现揭示了开源模型中安全机制的局限性,特别是对于看似无害的教育请求。
摘要: Large Language Models (LLMs) are increasingly used as code assistants, yet their behavior when explicitly asked to generate insecure code remains poorly understood. While prior research has focused on unintended vulnerabilities or adversarial prompting techniques, this study examines a more direct threat scenario: open-source LLMs generating vulnerable code when prompted either directly or indirectly. We propose a dual experimental design: (1) Dynamic Prompting, which systematically varies vulnerability type, user persona, and directness across structured templates; and (2) Reverse Prompting, which derives prompts from real vulnerable code samples to assess vulnerability reproduction accuracy. We evaluate three open-source 7B-parameter models (Qwen2, Mistral, and Gemma) using ESBMC static analysis to assess both the presence of vulnerabilities and the correctness of the generated vulnerability type. Results show all models frequently produce vulnerable outputs, with Qwen2 achieving highest correctness rates. User persona significantly affects success, where student personas achieved higher vulnerability rates than professional roles, while direct prompts were marginally more effective. Vulnerability reproduction followed an inverted-U pattern with cyclomatic complexity, peaking at moderate ranges. Our findings expose limitations of safety mechanisms in open-source models, particularly for seemingly benign educational requests.
评论: 被ICSME 2025接受
主题: 软件工程 (cs.SE)
引用方式: arXiv:2507.10054 [cs.SE]
  (或者 arXiv:2507.10054v1 [cs.SE] 对于此版本)
  https://doi.org/10.48550/arXiv.2507.10054
通过 DataCite 发表的 arXiv DOI(待注册)

提交历史

来自: Anil Koyuncu [查看电子邮件]
[v1] 星期一, 2025 年 7 月 14 日 08:36:26 UTC (4,239 KB)
全文链接:

获取论文:

    查看标题为《》的 PDF
  • 查看中文 PDF
  • 查看 PDF
  • HTML(实验性)
  • TeX 源代码
  • 其他格式
许可图标 查看许可
当前浏览上下文:
cs.SE
< 上一篇   |   下一篇 >
新的 | 最近的 | 2025-07
切换浏览方式为:
cs

参考文献与引用

  • NASA ADS
  • 谷歌学术搜索
  • 语义学者
a 导出 BibTeX 引用 加载中...

BibTeX 格式的引用

×
数据由提供:

收藏

BibSonomy logo Reddit logo

文献和引用工具

文献资源探索 (什么是资源探索?)
连接的论文 (什么是连接的论文?)
Litmaps (什么是 Litmaps?)
scite 智能引用 (什么是智能引用?)

与本文相关的代码,数据和媒体

alphaXiv (什么是 alphaXiv?)
CatalyzeX 代码查找器 (什么是 CatalyzeX?)
DagsHub (什么是 DagsHub?)
Gotit.pub (什么是 GotitPub?)
Hugging Face (什么是 Huggingface?)
带有代码的论文 (什么是带有代码的论文?)
ScienceCast (什么是 ScienceCast?)

演示

复制 (什么是复制?)
Hugging Face Spaces (什么是 Spaces?)
TXYZ.AI (什么是 TXYZ.AI?)

推荐器和搜索工具

影响之花 (什么是影响之花?)
核心推荐器 (什么是核心?)
IArxiv 推荐器 (什么是 IArxiv?)
  • 作者
  • 地点
  • 机构
  • 主题

arXivLabs:与社区合作伙伴的实验项目

arXivLabs 是一个框架,允许合作伙伴直接在我们的网站上开发和分享新的 arXiv 特性。

与 arXivLabs 合作的个人和组织都接受了我们的价值观,即开放、社区、卓越和用户数据隐私。arXiv 承诺这些价值观,并且只与遵守这些价值观的合作伙伴合作。

有一个为 arXiv 社区增加价值的项目想法吗? 了解更多关于 arXivLabs 的信息.

这篇论文的哪些作者是支持者? | 禁用 MathJax (什么是 MathJax?)
  • 关于
  • 帮助
  • contact arXivClick here to contact arXiv 联系
  • 订阅 arXiv 邮件列表点击这里订阅 订阅
  • 版权
  • 隐私政策
  • 网络无障碍帮助
  • arXiv 运营状态
    通过...获取状态通知 email 或者 slack

京ICP备2025123034号