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

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Chen, Qirui, Shuai, Jingxian, Chen, Shuangwu, Ye, Shenghao, Wen, Zijian, Su, Xufei, Jin, Jie, Li, Jiangming, Chen, Jun, Tan, Xiaobin, Yang, Jian
Natura: Preprint
Pubblicazione: 2026
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866909995701895168
author Chen, Qirui
Shuai, Jingxian
Chen, Shuangwu
Ye, Shenghao
Wen, Zijian
Su, Xufei
Jin, Jie
Li, Jiangming
Chen, Jun
Tan, Xiaobin
Yang, Jian
author_facet Chen, Qirui
Shuai, Jingxian
Chen, Shuangwu
Ye, Shenghao
Wen, Zijian
Su, Xufei
Jin, Jie
Li, Jiangming
Chen, Jun
Tan, Xiaobin
Yang, Jian
contents Large language models (LLMs) are being increasingly integrated into practical hardware and firmware development pipelines for code generation. Existing studies have primarily focused on evaluating the functional correctness of LLM-generated code, yet paid limited attention to its security issues. 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. Using HardSecBench, we evaluate a range of LLMs on hardware and firmware code generation and find that models often satisfy functional requirements while still 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 will be released soon.
format Preprint
id arxiv_https___arxiv_org_abs_2601_13864
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle HardSecBench: Benchmarking the Security Awareness of LLMs for Hardware Code Generation
Chen, Qirui
Shuai, Jingxian
Chen, Shuangwu
Ye, Shenghao
Wen, Zijian
Su, Xufei
Jin, Jie
Li, Jiangming
Chen, Jun
Tan, Xiaobin
Yang, Jian
Cryptography and Security
Artificial Intelligence
Large language models (LLMs) are being increasingly integrated into practical hardware and firmware development pipelines for code generation. Existing studies have primarily focused on evaluating the functional correctness of LLM-generated code, yet paid limited attention to its security issues. 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. Using HardSecBench, we evaluate a range of LLMs on hardware and firmware code generation and find that models often satisfy functional requirements while still 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 will be released soon.
title HardSecBench: Benchmarking the Security Awareness of LLMs for Hardware Code Generation
topic Cryptography and Security
Artificial Intelligence
url https://arxiv.org/abs/2601.13864