Vibe Coding: Risks, Security Vulnerabilities, and What Actually Helps

The biggest risk in vibe coding is not code that is wrong, but code that works and is still insecure. In Veracode's GenAI Code Security Report 2025, 45 percent of the AI responses tested failed the security tests and carried vulnerabilities from the OWASP Top 10, in syntactically flawless, working code.
How insecure is AI-generated code really?
Measurably insecure, and independent of the model. For the GenAI Code Security Report 2025, Veracode tested eighty curated programming tasks against more than one hundred language models in four languages: Java, JavaScript, Python, and C#.
- 45 percent of all generated code samples failed the security review.
- 86 percent failure rate for cross-site scripting (CWE-80), by far the weakest discipline.
- 72 percent failure rate for Java, the riskiest of the four languages examined.
The finding behind the numbers is the decisive one: the models have become clearly better at producing functioning code, but not to the same degree at security. A spring 2026 update from Veracode reaches the same conclusion. Newer model generations therefore do not solve the problem on their own.
Why does an AI produce insecure code when it has read everything?
Because a language model is optimized for plausibility, not for resistance to attack. Three mechanisms explain most of the cases.
First, the training average. Models learn from public code. The average of public code is not secure, it is average, including the tutorials where input flows unchecked into a database query because the example was meant to stay short.
Second, the missing attacker perspective. A prompt describes what should happen. But security is the question of what is allowed to happen. What nobody asked for also does not get built: the check for missing authorization, catching the edge case, limiting the request rate.
Third, the missing context. The model does not know your architecture. It does not know that this endpoint is publicly reachable, that that field comes from a foreign system, or that your tenant separation depends on a specific condition.
Which security vulnerabilities typically appear in AI code?
The OWASP Top 10 was revised in November 2025 and finalized in January 2026, based on more than 175,000 CVE entries. Two categories are new, and both hit AI-assisted development particularly hard.
- Broken access control (A01:2025), still in first place. AI code implements the business logic and leaves the question "is this user allowed to do this?" unanswered, because it did not appear in the prompt.
- Security misconfiguration (A02:2025), climbed from fifth place to second. Generated configurations are optimized for "it runs immediately": permissive CORS rules, debug output, default passwords.
- Software supply chain failures (A03:2025), new. An AI adds dependencies without anyone having chosen them. On top of that comes the hallucination of nonexistent packages, whose names attackers register on purpose.
- Mishandling of exceptional conditions (A10:2025), also new. The normal case is implemented, the error case is swallowed.
- Cross-site scripting, the empirical front-runner in the Veracode test with an 86 percent failure rate.
Which checks should I run before merging AI code?
Four checks cover most of the patterns named above, and all four can be automated.
- Static analysis with security rules. Finds injection patterns, insecure deserialization, and missing output escaping before the code even runs. Tools and their limits: static code analysis compared.
- Dependency review. Every newly added package gets flagged: does it even exist, who maintains it, what license, what known vulnerabilities?
- Permission review. For every new endpoint, an explicit answer to the question of who is allowed to call it. This is the check that is automated least often and missing most often.
- Tests for error cases. Not just the happy path, but missing input, wrong type, a foreign identifier, a duplicate call. See test coverage for AI code.
Isn't it enough to just read through the generated code?
Not as the sole measure, because reading is exactly what slips when a lot of code is being produced. In the Stack Overflow Developer Survey 2025, 66 percent of respondents named "almost right, but not quite" as their biggest frustration when working with AI tools. 45 percent said they lose significant time debugging AI code.
"Almost right" is the hardest category for a review. Obviously wrong code stands out. Code that looks the way it is supposed to look, and skips a check in one place, does not stand out when skimmed, and skimming is what happens once volume rises. A human review remains necessary; but it needs a mechanical first pass that clears away the obvious. How to build such a review is described in the article Code Review for AI-Generated Code.
Frequently asked questions about vibe coding risks
Is AI-generated code less secure than hand-written code?
It is proven that 45 percent of the AI responses tested by Veracode in 2025 failed the security tests. A clean direct comparison with human code under identical conditions is not available from this study, so treat any circulating comparison factors with caution. The reliable takeaway is: the failure rate is high enough to justify a dedicated review layer.
Which programming language is riskiest when using AI?
In the Veracode 2025 test, Java was the weakest of the four languages examined, with a 72 percent failure rate (Java, JavaScript, Python, C#).
What is slopsquatting?
An attack that exploits the fact that AI models invent package names. Attackers register the hallucinated names in public package registries and wait for someone to run the installation instruction without checking it. The countermeasure is a dependency review that flags every new package.
Does it help to write "write secure code" in the prompt?
It helps measurably little. The Veracode report shows that security performance has not grown in step with general model quality. An instruction in the prompt is a request, not a control point, the check has to happen outside the model.
Do I have to avoid AI tools because of this?
No. The risk does not come from the tool, but from unreviewed code reaching production. A review step between generation and delivery solves the problem without giving up the speed advantage.
Friday, 17:00, a hotfix has to go out. That is exactly when the permission check gets skipped, not out of carelessness, but because nobody opens a checklist at that moment. Code Guardian therefore hangs the four checks as gates in front of deploy, migration, and every new dependency.
Sources
- Veracode, GenAI Code Security Report 2025 (80 tasks, more than 100 models, four languages), July 2025, plus the spring 2026 update.
- OWASP Top 10:2025, presented in November 2025, final version January 2026, based on more than 175,000 CVE entries and 589 CWEs.
- Stack Overflow Developer Survey 2025, "AI" section.
As of: July 27, 2026. General professional information, not security advice for your individual case.
Share this article
Stay up to date
Get the latest articles, insights and industry updates straight to your inbox.
Decide for yourself what Google shows you
Google lets you choose which sources appear more prominently in your search results: in Top Stories and in AI answers. Two clicks, and you see the sites you trust.
Add provimedia.de to my preferred sourcesRelated articles
More articles you might find interesting.
Who Is Liable for AI-Generated Code? What Changes in 2026
As of December 2026, software is explicitly a product under product liability law. What this means for developers, agencies, and clients.
Definition of Done for AI Code: Evidence Instead of Promises
When code is written in minutes, the bottleneck shifts to the question of when something is actually done. A Definition of Done built for that pace.
Code Audit: A Checklist for Reviewing Someone Else's Software
Before a handover, before a purchase, after an incident: what a code audit checks, in what order, and how to spot a superficial one.
Prüfungen, die sich nicht überspringen lassen
Das Skill-Paket für Claude Code und OpenAI Codex: sieben Gates vor Deploy, Migration, neuer Abhängigkeit, Datenurteil, Befund, Optionsfrage und Rechtstext. Firmenlizenz, unbegrenzt viele Entwickler im Unternehmen.