Last Secure Code Benchmark: Is the Code You Vibe Secure?
Organizations: National University of Singapore · Qwen Team, Alibaba Token Hub, Alibaba Group · Cloud Safety and Security, Alibaba Cloud, Alibaba Group
Abstract
AI coding agents now write much of the code that ships, yet whether that code is secure remains unclear. We introduce the Last Secure Code Benchmark, a comprehensive evaluation of secure code generation by coding agents. Built from 150 real vulnerabilities, its 450 tasks span seven widely used languages (Java, C, C++, JavaScript, Python, PHP, and Go), 24 CWEs including 21 of the 2025 CWE Top 25 and 8 of the Top 10 KEV weaknesses, more than any benchmark we compare with, and three vibe-coding scenarios: filling in a function, writing a file, and building a repository's source tree from scratch. Every task asks only for functionality, through a specification that never mentions security, and hidden functional and security tests grade the result. Across six frontier agents, 73.6% to 91.3% of tasks pass functionally, yet even the strongest, Claude Fable 5, produces code that is both functional and secure for only 25.1% of tasks, and the others for 16.4% to 24.7%. The best model only passes 12% of the vulnerability scenarios across all vibe coding setting, posing strong concern on the security of the code written by vibe coding.
Figures & tables
| Benchmark | Tasks | Task context | Multi-file | Avg. Gen. lines | Languages | Top 25 (2025) | KEV 10 (2025) |
|---|---|---|---|---|---|---|---|
| CWEval | 119 | File | 10.0 | C/C++/Go/JS/Py | 10/25 | 5/10 | |
| SALLM | 100 | File | 12.9 | Py | 11/25 | 6/10 | |
| SecCodePLT | 1,345 | Function | 8.1 | Py | 13/25 | 5/10 | |
| Asleep | 71 | File | 19.6 | C/Py | 13/25 | 7/10 | |
| BaxBench | 392 | None | — | Go/JS/PHP/Py/Ruby/Rust | 9/25 | 4/10 | |
| A.S.E | 120 | Repo | 35.8 | PHP/Py/Go/JS/Java | 4/25 | 3/10 |
| Mean | Median | Max | ||
| Context | # Lines | 650K | 70K | 37,060K |
| # Files | 3,812 | 507 | 81,768 | |
| Function tasks | # Lines | 155 | 94 | 1,686 |
| # Files | 1.8 | 1 | 10 | |
| # Regions | 2.8 | 2 | 18 | |
| File tasks | # Lines | 1,782 | 480 | 46,423 |
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Language | Scenarios | Tasks |
|---|---|---|
| Java | 35 | 105 |
| PHP | 22 | 66 |
| Python | 22 | 66 |
| JavaScript | 22 | 66 |
| C | 23 | 69 |
| C++ | 6 | 18 |
| CWE | Weakness | Java | C | C++ | JavaScript | Python | PHP | Go | Total |
| 119 | Memory buffer bounds | – | 1 | 1 | – | – | – | – | 2 |
| 125 | Out-of-bounds read | – | 4 | 1 | – | – | – | 1 | 6 |
| 190 | Integer overflow | – | 3 | 1 | – | – | – | – | 4 |
| 416 | Use after free | – | 3 | – | – | – | – | – | 3 |
| 476 | Null pointer dereference | – | 4 | – | 1 | – | – | 1 | 6 |
| 787 | Out-of-bounds write | – | 2 | 1 | – | – | – | – | 3 |
| Category | Short description | Scenarios |
|---|---|---|
| CWE-20 | Input validation | 15 |
| CWE-22 | Path traversal | 18 |
| CWE-77 | Command injection | 5 |
| CWE-78 | OS command injection | 12 |
| CWE-79 | Cross-site scripting | 6 |
| CWE-89 | SQL injection | 8 |
| Language | Weakness classes, most severe first |
|---|---|
| Java | CWE-89, CWE-22, CWE-79, CWE-918, CWE-400, CWE-502, CWE-917, CWE-94, CWE-78, CWE-1336, CWE-611, CWE-434, CWE-287, CWE-862, CWE-863, CWE-639 |
| JavaScript | CWE-79, CWE-1321, CWE-400, CWE-22, CWE-918, CWE-89, CWE-94, CWE-78, CWE-1336, CWE-287, CWE-862, CWE-863, CWE-639 |
| Python | CWE-22, CWE-78, CWE-89, CWE-918, CWE-79, CWE-400, CWE-502, CWE-94, CWE-1336, CWE-287, CWE-862, CWE-863, CWE-639 |
| Go | CWE-22, CWE-918, CWE-89, CWE-362, CWE-400, CWE-79, CWE-78, CWE-287, CWE-862, CWE-863, CWE-639 |
| PHP | CWE-89, CWE-79, CWE-22, CWE-434, CWE-352, CWE-918, CWE-502, CWE-94, CWE-78, CWE-1336, CWE-287, CWE-862, CWE-863, CWE-639 |
| C and C++ | CWE-119, CWE-787, CWE-125, CWE-416, CWE-190, CWE-476, CWE-362, CWE-400, CWE-22, CWE-78 |
| Benchmark | Security evaluation and selected observations |
|---|---|
| Asleep | CodeQL analysis and manual inspection assess the security of generated software. This combines static analysis with human review. |
| SALLM | Unit tests and CodeQL analysis. An inspected file-deletion test checks an expected error message without asserting that the protected file remains present. Other sampled tests check response status or output uniqueness. |
| CWEval | Dynamic execution with separate functional and security inputs. A JavaScript path-traversal test creates real files, executes the generated program, and checks returned content; an unsafe implementation provides a negative control. |
| SecCodePLT | Dynamic tests and rule assessment. The inspected Python evaluator uses an LLM to assess rules for selected CWEs. The expanded SeCodePLT also includes proof-of-concept (PoC) tests for C/C++ and Java. |
| BaxBench | Attacks against generated HTTP services. The ZIP-conversion tests observe secret disclosure and changes to container files, including overwrite or deletion. |
| SUSVIBES | Security regression tests from vulnerability fixes. An inspected public Django example checks a defensive helper call. The paper also reports human review and test revision to reduce coupling to reference implementations (Appendix B.5). |
| Model | Framework | Reasoning effort |
|---|---|---|
| Claude Fable 5 | Claude Code v2.1.143 | max |
| GPT-5.6-Sol | Codex v0.154.0 | max |
| GLM-5.3 | Claude Code v2.1.143 | max |
| Qwen3.8-Max | Claude Code v2.1.143 | xhigh (its highest level) |
| DeepSeek-V4-Pro | Claude Code v2.1.143 | max |
| Kimi-K3 | Claude Code v2.1.143 | max |
| Task level (450 tasks) | Scenario level (150 scenarios) | |||||||
| Model | FuncPass | SecPass | Func Sec | Common- | FuncPass | SecPass | Func Sec | |
| Claude Fable 5 | 91.1 | 25.3 | 25.1 | 27.6 | 27.7 | 82.7 | 12.0 | 12.0 |
| GPT-5.6-Sol | 89.1 | 25.8 | 24.7 | 27.7 | 27.7 | 78.0 | 9.3 | 8.0 |
| Qwen3.8-Max | 89.3 | 24.0 | 22.0 | 24.6 | 24.7 | 76.0 | 9.3 | 8.0 |
| GLM-5.3 | 87.1 | 23.8 | 21.3 | 24.5 | 25.1 | 72.0 | 8.7 | 7.3 |
| DeepSeek-V4-Pro | 73.6 | 19.3 | 18.0 | 24.5 | 24.7 | 50.0 | 6.7 | 6.7 |
| CWE | Weakness | Scenarios | FuncPass | Func Sec | |
|---|---|---|---|---|---|
| Memory safety | 24 | 77.5 | 34.3 | 44.2 | |
| CWE-119 | Memory buffer bounds | 2 | 88.9 | 13.9 | 15.6 |
| CWE-125 | Out-of-bounds read | 6 | 77.8 | 30.6 | 39.3 |
| CWE-190 | Integer overflow | 4 | 68.1 | 25.0 | 36.7 |
| CWE-416 | Use after free | 3 | 75.9 | 61.1 | 80.5 |
| CWE-476 | Null pointer dereference | 6 | 76.9 | 32.4 | 42.2 |
| Function | File | Repo | ||||
|---|---|---|---|---|---|---|
| Model | FuncPass | Func Sec | FuncPass | Func Sec | FuncPass | Func Sec |
| Claude Fable 5 | 93.3 | 22.0 | 91.3 | 26.7 | 88.7 | 26.7 |
| GPT-5.6-Sol | 94.0 | 20.0 | 88.7 | 23.3 | 84.7 | 30.7 |
| Qwen3.8-Max | 96.7 | 22.7 | 90.7 | 22.0 | 80.7 | 21.3 |
| GLM-5.3 | 94.7 | 24.7 | 88.7 | 17.3 | 78.0 | 22.0 |
| DeepSeek-V4-Pro | 84.0 | 22.7 | 75.3 | 15.3 | 61.3 | 16.0 |
| Model | Function | File | Repo | Function (52) | File (52) | Repo (52) | |
|---|---|---|---|---|---|---|---|
| Claude Fable 5 | 124 | 26.6 | 31.5 | 31.5 | 26.9 | 28.8 | 30.8 |
| GPT-5.6-Sol | 117 | 20.5 | 23.1 | 33.3 | 23.1 | 28.8 | 42.3 |
| Qwen3.8-Max | 114 | 25.4 | 24.6 | 26.3 | 26.9 | 21.2 | 28.8 |
| GLM-5.3 | 108 | 26.9 | 23.1 | 25.9 | 28.8 | 23.1 | 21.2 |
| DeepSeek-V4-Pro | 75 | 24.0 | 21.3 | 26.7 | 26.9 | 19.2 | 25.0 |
| Kimi-K3 | 120 | 15.8 | 11.7 | 20.8 | 19.2 | 11.5 | 26.9 |
| Model | Missing | ||||
|---|---|---|---|---|---|
| Claude Fable 5 | 113 | 297 | 39 | 1 | 0 |
| GPT-5.6-Sol | 111 | 290 | 44 | 5 | 0 |
| Qwen3.8-Max | 99 | 303 | 37 | 9 | 2 |
| GLM-5.3 | 96 | 296 | 45 | 11 | 2 |
| DeepSeek-V4-Pro | 81 | 250 | 112 | 6 | 1 |
| Kimi-K3 | 74 | 337 | 29 | 8 | 2 |
| Tasks | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| Function | 88 | 20 | 6 | 6 | 13 | 9 | 8 |
| File | 85 | 21 | 14 | 6 | 15 | 6 | 3 |
| Repo | 79 | 21 | 15 | 10 | 10 | 7 | 8 |
| All tasks | 252 | 62 | 35 | 22 | 38 | 22 | 19 |
| Model | 0 secure tiers | 1 tier | 2 tiers | All 3 tiers |
|---|---|---|---|---|
| Claude Fable 5 | 93 | 19 | 20 | 18 |
| GPT-5.6-Sol | 87 | 27 | 24 | 12 |
| Qwen3.8-Max | 94 | 25 | 19 | 12 |
| GLM-5.3 | 98 | 19 | 22 | 11 |
| DeepSeek-V4-Pro | 103 | 23 | 14 | 10 |
| Kimi-K3 | 103 | 23 | 21 | 3 |