Measuring the Reasoning Boundaries of Large Language Models for Implicit Security Invariants in Code: A Controlled Empirical Study
Abstract
This paper investigates the trust boundary of LLMassisted code security auditing, focusing on implicit security properties (security invariants) that are not expressed as explicit local rules but must hold throughout correct workflows. We propose a six-level semantic taxonomy spanning from explicit defects to workflow/state-machine invariants, and construct an evaluation suite that combines real-world, commit-traced vulnerable code fragments with controlled synthetic samples. We employ two prompting regimes and two context levels to compare auditing capability under natural versus strengthened conditions, and use a layered annotation scheme to characterize hit quality by separating vulnerability identification, localization, and invariant reconstruction. Our results show that richer context and task-focused prompting can partially improve reasoning for some implicit properties; however, when vulnerabilities hinge on missing constraints (absent guards/checks) and multi-step state dependencies required to recover workflow invariants, LLMs exhibit a stable failure regime and tend to produce coherent yet ground-truth-inconsistent alternative vulnerability narratives.