Get Started
Home
Topics
Search
Library
6 min read · Code Generation · Evaluation · Added Oct 15 · Paper published Oct 10, 2026

Last Secure Code Benchmark: Is the Code You Vibe Secure?

Source: research paper via Hugging Face Daily Papers
LSCBench shows coding agents pass functional tests on 74–91% of tasks but produce code that’s both working and secure only 16–25% of the time, because users specify behavior and never mention security. Policy-shaped weaknesses like SSRF barely improve even with “be secure” reminders.

TL;DR

LSCBench measures whether coding agents produce secure code when the user only asks for functionality: across six frontier agents, functional pass rates hit 73.6%–91.3%, but joint functional-and-secure rates stay at 16.4%–25.1%.

Why It Matters

You prompt an AI agent to add a file upload handler. It writes code, your tests pass, you ship it. Nothing in that loop checks whether the handler lets a crafted archive write outside its target directory, or whether YAML parsing instantiates arbitrary Java classes. This is the vibe coding workflow: the user states what the software should do and the agent fills in everything else, including security decisions the user never mentioned (input validation, access boundaries, how to spawn a subprocess, whether to use SafeConstructor). Users rarely inspect the code, so unstated-but-critical defenses go unexamined.
Prior secure-code benchmarks each miss at least one dimension: they test a single language, cover few weakness classes, or only ask for a single snippet rather than a realistic repository build. Repository-scale efforts like BaxBench exist but still cover one setting. The authors argue nothing yet measures secure generation across languages, weakness categories, and generation scopes simultaneously.

How It Works

LSCBench takes 150 real vulnerability scenarios (115 from public CVEs, 35 hand-crafted Java cases) and turns each into three tasks at different scopes: Function (fill a masked function body), File (rewrite the whole file the fix touched), and Repository (rebuild the source tree from scratch, up to an 8,000-line cap). That gives 450 tasks across seven languages, covering 24 Common Weakness Enumeration categories including 21 of the 2025 CWE Top 25 and 8 of the KEV Top 10.
The critical design choice: every task specification describes only functionality, never mentions security or the vulnerability class. The agent must recognize the risk on its own, as it would in vibe coding. Hidden graders then run both a functional test suite and a security suite that fires a proof-of-concept attack through the program’s external surface and observes behavior, not source text. The authors note that upstream CVE-Factory tests often match source strings (so adding a comment can “pass” security), which is why they rewrote every test from scratch and gated acceptance on a four-state check:
# Validation gates per scenario assert functional_tests(vulnerable_code) == PASS assert security_tests(vulnerable_code) == FAIL # attack succeeds pre-fix assert functional_tests(fixed_code) == PASS assert security_tests(fixed_code) == PASS # attack blocked post-fix # Plus a 'narrated' control: vulnerable code with the fix pasted as comments # must still FAIL security, catching text-matching suites.
Agents (Claude Code or Codex scaffolds, 500-turn cap, no network) run each task once (pass@1). The headline metric is Func∧Sec: fraction of tasks that pass both suites.

What They Found

Six frontier agents were evaluated: Claude Fable 5, GPT-5.6-Sol, GLM-5.3, Qwen3.8-Max, DeepSeek-V4-Pro, and Kimi-K3.
•
Functional ≠ secure. Five of six models pass functional tests on ~90% of tasks. Yet the best Func∧Sec rate is 25.1% (Claude Fable 5); others sit at 16.4%–24.7%. A user who ships when tests pass would ship the vulnerability most of the time.
•
Securing a vulnerability at every granularity is rare. The best model is functional-and-secure at all three granularities on only 12% of the 150 scenarios. Fixing it once as a function doesn’t mean the model understands the weakness.
•
Larger scope lowers functionality, not security. Func∧Sec is flat or rises from Function to Repo. The authors’ explanation: filling a hole invites the agent to mimic the surrounding (vulnerable) structure, while writing a module from spec lets it choose the data flow.
•
More turns don’t buy security. The model using the fewest turns (Claude Fable 5) secures the most tasks. Secure submissions take roughly the same number of turns as functional-but-vulnerable ones.
•
Weakness families split sharply. Memory safety is secured most often because the defense (bounds, null, lifetime checks) is local to the code being written. SSRF and information exposure are almost never secured, because they require reasoning about an unstated policy: which destinations to refuse, which fields to withhold from a serialized output.
•
Adding “please be secure” to prompts helps modestly. A one-sentence security reminder lifts Func∧Sec by 15–21 points for three of four re-tested models, but most tasks stay insecure. Information exposure and SSRF barely move.
•
Models fail in distinctive ways. Kimi-K3 treats the spec as exhaustive and skips anything not asked. GPT-5.6-Sol often replays the upstream vulnerable code from memory. DeepSeek-V4-Pro blames environment issues and skips verification. Case studies show, for one YAML task, two models used SafeConstructor and passed, three used the default constructor and shipped a deserialization gadget.

What’s Useful

•
If you ship agent-written code, functional tests do not screen for security. The paper’s whole premise is that the two axes decorrelate. Treat passing CI as evidence of functionality only, and plan a separate review path for anything touching untrusted input, authorization, serialization, or outbound requests.
•
Expect worst coverage on policy-shaped weaknesses. For SSRF, information exposure, missing authorization, and similar categories, a reminder prompt is not enough. These are the categories where human review or targeted static/dynamic checks are most worth the effort, because no agent in the study reliably caught them.
•
Ensembling across models is worth testing. Pooled across the six agents, at least one secured 44.0% of tasks versus 25.1% for the best single model, and only 19 of 450 were secured by all six. A second model reviewing the first, or voting across diverse models, has real headroom. The paper demonstrates the oracle gap, not a working ensemble, so this is a hypothesis to validate on your own code.
•
A simple security-reminder sentence in your agent’s system prompt is a cheap intervention worth trying, but validate the categories you care about. It helped deserialization, path handling, and memory safety most; it did not help the policy-shaped families.
•
The benchmark, construction cookbook, and leaderboard are released on GitHub.

Caveats

•
All results are pass@1 with no network and no human in the loop, matching vibe coding but not necessarily matching an agent that can look up documentation or receive review feedback.
•
The 24 CWE labels cover 21 of the Top 25 but should not be read as uniform coverage, and language and weakness distributions are entangled (C scenarios are mostly memory safety, Java carries most SSRF and deserialization), which drives the apparent per-language security gaps.
•
Qwen3.8-Max authored the tests and specifications; the authors report its results sit mid-field and see no self-authoring advantage, but it remains a confound worth noting.
•
The paper evaluates frontier models as of its writing. Rankings between specific models are a snapshot; the structural finding (functional far outpaces secure, policy weaknesses lag) is the durable claim.
Topics
Code Generation
Evaluation
Code Generation
Evaluation
Up next in Code Generation
Self-Evolving Coding Agents via Harness-Policy Optimization
InfiniDream: Open-Ended Photorealistic 3D Worlds Through Procedural Generation
Don't miss new content
Log in to follow topics and personalize your feed.
Related topics you might like
Evaluation209 episodes
Code Generation72 episodes