arXiv:2608.26588cs.CRAug 2026

Manuscript Offprint

arXiv:2608.26588

Unsaid, Unsafe? Implicit Security Obligations in LLM-Based RTL Code Generation

Guang Yang, Xing Hu, Xiang Chen, Xin Xia

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Guang Yang, Xing Hu ∗^{*}, Xiang Chen, and Xin Xia

Abstract—Large Language Models (LLMs) generate register-transfer-level (RTL) code with rapidly improving functional correctness. Security of LLM-generated code, however, has been studied mainly for software, where flaws can still be patched after deployment. Insecure RTL offers no such remedy once taped out into silicon. We construct SECRTL-GEN, a multi-language resource-access security benchmark grounded in real SoC IP: 392 tasks over five CWE families and four HDLs (Verilog, SystemVerilog, VHDL, and Python), each with black-box functional and security testbenches. Functional specifications intentionally omit security obligations, matching how obligations are often kept out of functional docs in practice. An empirical study of five frontier LLMs shows a sharp gap: under vanilla prompts they pass functional tests in about 73–79% of cases but security tests in only 14–35%, and stronger functional models are not safer. Adding CWE knowledge raises security, while unaided self-thinking helps less and both security-oriented prompts cut functional pass rates, showing that the bottleneck is missing weakness awareness in the specification, not an inability to write defensive RTL. We present RTL-Obliger, a neuro-symbolic framework that infers these implicit obligations. An LLM extracts a functional-semantic graph from the specification; a symbolic engine then matches it against a CWE pattern ontology to surface mitigation-evidence gaps and signal-level obligations; the LLM finally revises RTL under those obligations in a functionality-preserving two-stage generation. Across five models and four languages, RTL-Obliger raises mean all-pass from 49.6–51.4% (SecV/RESCUE) to 61.6%, with higher security and functional rates than these secure-generation baselines.

Index Terms—Large Language Models, RTL Code Generation, Hardware Security

1 INTRODUCTION

LARGE language models (LLMs) are increasingly used to generate register-transfer-level (RTL) code [1], [2], [3]. Functional pass rates keep rising, but security has received far less attention. This gap matters more for hardware than for software. Software vulnerabilities can often be patched after deployment. Insecure RTL is baked into silicon after tape-out and cannot be fixed in the field.

The security of LLM-generated software is already a known concern [4], [5]. Hardware raises a sharper question: given only a functional specification, does the model also enforce the defenses a safe design needs? In practice, that specification states what the module should do, while many required defenses live in separate security configurations, threat models, or review checklists. We call these implicit security obligations: constraints still required of a safe implementation, yet not entailed by the written functional specification (§2.3). Human designers can recover them from those external sources; but the LLM sees only the functional text, so the obligations never enter its input. OpenTitan illustrates the pattern: countermeasures appear in machine-readable configuration files, not in the functional IP description [6], [7]. Standard benchmark-style prompts go further: they typically contain no security-obligation content at all.

Existing work does not close this gap. RTL generation benchmarks mainly score functional simulation [2], [3], [8]. Recent security benchmarks and audits show that LLM-written RTL can pass functional checks and still fail security tests [9], [10], but they do not focus on real SoC IP under multi-HDL, obligation-omitted prompts. Secure-generation methods such as SecV [11] and RESCUE [12] inject CWE knowledge through graph exploration or retrieval. They still rely on the LLM to turn coarse guidance into design-specific constraints, which is exactly where our controlled study finds the bottleneck (§3).

This paper asks two linked questions. First, how large is the functional–security gap when LLMs generate RTL from security-incomplete specifications? Second, can we infer the missing obligations and use them to generate secure RTL without breaking functionality? We scope both questions to resource-access weaknesses that are port-observable under black-box simulation, matching the families covered by SECRTL-GEN.

We build SECRTL-GEN (§3.1) to measure the gap. Empirically, many implicit obligations appear as mitigation-evidence gaps: the specification shows weakness preconditions (for example, a reusable secret register is written) but not the required mitigation. If the specification is lifted into a checkable evidence model, and complete mitigation patterns are stored in a reusable ontology, obligation inference becomes a deterministic signal-level check rather than open-ended guessing. We therefore present RTL-Obliger (§4): an LLM extracts a functional-semantic graph; a symbolic engine matches it against a CWE pattern ontology to emit signal-level obligations; and the LLM revises RTL in two stages, first a functional draft and then local obligation-

G. Yang is with the State Key Laboratory of Blockchain and Data Security, Zhejiang University, Hangzhou, China, and also with the Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security, Hangzhou, China.

X. Hu and X. Xia are with the State Key Laboratory of Blockchain and Data Security, Zhejiang University, Hangzhou, China.

X. Chen is with the School of Artificial Intelligence and Computer Science, Nantong University, Nantong, China.

Corresponding author: Xing Hu (e-mail: xinghu@zju.edu.cn). Other e-mails: novelvq@outlook.com, xin.xia@acm.org, xchen@ntu.edu.cn. Manuscript received XXX XX, 2026; revised XXX XX, 2026.

guided edits. On SECRTL-GEN, five frontier LLMs under vanilla prompts pass functional tests in 73–79% of cases but security tests in only 14–35%; RTL-Obliger raises mean all-pass from 49.6–51.4% (SecV/RESCUE) to 61.6%.

In summary, we make four contributions:

• SECRTL-GEN: a 392-task, four-HDL security benchmark from real SoC IP, with black-box functional and security tests under obligation-omitted specifications (§3.1).

• Empirical study: five LLMs reach 73–79% functional pass but only 14–35% security pass; CWE knowledge helps more than self-thinking, and security prompting lowers functional pass (§3).

• RTL-Obliger: a neuro-symbolic method that infers signal-level obligations from a functional-semantic graph and a CWE ontology, then applies them in two-stage RTL generation (§4).

• Evaluation: RTL-Obliger raises mean all-pass from 49.6–51.4% (SecV/RESCUE) to 61.6%; symbolic inference is the main gain, and residual failures center on obligation-guided generation and matching recall (§5.1–§5.3).

To facilitate the replication of RTL-Obliger, we make our datasets and source code publicly available on GitHub. 1^{1}

Paper structure. Section 2 reviews LLM-based RTL generation, hardware security weaknesses, and implicit security obligations. Section 3 presents SECRTL-GEN and the empirical study of the functional-security gap. Section 4 introduces the RTL-Obliger framework. Section 5 reports evaluation results. Section 6 discusses implications and threats to validity, Section 7 reviews related work, and Section 8 concludes.

References (32)