arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.13864cs.CRcs.AI
收藏

HardSecBench: 对大型语言模型在硬件代码生成中的安全意识的基准测试

HardSecBench: Benchmarking the Security Awareness of LLMs for Hardware Code Generation

University of Science and Technology of China(中国科学技术大学);Xi’an Jiaotong University(西安交通大学);Nanjing University(南京大学);ZTE Corporation(中兴通讯)

Qirui Chen, Jingxian Shuai, Shuangwu Chen, Shenghao Ye, Zijian Wen, Xufei Su, Jie Jin, Jiangming Li, Jun Chen, Xiaobin Tan, Jian Yang

AI总结:

提出HardSecBench基准,包含924个任务覆盖Verilog RTL和固件C代码,评估LLM在硬件代码生成中的安全性,发现模型常满足功能需求但存在安全风险。

摘要:

大型语言模型(LLM)越来越多地用于硬件和固件代码生成,但现有研究主要评估功能正确性,而很大程度上忽略了安全性。然而,看似功能正常的LLM生成代码可能嵌入安全缺陷,在部署后可能引发灾难性损害。这一关键研究空白促使我们设计一个基准,用于在现实规范下评估安全意识。在这项工作中,我们介绍了HardSecBench,一个包含924个任务的基准,涵盖Verilog寄存器传输级(RTL)和固件级C,覆盖76个与硬件相关的通用弱点枚举(CWE)条目。每个任务包括结构化规范、安全参考实现和可执行测试。为了自动化工件合成,我们提出了一种多智能体流水线,将合成与验证解耦,并将评估基于执行证据,从而实现可靠的评估。我们评估了多种LLM,发现它们通常满足功能需求,但留下安全风险。我们还发现安全结果随提示变化。这些发现突显了紧迫的挑战,并为LLM辅助硬件设计的未来进展提供了可操作的见解。我们的数据和代码可在此https URL获取。

英文摘要:

Large language models (LLMs) are increasingly used for hardware and firmware code generation, but existing studies primarily evaluate functional correctness while largely overlooking security. However, LLM-generated code that appears functionally sound may embed security flaws which could induce catastrophic damages after deployment. This critical research gap motivates us to design a benchmark for assessing security awareness under realistic specifications. In this work, we introduce HardSecBench, a benchmark with 924 tasks spanning Verilog Register Transfer Level (RTL) and firmware-level C, covering 76 hardware-relevant Common Weakness Enumeration (CWE) entries. Each task includes a structured specification, a secure reference implementation, and executable tests. To automate artifact synthesis, we propose a multi-agent pipeline that decouples synthesis from verification and grounds evaluation in execution evidence, enabling reliable evaluation. We evaluate diverse LLMs and find that they often satisfy functional requirements while leaving security risks. We also find that security results vary with prompting. These findings highlight pressing challenges and offer actionable insights for future advancements in LLM-assisted hardware design. Our data and code are available at https://github.com/chenqirui2002/HardSecBench.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑