arXiv:2609.10762cs.CRSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.10762

Beyond Static Guarantees: Measuring the Static-Pass Dynamic-Fail Gap in Security-Sensitive and LLM-Generated Python Code

Jessica Pourleyli, Maitreyee Das Urmi, Glaucia Melo

Jessica Pourleyli

Toronto Metropolitan University

Toronto, Canada

jessica.pourleyli@torontomu.ca

Maitreyee Das Urmi

Toronto Metropolitan University

Toronto, Canada

maitreyee.urmi@torontomu.ca

Glaucia Melo

Toronto Metropolitan University

Toronto, Canada

glaucia@torontomu.ca

Abstract—Advances in large language models (LLMs) fuel the quest for scalable methods to assess the security of generated and security-sensitive software. Static analysis is widely adopted as a scalable, reproducible, and inexpensive security gate, but cannot directly observe runtime exploit behaviour. Vulnerabilities dependent on adversarial inputs, execution context, or exploit chaining may evade static checks while remaining exploitable in practice, yet passing static analysis is often treated as evidence of secure behaviour. This paper introduces the Static-Pass Dynamic-Fail (SPDF) phenomenon and a three-stage agentic pipeline combining static scanning, LLM-driven Common Weakness Enumeration (CWE) reasoning, and autonomous exploit verification in isolated Docker containers. We evaluate 1,355 Python samples from SecurityEval, RedCode, and CyberNative datasets. Of the 654 samples producing no findings under the composite Bandit–Semgrep gate, the LLM detection stage identified 394 candidate vulnerabilities across 235 files. Dynamic verification confirmed or partially confirmed exploitability in 95 files, yielding an inclusive pipeline rate of 14.53% (roughly 1 in 7 statically clean samples). This rate represents the proportion of Bandit–Semgrep-clean samples for which the pipeline identified a candidate vulnerability and obtained runtime evidence supporting exploitability. Outcomes varied by dataset: among candidate file–CWE pairs, confirmed exploitability was 33.7% for RedCode, 28.6% for CyberNative, and 5.4% for SecurityEval. Several frequently confirmed classes, including CWE-338 and CWE-916, were flagged by neither Bandit nor Semgrep. These findings indicate that static-analysis success and runtime security are hierarchical layers of software assurance rather than interchangeable measures, and have the potential to reshape how AI-generated and security-sensitive code is evaluated.

Index Terms—software security, static analysis, dynamic analysis, exploit verification, agentic security evaluation, large language models

I. INTRODUCTION

The growing adoption of Large Language Models (LLMs) in software engineering has raised important questions regarding the security and trustworthiness of AI-generated code [1]. Modern coding assistants can generate functional programs, reason about implementation details, and autonomously interact with development tools [2], [3], yet vulnerabilities in generated code remain a persistent concern [4], [5]. As a result, a growing body of work has proposed security-focused benchmarks and evaluation frameworks, including SecurityEval, AutoSafeCoder, RedCode, and VulnRepairEval, to assess the security of generated software [6]–[9].

Despite these advances, security evaluation pipelines continue to rely heavily on static-analysis tools such as Bandit and CodeQL [6], [7]. Static analysis is scalable, reproducible, and inexpensive, but it reasons about code without executing it and therefore cannot directly observe runtime exploit behaviour [10]. Vulnerabilities that depend on adversarial inputs, execution context, or exploit chaining may therefore evade static analysis while remaining exploitable in practice. This limitation is particularly relevant in modern agentic workflows, where successful static checks are often treated as evidence of secure behaviour.

In this paper, we investigate what we term the Static-Pass Dynamic-Fail (SPDF) phenomenon: vulnerabilities that produce no findings under the evaluated composite Bandit-Semgrep static analysis gate but are subsequently demonstrated through runtime exploit verification. More broadly, we view software-security evaluation as a hierarchy of evidence. Static analysis, vulnerability reasoning, and dynamic verification provide progressively stronger evidence about software security, but success at one level does not guarantee success at the next.

To study this problem, we design a three-stage agentic security pipeline combining static scanning, LLM-driven CWE reasoning, and autonomous exploit generation within isolated Docker environments. The pipeline first filters programs using Bandit [11] and Semgrep [12]. Surviving statically clean samples are then analyzed by a CWE Vulnerability Detection Agent that retrieves and reasons over authoritative vulnerability knowledge. Finally, a Dynamic Exploit Verification Agent selectively evaluates candidate vulnerabilities through generated exploit harnesses executed in sandboxed Docker environments, providing higher-confidence exploitability assessments while avoiding the cost of exhaustive dynamic testing.

To evaluate the prevalence of SPDF behaviour, we analyze 1,355 Python samples drawn from SecurityEval [6], RedCode [8], and the CyberNative Code Vulnerability Security DPO dataset [13]. These datasets contain security-sensitive benchmark programs and LLM-generated code spanning multiple

Jessica Pourleyli and Maitreyee Das Urmi contributed equally and share first authorship.

CWE categories, adversarial coding scenarios, and exploit-oriented tasks. We additionally quantify the practical cost of agentic exploit verification, since computational requirements influence the feasibility of deploying such techniques in real-world security evaluation workflows. The following research questions guide our study:

RQ1: To what extent does code that produces no findings under the evaluated static-analysis gate remain dynamically exploitable under runtime testing? We aim to quantify the observed yield of the SPDF pipeline among samples producing no findings under the evaluated static-analysis gate and examine how often LLM-identified candidates can subsequently be demonstrated as exploitable at runtime.

RQ2: What categories of vulnerabilities are most likely to evade static analysis while remaining exploitable during execution? We aim to identify which CWE categories are most frequently associated with SPDF behaviour and, therefore, most likely to require dynamic verification.

RQ3: What is the cost of the agentic dynamic-exploitability pipeline in terms of latency and token usage?

This question evaluates the practical feasibility of the proposed approach by quantifying its computational cost.

The main contributions of this work are as follows:

  1. We introduce and operationalize the Static-Pass Dynamic-Fail (SPDF) phenomenon and the SPDF Rate (SPDFR), providing an empirical characterization of its prevalence and the vulnerability categories most likely to evade static detection.

  2. An empirical characterization of the computational cost of agentic exploit verification, including token consumption, latency, reasoning iterations, and exploit-generation overhead across 394 candidate vulnerabilities.

  3. A curated collection of SPDF-positive samples identified from existing security-oriented benchmarks, together with evaluation artifacts, exploit evidence, and exploit-verification code used during the verification process to support reproducible research on runtime vulnerability assessment for LLM-generated software.

  4. A reproducible and publicly available multi-stage pipeline combining static analysis, LLM-driven CWE detection, and Docker-based exploit verification [14].

By focusing on the gap between static security guarantees and observed runtime exploitability, this work contributes toward a more execution-aware framework for evaluating the security of AI-generated and security-sensitive software systems. We emphasize that our corpus comprises security-sensitive benchmark code and LLM-generated vulnerable samples, not code produced by a coding assistant operating within an interactive development workflow. Our results, therefore, characterize Static Application Security Testing (SAST) false-negative exposure on such corpora; extending them to assistant-in-the-loop pipelines is a hypothesis our findings motivate but do not establish.