Last Secure Code Benchmark: is vibe coding secure?Last Secure Code Benchmark: Is the Code You Vibe Secure?
Quick read
Evaluation and benchmarksBased on the paper PDF (generated by Gemini); refer to the original
Evaluating 6 agents on 450 tasks, the authors report functional pass rates of 73.6%–91.3%, but combined functional and security pass rates of only 16.4%–25.1%.
- AI coding agents are widely used in software development, but users often focus only on whether functionality is implemented, ignoring code security. Existing security evaluation benchmarks have shortcomings in code generation scope, language coverage, or vulnerability types, and lack a benchmark that comprehensively evaluates the security of code generated by agents in everyday coding scenarios without security prompts.
- The authors built LSCBench, containing 150 real vulnerability scenarios and 450 tasks in total, covering 7 languages and 24 CWE categories. Each scenario is derived into three granularities—function, file, and repository—and the task requirements only describe functionality without including security hints. Evaluation determines code security and functional performance by executing rewritten PoC attack tests and independent functional tests.
- Evaluation of 6 frontier agents shows functional pass rates of 73.6% to 91.3%, but the proportion combining functionality and security is only 16.4% to 25.1%, and the highest proportion of scenarios passing all granularities is only 12.0%. Vulnerabilities involving implicit policies are rarely fixed, and appending security prompts yields improvements of 1.1 to 21.5 percentage points.
- The paper does not have a dedicated section discussing limitations. The experiments cover 6 frontier agents, 7 programming languages, 24 CWE categories, and 450 multi-granularity code generation tasks; all tasks are single attempts (pass@1) with no network and no human interaction, and the paper does not report performance across multiple repeated samples.
- Evaluated models
- Claude Fable 5GPT-5.6-SolGLM-5.3Qwen3.8-MaxDeepSeek-V4-ProKimi-K3
- Benchmarks
- LSCBench
- Metrics
- FUNCPASSSECPASSFUNC∧SECS | FCommon-F
Researchers from the National University of Singapore and Alibaba's Qwen Team released LSCBench, a secure code generation benchmark for coding agents, constructing 450 tasks from 150 real vulnerability scenarios to evaluate whether code written by six frontier agents meets both functionality and security; the paper is at https://huggingface.co/papers/2610.14766。基准覆盖. It covers seven languages—Java, C, C++, JavaScript, Python, PHP, and Go—and 24 CWE categories, including 21 from the 2025 CWE Top 25. Each scenario is divided into three granularities: filling in a function, writing a file, and rebuilding the source tree from scratch; task specifications describe only functionality without hinting at security, and outcomes are judged by hidden functional tests and security tests together. The paper states that after adding a one-sentence security reminder, most models' rates of passing both test types simultaneously improved by 15 to 21 percentage points, but vulnerabilities such as information exposure and SSRF, which depend on policies not specified in the specification, remained rarely prevented.
Why it was selectedOn this benchmark, the functional pass rate of six frontier coding agents is generally about 90%, and the highest that balances functionality and safety is only 25.1%.
Paper analysis
What problem does this paper attempt to solve?
Evaluate whether AI coding agents, in everyday coding scenarios without security hints, can autonomously avoid introducing real security vulnerabilities while generating usable code.
The core problem this paper attempts to solve is: in everyday programming (vibe coding) scenarios where users only give functional requirements and do not mention security, whether the code generated by AI coding agents is secure while being functionally correct.
- Scenario and importance: The authors point out that AI coding agents are writing a large amount of software that is actually delivered, but users usually only check whether the functionality works and rarely review the underlying code; the agent's security decisions regarding handling untrusted input, protecting sensitive data, and access control are made implicitly, which may introduce unnoticed security vulnerabilities.
- Shortcomings of existing evaluations: The authors state that existing code security generation benchmarks lack at least one of three dimensions: the scope of generated code (from function to repository), the variety of programming languages covered, or the vulnerability categories addressed; in addition, some existing benchmarks' test suites rely on source text matching rather than runtime behavior determination.
- Core observation and hypothesis: The authors believe that functional checks alone cannot detect security flaws; in everyday coding workflows, developers only state what the software should do, and the agent must autonomously identify and handle potential security risks without any security hints.
- The paper's solution: The authors propose LSCBench (Last Secure Code Benchmark), an end-to-end executable benchmark containing 150 real vulnerability scenarios spanning three code generation granularities—function, file, and repository (450 tasks in total)—accompanied by a cheat-free task construction process (construction cookbook).
What related research exists?
Reviewed code functionality benchmarks, snippet- and repository-level secure generation benchmarks, and offensive benchmarks, noting that existing work is limited in language, granularity, or critical CWE coverage.
Code functionality benchmarks and coding agents
- HumanEval, MBPP, and APPS (Chen et al., 2021; Austin et al., 2021; Hendrycks et al., 2021) — evaluate functional correctness of function-level code generation. SWE-bench and NL2Repo-Bench (Jimenez et al., 2023; Ding et al., 2025) — evaluate repository-level code generation. The authors note that these benchmarks do not check whether code is secure, and early work (Pearce et al., 2021) found that about 40% of security-related completions contain vulnerabilities.
Secure code generation benchmarks
- Snippet-level security benchmarks (Siddiq & Santos, 2022; Hajipour et al., 2023; Siddiq & Santos, 2023; Peng et al., 2025; Yang et al., 2024) — including SecurityEval, CodeLMSec, SALLM, CWEval, SecCodePLT, CODEGUARD+, and SafeGenBench, evaluate the security of individual code snippets using prompts that specify known weakness types.
- Repository-level security benchmarks (Vero et al., 2025; Lian et al., 2025; Dilgren et al., 2025; Zhao et al., 2025) — BaxBench builds backend applications evaluated by expert exploit assessment, A.S.E provides project contexts with recorded CVEs, and SecureAgentBench and SUSVIBES convert vulnerability-fix commits into agent tasks. The authors note that manual review does not scale, LLM judges can be deceived, and static analyzers match patterns rather than behavior.
Offensive benchmarks and security training methods
- CyberGym and ExploitGym (Wang et al., 2025; 2026) — test agents' ability to reproduce vulnerabilities or write exploits. The authors note that whether agents can write secure code has received less attention than offensive evaluation.
- Security training methods (He & Vechev, 2023; He et al., 2024; Xu et al., 2024; Liu et al., 2025; Wu et al., 2026; Yang et al., 2026) — covering methods from fine-tuning on curated submissions to reinforcement learning with security rewards.
Comparison baselines and benchmarks
- The paper directly compares existing secure code generation benchmarks including CWEval, SALLM, SecCodePLT, Asleep, BaxBench, A.S.E, SecureAgentBench, and SUSVIBES in Table 1.
Differences from existing work
- The authors state that LSCBench differs from the above work in that it evaluates agents on real projects in 7 languages, covers more critical CWE categories (including 21 from the 2025 CWE Top 25 and 8 from the Top 10 KEV weaknesses), spans all daily coding granularities of function, file, and repository, and determines security through dynamic testing by running the programs.
How does the paper address this problem?
Through real vulnerability extraction and test rewriting, three types of code granularities are split and the environment is cleaned, neutral specifications are generated via patch-free drafting and expert double review, and evaluation is conducted in an independent container.
LSCBench builds 450 multi-granularity code generation tasks from 150 real vulnerability scenarios. By providing neutral functional specifications and hiding the test suites, rewritten PoC dynamic attacks and functional tests are run by an independent verifier in an isolated sandbox.
Scenario sources and difficulty filtering
- Scenario sources: Reproducible CVE environments are obtained from CVE-Factory (covering Python, JavaScript, Go, PHP, C, C++); for Java, where CVE-Factory accounts for less than 5%, 5 security experts with at least 3 years of industry experience manually built 100 Java application scenarios from enterprise codebases.
- Difficulty ranking: Scenarios whose CWE belongs to the MITRE CWE Top 25 and that can be split into three granularities are retained, and a difficulty score is computed by the formula:
D(c) = 1/3 [pctP(files(c)) + pctP(lines(c)) + pctP(repo(c))] This formula combines the mean percentile rank in the candidate pool of the number of files involved in the fix, the number of modified lines, and the number of lines in the repository code. The authors selected the most difficult scenarios covering various CWE categories by language (226 in total).
- Test suite rewriting: The experts believed that upstream tests mostly check source text (e.g., adding a specific comment can bypass them), so they used Qwen3.8-Max to rewrite the test suites from scratch, ensuring that PoC attacks are injected through the externally exposed surface of the program. After rewriting, a four-state check is passed (vulnerable code passes functional tests and fails security tests; fixed code passes both), and finally 315 scenarios (226 CVE and 89 Java scenarios) proceed to the next stage.
Three code granularity splits and environment cleanup
- Granularity splits: Function granularity extends the patch scope to the smallest complete callable object containing the modification and replaces it with the
<MASKED>placeholder; file granularity completely removes the target files touched by the patch; repository granularity removes all source code for repositories smaller than 8,000 lines of code, while for large projects it removes files in the same subtree as the patch until reaching the budget cap of 8,000 lines of code and 50 files. - Environment cleanup: Precompiled artifacts, installed Python modules, package manager caches (pip, npm, Maven, Go caches), and Git history are cleared, and container images are flattened to prevent agents from reading historical clues.
- Granularity gating: The reference solution is verified to pass both tests, while the vulnerable code with annotated patches (narrated candidate) must fail the security tests. 267 scenarios retain all three granularities.
Specification drafting, double-blind review, and gating mechanisms
- Neutral specification drafting: Qwen3.8-Max, which has not seen the reference patches, generates interface summaries and functional specifications for each granularity in an isolated container, written in the order "repository → file → region" from broad to narrow, with copying of test case inputs and outputs prohibited, and no security-biased hints included.
- Double-blind review: A second agent that has seen the patches checks and rewrites clauses that lead to vulnerable implementations or leak the patches; then 5 security experts review interface completeness and neutrality item by item according to rules, with independent double review of 30 tasks achieving over 93% consistency.
- Control gating and final selection: An Oracle agent with the patch applied (must score full marks) and an Empty agent making no modifications (must score zero) are tested on 762 tasks under the Harbor framework. 247 scenarios pass the gating, and the experts finally select 150 scenarios (115 CVE and 35 Java scenarios) while balancing languages and covering the 2025 CWE Top 25 and Top 10 KEV, for a total of 450 tasks.
Independent verifier and evaluation metric definitions
- Evaluation process: The agent executes in a sandbox with no network, no human interaction, and a cap of 500 rounds; after completion, only files in the editable scope are copied to an independent verifier container built from the same image, where the build script is executed and the hidden functional and security test suites are run.
- Core metric: The joint pass rate is defined as:
FUNC∧ SECm(T) = 1/(|T|) ∑(s,g) ∈ T 1{Fm,s,g = 1 ∧ Sm,s,g = 1} That is, the proportion of tasks that pass both functional and security tests in a single attempt (pass@1), supplemented by the pure functional pass rate FUNCPASS and the pure security pass rate SECPASS, as well as a scenario-level metric where all three granularities pass.
What experiments did the paper conduct?
Model functional pass rates are 73.6%–91.3%, but FUNC∧SEC is only 16.4%–25.1%, and implicit policy flaws are rarely fixed.
Experimental Setup
- Models under test: Evaluated 6 frontier agent models: Claude Fable 5, GPT-5.6-Sol, GLM-5.3, Qwen3.8-Max, DeepSeek-V4-Pro, Kimi-K3. Among them, Claude Fable 5, GLM-5.3, Qwen3.8-Max, DeepSeek-V4-Pro, and Kimi-K3 run on Claude Code (v2.1.143), and GPT-5.6-Sol runs on the native scaffold Codex (v0.154.0). All models use their highest reasoning level (Qwen3.8-Max uses xhigh, the other five use max).
- Dataset and scale: LSCBench, containing 150 real vulnerability scenarios (115 public CVEs and 35 expert-built Java scenarios), covering 7 languages (Java 35, C 23, Python 22, JavaScript 22, PHP 22, Go 20, C++ 6) and 24 CWE classes, with each scenario deriving 3 granularity tasks, totaling 450 tasks.
- Baselines and scaffolds: Used each framework's default system prompts and tool sets, disabled interactive tools (no human intervention), and blocked network access; Qwen3.8-Max also served as the task-building model.
- Metric definitions: FUNCPASS (functional pass rate), SECPASS (security pass rate), FUNC∧SEC (joint pass rate, i.e., the pass@1 proportion where both functional and security tests pass), S | F (proportion of functionally passed tasks where security tests also pass), Common-F (FUNC∧SEC on the 271 tasks where all 6 models pass functional tests). Also report scenario-level metrics where all granularities pass.
- Evaluation method: No LLM judges; instead, deterministic test suites are run in isolated validator containers. The 150 scenarios average 11.2 functional test cases each (median 11, max 33) and 6.8 security test cases (median 5, max 43).
- Sample size and repetitions: Each task uses a single pass@1 attempt, each model is evaluated on 450 tasks (totaling 2,700 attempts), with an interaction step limit of 500 turns.
Main Results
According to Table 10 (main results on all 450 tasks and 150 scenarios, in %):
Swipe horizontally to read the table
Model Task-level FUNCPASS Task-level SECPASS Task-level FUNC∧SEC Task-level S | F Scenario-level FUNCPASS Scenario-level SECPASS Scenario-level FUNC∧SEC Claude Fable 5 91.1 25.3 25.1 27.6 82.7 12.0 12.0 GPT-5.6-Sol 89.1 25.8 24.7 27.7 78.0 9.3 8.0 Qwen3.8-Max 89.3 24.0 22.0 24.6 76.0 9.3 8.0 GLM-5.3 87.1 23.8 21.3 24.5 72.0 8.7 7.3 DeepSeek-V4-Pro 73.6 19.3 18.0 24.5 50.0 6.7 6.7 Kimi-K3 91.3 18.2 16.4 18.0 80.0 4.0 2.0 - Functionally complete but low security pass rates: The authors state that, except for DeepSeek-V4-Pro, the other 5 models achieve functional pass on about 90% of tasks, but the best-performing Claude Fable 5 only reaches 25.1% on task-level FUNC∧SEC, with the others ranging from 16.4% to 24.7%; the gap indicates that agents generate code that runs normally but contains vulnerabilities.
- Low cross-granularity security consistency: Under the strict scenario-level requirement (all 3 granularity tasks in the same scenario must satisfy FUNC∧SEC), the best-performing Claude Fable 5 only reaches 12.0%, while Kimi-K3 is only 2.0%; the authors note that a model fixing a vulnerability at one granularity does not mean it fully understands the vulnerability.
- Complementary security solution subsets across models: The authors report that aggregating the 6 models, tasks fixed by at least one model reach 198 (44.0%), but tasks passed by all 6 models are only 19; also, 252 tasks (56.0%) and 57 scenarios are not securely solved by any model at any granularity.
Impact of Code Generation Granularity and Interaction Turns
- What was tested: Compared pass rate changes across Function, File, and Repo granularities for each model (Figure 5, Table 12), and analyzed the relationship between task interaction turns and FUNC∧SEC (Figure 6).
- Experimental results: As code scope expands from Function to Repo, all models' functional pass rates decline (Claude Fable 5 from 93.3% to 88.7%, DeepSeek-V4-Pro from 84.0% to 61.3%), but FUNC∧SEC stays flat or rises (Claude Fable 5 from 22.0% to 26.7%, GPT-5.6-Sol from 20.0% to 30.7%) (Table 12); Claude Fable 5, with the fewest interaction turns, achieves the highest FUNC∧SEC, while Qwen3.8-Max, GLM-5.3, and Kimi-K3 consume about twice the turns but have lower security rates (Figure 6).
- Authors' interpretation: The authors believe that when building an entire module, agents have the freedom to design data flows and check mechanisms autonomously, whereas when filling gaps in existing code, they are susceptible to surrounding structure inducing them to reproduce the original vulnerable code; additionally, security is an inherent choice when writing code, not an extra effect from subsequent multi-turn verification.
Security Differences by Vulnerability Type and Programming Language
- What was tested: Grouped the 24 CWE classes into 8 defense action families, and evaluated FUNC∧SEC performance across each family and 7 languages (Figure 8, Table 11).
- Experimental results: Memory safety has the highest resolution rate, with aggregate FUNC∧SEC at 34.3% (Use after free at 61.1%); path and file handling at 24.3%, injection classes at 23.9% (command injection at 34.7%, code injection only 4.9%); categories involving implicit policies are extremely low, SSRF only 2.4%, information exposure only 0.7% (Table 11). By language, C (30.0%), Python (29.8%), and JavaScript (27.3%) are highest, PHP (10.4%) lowest (Figure 8).
- Authors' interpretation: The authors state that models handle local explicit checks easily (such as boundary checks or escaping parameters), but for global implicit policies not stated in the specification (such as which paths to reject, which return fields to filter), models cannot perceive deployment environment requirements; language differences mainly stem from differences in the CWE composition bound to each language.
Security Prompt Ablation Experiment
- What was tested: Appended a single explicit security reminder sentence to the end of task specifications (requiring both functionality and security with no vulnerabilities), and re-tested GPT-5.6-Sol, Qwen3.8-Max, GLM-5.3, and DeepSeek-V4-Pro on all 450 tasks (Table 3).
- Experimental results: After appending the prompt, GPT-5.6-Sol's FUNC∧SEC increased by 21.5 percentage points from 24.7% to 46.2% (FUNCPASS dropped 1.5 percentage points to 87.6%); Qwen3.8-Max increased by 15.6 percentage points to 37.6%; GLM-5.3 increased by 16.9 percentage points to 38.2%; DeepSeek-V4-Pro only slightly increased by 1.1 percentage points to 19.1% (Table 3).
- Authors' interpretation: The authors note that a single reminder improves the security rates of the first three models, but even with the reminder, most tasks remain unsafely fixed (deserialization and memory safety reach about 50%, but SSRF and information exposure remain at the bottom), which the authors believe indicates that current models still lack intrinsic secure coding knowledge.
Other Ablations and Analyses
- Fixed functional solution intersection (52 scenarios): Claude Fable 5's FUNC∧SEC at Function/File/Repo is 26.9%, 28.8%, 30.8%, respectively; GPT-5.6-Sol is 23.1%, 28.8%, 42.3% (Table 13).
- Each model's own functional solution subset (|Cm| ranges from 75 to 124 scenarios): GPT-5.6-Sol reaches 33.3% at Repo granularity, Claude Fable 5 reaches 31.5% (Table 13).
- Overlap distribution of model success solutions: across all tasks, 252 tasks are not securely solved by any model, 62 are solved by only 1 model, and 19 are solved by all 6 models (Table 15).
- Scenario-level coverage distribution: Claude Fable 5 solves 0 granularities in 93 scenarios, 1 granularity in 19, 2 granularities in 20, and all 3 granularities in 18 (Table 16).
- Output quadrant statistics: Claude Fable 5 has 113 occurrences of (1,1), 297 of (1,0), 39 of (0,0), and 1 of (0,1); DeepSeek-V4-Pro has 112 occurrences of (0,0) (Table 14).
Failure Case Analysis
- Expert audit of 120 failure trajectories (20 per model) reveals distinct failure modes: Kimi-K3 treats the functional contract as exhaustive requirements, and after self-testing finds anomalies, instead believes "tests are too strict" and abandons fixing (e.g., using default constructors in YAML deserialization); GPT-5.6-Sol tends to reproduce upstream code, retaining vulnerabilities along with it; DeepSeek-V4-Pro misjudges sandbox network unavailability as an environment issue rather than a code error, abandoning local builds and directly submitting uncompiled code (e.g., calling a nonexistent nextEntry()); Claude Fable 5 exhibits literal reproduction of upstream code and triggers content safety refusals; GLM-5.3 tends to take default allow shortcuts under complex logic; Qwen3.8-Max is prone to execution-time failures such as deadlocks and regex backtracking.
What are some points that can be further explored?
The paper does not specifically discuss limitations; the experiments cover single-attempt performance of 6 frontier models on 7 languages, 24 CWE categories, and 450 multi-granularity tasks.
Limitations and future directions noted by the authors
The paper does not specifically discuss limitations. The authors did not set up a separate Limitations or Future Work section in the main text or appendix.
Experimental coverage
- Models under test: Covers 6 frontier agent models—Claude Fable 5, GPT-5.6-Sol, GLM-5.3, Qwen3.8-Max, DeepSeek-V4-Pro, and Kimi-K3—of which 5 run on Claude Code (v2.1.143) and 1 on Codex (v0.154.0) (Section 4).
- Benchmark scenarios and language coverage: Includes 150 real vulnerability scenarios (115 CVE and 35 expert-built scenarios), covering 7 languages—Java (35), C (23), Python (22), JavaScript (22), PHP (22), Go (20), and C++ (6)—divided into 3 granularities—function, file, and repository—for a total of 450 tasks (Section 3.2, Table 4).
- Vulnerability classification coverage: Covers 24 CWE categories, including 21 of the 2025 MITRE CWE Top 25 and 8 of the 2025 CWE Top 10 KEV Weaknesses (Section 3.2, Table 6).
- Testing and interaction budget: Each task is a single pass@1 attempt with a step cap of 500 rounds; the evaluation environment has network access disabled and no human interaction; the paper does not report variance across multiple repeated samples (Section 4).
- Security reminder ablation scope: The security reminder ablation experiment tests 4 models—GPT-5.6-Sol, Qwen3.8-Max, GLM-5.3, and DeepSeek-V4-Pro—on all 450 tasks, and does not include Claude Fable 5 and Kimi-K3 (Section 5.5, Table 3).
Summarize the main content of the paper
The authors report agent functional pass rates of 73.6%–91.3%, but FUNC∧SEC is only 16.4%–25.1%, with most generated code containing vulnerabilities.
- Positioning: LSCBench is a multi-granularity secure code generation evaluation benchmark and construction guide for AI coding agents, built on real vulnerabilities.
- Problem addressed: In everyday coding (vibe coding) scenarios where users provide only functional specifications without security prompts, evaluate whether mainstream agents' generated code can autonomously defend against security vulnerabilities while ensuring functionality.
- Core method design: Extract 150 vulnerability scenarios from real CVEs and enterprise cases, build 450 independent tasks at function, file, and repository granularities; draft neutral functional specifications from a patch-free perspective with multiple rounds of expert review, and dynamically run rewritten black-box PoC attacks and functional tests in isolated validation sandboxes.
- Main experimental results:
- Functional pass rates of 6 frontier models range from 73.6% to 91.3%, but task-level FUNC∧SEC is only between 16.4% and 25.1% (highest is Claude Fable 5 at 25.1%), and the highest cross-granularity all-pass rate is only 12.0% (Table 10).
- Expanding code generation scope reduces functional pass rates, but FUNC∧SEC stays flat or rises, e.g., GPT-5.6-Sol reaches 30.7% at repository granularity (Table 12).
- Memory safety vulnerabilities have the highest resolution rate (aggregate FUNC∧SEC at 34.3%), while SSRF (2.4%) and information exposure (0.7%), which rely on undeclared policies, are rarely resolved (Table 11).
- Appending a single security prompt can increase some models' FUNC∧SEC by 15 to 21 percentage points (e.g., GPT-5.6-Sol reaches 46.2%), but most tasks remain unresolved (Table 3).
- Authors' conclusions and implications: The authors believe that current agents treat security only as a byproduct of writing good code, lacking reasoning about post-deployment threat models; failure modes differ significantly across models, and future work requires end-to-end joint supervision of threat models and execution behavior.