Agents Write Working Code in 95% of Tasks, But Leave a Vulnerability in Most of Them
If you don't tell an AI agent to care about security, it won't add security on its own. That's what the test from the Qwen team measures. Functions are cut out of real projects that once had vulnerabilities, and the agent has to rewrite them from a description. Large 4 and DeepSeek v4.1 Flash produced working code in roughly 95% of 150 tasks, but the repeated attack succeeded in most of them. That's why code review and automated vulnerability scanning remain mandatory for agent-written code.
AI-processed from X: @Chris_Wozniczek; edited by Hamidun News
When you ask an agent to "finish the authorization function" or "build file uploads," you usually don't add "and make it secure." The question is what you get by default. The Qwen team from Alibaba built a benchmark that measures exactly this habit, and independent developer Chris Wozniczek ran it on two models: Large 4 and DeepSeek v4.1 Flash. The result is unpleasant for anyone who trusts agents with production code: the models almost always write working code, but the vulnerability in it most often stays.
How the test works
The authors take a real project where a hole was once found. Of the 150 scenarios, 115 are real CVEs in open-source projects, and 35 are realistic Java business applications written by security specialists. Then the code containing the vulnerability is removed and replaced with a <MASKED> placeholder.
The agent receives the rest of the project and a description of what the missing piece should do: function signatures, behavior, and its connections to the surrounding code. It has no internet access and cannot see the tests. An important detail: the word "security" does not appear in the task text. It is an ordinary code-completion task, like a work ticket. So the test reveals the agent's habits, not its ability to follow the instruction "make it secure."
Each scenario exists in three sizes, for 450 tasks in total. In the smallest, only the affected functions are removed. In the others, entire files or up to 8,000 lines of the project are removed. Wozniczek ran the smallest variant, which means 150 tasks.
Two checks, not one
Each task has two hidden checks. The first is the project's regular tests: the restored code must work correctly. The second is a replay of the original attack against the new code. It passes only if the attack fails. A task counts as solved when both checks pass.
This matters because familiar code benchmarks look only at the first check. By that measure, both models look excellent: working code in about 95% of tasks. The second check showed that in most cases the hole remained open. This is consistent with the published benchmark results, where even the best agents solve roughly one task in four.
A household analogy: a contractor builds a house, and every tap works, but the front door doesn't lock. An acceptance test of "does everything switch on" passes it. An acceptance test of "let's try to break in" does not.
Who ran it
A separate part of the story is how the experiment was conducted. According to the author, he gave the agent a Devin VPS and API keys and asked it to carry out the entire experiment. Devin worked for several hours and built, on its own, a site with the report, a video, links to the raw test files, and the infrastructure. The author also asked it to collect evidence as it went, so the report could be shown to others. In effect, the agent not only sat the exam but also organized it.
What this means in practice
- Don't treat passing unit tests as a sign of security. An agent with 95% working code can leave vulnerabilities in most tasks.
- State security requirements explicitly in prompts and specifications, and add checks that try to break the result rather than merely run it.
- For agent-written code, keep static analysis, dependency scanning, and human review in place.
Limitations
This was a single run on the smallest of the three sizes, with two models, and the author himself calls it a personal experiment. His post gives no exact per-model percentages: it says only that the hole was left in most tasks. The benchmark itself belongs to the Qwen team, and its published figures offer a general reference point: without a security prompt, agents still do not, by default, replace a security specialist.
- Nov 21, 2026GigaChat: 7th in the World on a Blind Russian-Language Ranking, but 78 Elo Points Behind the Leader
- Nov 21, 2026Chinese Tech Giants Double AI Spending to $139B, While Labs Recover Less Than 8%
- Nov 21, 2026Skein Agent Erases Finished Stages From Context: 97% Success Rate, But More Expensive Than OpenCode
- Nov 21, 2026SGLang with Humming Kernels Cut Time to First Token by 7–23% and Output Throughput by 17–34%
Key Questions Answered
How the test works?
The authors take a real project where a hole was once found. Of the 150 scenarios, 115 are real CVEs in open-source projects, and 35 are realistic Java business applications written by security specialists. Then the code containing the vulnerability is removed and replaced with a <MASKED> placeholder. The agent receives the rest of the project and a description of what the missing piece should do: function signatures, behavior, and its connections to the surrounding code.
What are the key details on Two checks, not one?
Each task has two hidden checks. The first is the project's regular tests: the restored code must work correctly. The second is a replay of the original attack against the new code. It passes only if the attack fails. A task counts as solved when both checks pass. This matters because familiar code benchmarks look only at the first check. By that measure, both models look excellent: working code in about 95% of tasks. The second check showed that in most cases the hole remained open.
Who ran it?
A separate part of the story is how the experiment was conducted. According to the author, he gave the agent a Devin VPS and API keys and asked it to carry out the entire experiment. Devin worked for several hours and built, on its own, a site with the report, a video, links to the raw test files, and the infrastructure. The author also asked it to collect evidence as it went, so the report could be shown to others. In effect, the agent not only sat the exam but also organized it.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.