AI-generated code has a security problem that is no longer theoretical. Veracode's 2025 research found that 45% of AI-generated code introduces OWASP vulnerabilities. CodeRabbit's analysis showed AI-produced code carries a 2.74x higher vulnerability rate than human-written code. And Escape.tech's scan of 5,600 vibe-coded applications uncovered over 2,000 vulnerabilities, 400+ exposed secrets, and 175 instances of personally identifiable information sitting in the open.
The joke that "the S in vibe coding stands for security" has become something closer to industry consensus. But jokes do not explain why the problem exists, why it is structural rather than incidental, and what forces might eventually fix it. This analysis looks at the data, the root causes, the vendor responses, and the regulatory signals that will shape the next twelve months.
The Numbers Paint a Consistent Picture
When one study finds a problem, it might be methodology. When every study finds the same problem, it is a pattern.
Veracode's 45% figure measures code that introduces known OWASP vulnerabilities. CodeRabbit's 2.74x multiplier comes from comparing vulnerability density in AI-generated pull requests versus human-written ones across thousands of repositories. Escape.tech crawled 5,600 publicly accessible vibe-coded applications, cataloging everything from SQL injection to hardcoded API keys.
The individual incidents put faces on the statistics. CVE-2025-48757 revealed that Lovable had been generating Supabase schemas without Row Level Security, exposing over 170 production applications. Moltbook leaked 1.5 million authentication tokens and 35,000 email addresses because API endpoints returned sensitive data without checking authorization. The Tea App exposed 72,000 user images and 1.1 million private messages through similar missing access controls.
The security crisis in AI-generated code is not anecdotal. Independent research from Veracode, CodeRabbit, Escape.tech, and Tenzai all converge on the same finding: AI coding tools systematically reproduce the same categories of vulnerabilities that human developers learned to avoid over the past twenty years. Every application Tenzai tested lacked CSRF protection, and all had SSRF vulnerabilities.
A Tenzai security study added the final data point. The researchers tested multiple AI-built applications and found that every single one lacked CSRF protection. Every one had SSRF vulnerabilities. Not most. All of them. The baseline for AI-generated security is not "sometimes flawed." It is "consistently and predictably insecure in specific, well-documented ways."
Why the Problem Is Structural
The instinct is to blame the tools and wait for the next version to fix things. But the security gap is not a bug that a software update will resolve. It is built into how these systems learn, what they optimize for, and what they are asked to do.
Large language models learn to write code from training data that includes billions of lines of open-source code, and a significant portion of that code is insecure. Stack Overflow answers, tutorial repositories, quick prototypes, abandoned side projects all sit in the training corpus alongside production-quality code. The model does not distinguish between a secure implementation and an insecure one. It learns what code looks like, not what secure code should do.
Think of it like learning to cook by watching every cooking video ever uploaded to the internet. Some are from Michelin-star chefs. Some are from college students making ramen at 2 AM. If you learned to cook by averaging all of those videos, you would produce food that looks roughly correct but has a meaningful chance of making someone sick. You would know how to combine ingredients, but you would not consistently know which temperatures kill bacteria.
AI coding tools learn the same way. They produce code that compiles, runs, and delivers the requested functionality. But they have no consistent model of what "secure" means as distinct from "functional." A database query that returns the right data is functionally correct whether or not it uses parameterized inputs. An API endpoint that serves user profiles works whether or not it checks authorization. Security is orthogonal to the optimization target.

The second structural factor is the prompt itself. When a user asks an AI to "build a user profile page," the prompt contains no security requirements. Adding authentication, authorization, input validation, and CSRF tokens would go beyond the request. The user asks for features. The AI builds features. Security is not a feature. It is a constraint, and constraints that are not specified tend to be omitted.
What Tool Vendors Are Doing About It
The vendor response has been uneven but accelerating. After CVE-2025-48757, Lovable updated their code generation pipeline to include Row Level Security policies by default. Supabase shipped one-click RLS audit tools for affected users. These were reactive fixes, but they signal a shift in how platforms think about their responsibility.
The larger AI coding platforms have started building security guardrails into their generation pipelines. Some run static analysis on generated code before presenting it to the user. Others have introduced security-focused system prompts that instruct the model to include authentication checks and input validation by default.
Understanding the security landscape is the first step toward building responsibly.
Start hereBut these guardrails face a fundamental tension. Adding security checks slows down generation and sometimes produces more complex code than what the user wanted. In a market where tools compete on speed, the incentive to add friction is weak. A tool that asks "Do you want me to add authentication to this endpoint?" after every generation request will lose users to a tool that just builds the thing. The competitive dynamics push toward less security, not more, unless external pressure changes the equation.
Some vendors are splitting the difference by offering security as a separate layer: generate fast, then scan afterward. This preserves speed while catching obvious problems, but it treats security as an afterthought, which is the mindset that created the crisis in the first place.
The Regulatory Signals
The EU AI Act, which began phased enforcement in 2025, classifies AI systems by risk level. AI coding tools have not yet been classified as high-risk, but the pattern of breaches is creating political pressure. When 170 applications are exposed by a single platform vulnerability, regulators notice.
The more immediate regulatory threat comes from existing data protection frameworks. GDPR already holds data controllers responsible for security breaches regardless of how the code was written. If your AI-built application leaks user data, "the AI did it" is not a legal defense. You are the data controller. The fact that you did not write the code does not reduce your liability. In the United States, the FTC has signaled increased scrutiny through enforcement actions, and state-level privacy laws in California, Colorado, and Connecticut add further liability. The legal landscape is converging on a simple principle: if you deploy it, you own the security consequences.

This trajectory matters because it changes the economics. If regulatory penalties make breaches expensive, companies will invest in security review not because it is the right thing to do, but because the alternative becomes more costly than the review itself.
The Two-Tier Future
The most likely outcome is not that AI coding tools become secure or that they get banned. It is that the industry splits into two distinct tiers.
The first tier is rapid prototyping. AI tools will continue to be exceptional for MVPs, internal tools, hackathon projects, and personal utilities where the data is not sensitive and the consequences of a breach are limited. "Build fast, fix later" remains a reasonable tradeoff here.
The second tier is production deployment. Any application that handles user data, processes payments, or serves a meaningful user base will require professional security review before going live. The review might be automated, human, or both. But the era of shipping AI-generated code directly to production without any security checkpoint is ending, one breach at a time.
Treating AI-generated code as production-ready because it passes functional testing. Functional tests verify that code does what it is supposed to do. Security testing verifies that code does not do what it is not supposed to do. AI tools consistently pass the first test and fail the second. A working application is not a secure application, and the gap between the two is where every major AI-code breach has occurred.
This two-tier model already exists informally. Experienced developers already review AI output before committing it. Companies with mature security practices already run static analysis on AI-generated pull requests. The shift is that this informal practice is becoming a formal requirement, backed by vendor tooling, industry standards, and eventually regulation. The structural incentives that created the crisis (speed over security, features over constraints, shipping over reviewing) are deeply embedded. Changing them takes time, pressure, and consequences.
What This Means For You
This is not someone else's problem. The appropriate response depends on where you sit.
- If you are a senior developer, the data confirms what your instincts probably already told you. AI-generated code needs the same rigor as junior developer code, possibly more, because the volume is higher and the confidence it inspires is disproportionate to its quality. Build automated security scanning into your CI/CD pipeline. The 2.74x vulnerability multiplier means every AI-generated pull request needs more review attention, not less.
- If you are a founder or technical leader, budget for security review the way you budget for hosting. The Lovable and Moltbook incidents demonstrate that a single missing security control can expose your entire user base. A security audit before production launch is the minimum viable security posture.
- If you are evaluating AI coding tools for your team, ask vendors specific questions about their security guardrails. What static analysis runs on generated code? Does the tool include authentication and authorization by default? The answers vary dramatically between tools, and the differences matter more than speed benchmarks.
- If you are building anything that handles real user data, the 45% vulnerability rate is your baseline assumption. Plan your workflow accordingly: generate, review, scan, fix, then deploy. That extra step between generation and deployment is the difference between a working product and a breach disclosure.
The crisis is real, measurable, and structural. It will not fix itself. But it is predictable, which means it is preventable for anyone willing to add the review step that the tools skip.
The data is clear. The question is what you do with it.
Keep reading