AI Generated Code Vulnerabilities: The Security Risks You Need to Know (2026)

TL;DR
- AI code generators produce vulnerabilities at roughly 2x the rate of human-written code, and most vibe-coded apps ship with 8 to 14 security findings according to agency audits.
- The most common issues are disabled row-level security (around 70% of Lovable apps per Beesoul data), leaked secrets, missing webhook verification, and absent soft deletes.
- AI self-review catches some surface issues but consistently misses infrastructure and context-specific problems. A pentester who tested an AI-audited app still found remaining vulnerabilities.
- You can catch most of these problems yourself with free scanners and a basic checklist before spending anything on a professional audit.
A Veracode analysis of 4 million code scans found that AI-generated code contained security flaws 45% of the time. The Cloud Security Alliance (CSA) put the number even higher: 62% of AI-generated code in their study contained vulnerabilities. And when Georgia Tech's Vibe Security Radar scanned 5,600 vibe-coded applications, they flagged over 2,000 with confirmed security issues.
These are not edge cases. If you have built an app with Cursor, Lovable, Claude Code, or any other AI coding tool, the probability that your codebase contains exploitable vulnerabilities is not a question of "if" but "how many."
Here is what the data shows, which vulnerabilities show up most often, and what you can do about them before they become someone else's problem.
Why AI-Generated Code Has More Vulnerabilities
AI code generators optimize for one thing: making your feature work. When you prompt a model to "build a user dashboard with Supabase," it creates the tables, writes the queries, and renders the data. The app works. But the model rarely considers who else might access that data, whether the API keys are exposed in the client bundle, or what happens when someone sends unexpected input.
This is not a single-tool problem. It is a structural pattern across all AI code generation. The models prioritize the visible request (make it work) and under-prioritize the invisible requirements (make it secure).
Human developers make similar mistakes, but experienced ones have scar tissue from past incidents. They remember the time a missing auth check cost their company a week of incident response. AI models do not accumulate caution the same way. They produce what the training data suggests is "normal," and normal training data is full of insecure patterns. The fix loop has its own name now — vibe debugging — and it carries similar caution rules: ask the AI to explain before it fixes, verify the actual flow rather than trusting that tests pass.
The Veracode data backs this up: across 4 million scans, AI-generated code had a 45% flaw rate. The CSA's research found 62% of AI-generated code samples contained vulnerabilities. Damian Galarza, who runs security assessments specifically for AI-built apps, found 69 vulnerabilities across just 15 applications. That is nearly 5 vulnerabilities per app, and these were apps their founders considered ready to ship.
The common vulnerability types map directly to the CWE (Common Weakness Enumeration) catalog: CWE-862 (missing authorization), CWE-798 (hardcoded credentials), CWE-89 (SQL injection), CWE-79 (cross-site scripting), and CWE-200 (exposure of sensitive information). These are not obscure attack vectors. They are the top items on every security scanner's checklist, and AI code generators produce them at industrial scale.
The 7 Most Common Security Risks in Vibe-Coded Apps
Based on audit data from Beesoul, Varyence, the Georgia Tech Vibe Security Radar, and open-source scanner results, these are the vulnerabilities that appear repeatedly in AI-generated codebases.
1. Disabled Row-Level Security (CWE-862: Missing Authorization)
This is the single most common finding. Beesoul reports that roughly 70% of Lovable-built apps ship with RLS disabled on Supabase tables. When RLS is off, any authenticated user can query, modify, or delete any other user's data through a simple API call.
Your app looks fine from the frontend. The database is wide open from the backend.
For a detailed walkthrough on fixing this in Lovable apps specifically, see our Lovable app security guide.
2. Hardcoded Secrets and API Keys (CWE-798: Hardcoded Credentials)
AI models regularly embed API keys, database connection strings, and service tokens directly in source files. These end up in your Git history, your client-side JavaScript bundle, or both. Even if you later move them to environment variables, the keys remain in your commit history unless you specifically scrub them using tools like git filter-branch or BFG Repo-Cleaner.
A Reddit user scanning 200+ vibe-coded sites found that exposed secrets were among the most frequent issues, contributing to an average security score of just 52 out of 100.
3. Missing Webhook Verification (CWE-345: Insufficient Verification of Data Authenticity)
If your app processes payments through Stripe, receives notifications from third-party services, or handles any external callbacks, those webhook endpoints need signature verification. AI-generated code almost never includes this step. Without it, anyone can send fake webhook payloads to your endpoint and trigger actions like marking orders as paid, without actually paying.
4. No Soft Deletes (CWE-404: Improper Resource Shutdown or Release)
When a user deletes their account or data, AI-generated code typically runs a hard DELETE query. The data is gone permanently. This creates problems for GDPR compliance (you need audit trails of what you deleted and when), for billing disputes (no records to reference), and for accidental deletion recovery.
5. N+1 Database Queries (Performance Vulnerability)
More of a performance vulnerability than a strict security one, but it creates denial-of-service conditions. AI-generated code frequently fetches related data in loops instead of using joins or batch queries. Under real traffic, this pattern can make your database unresponsive, which takes down the entire application. The Georgia Tech scan flagged this as one of the most widespread structural issues across the 5,600 apps they analyzed.
6. Exposed Internal Error Messages (CWE-200: Exposure of Sensitive Information)
When something goes wrong, AI-generated code often returns the raw error message to the user. These messages can reveal database schema details, table names, column types, and internal application logic. For an attacker, that information is a roadmap.
7. Missing Input Sanitization (CWE-79 and CWE-89: XSS and SQL Injection)
AI models generate code that trusts user input. Form fields, URL parameters, and API request bodies get passed directly to database queries or rendered in HTML without sanitization. This opens the door to SQL injection and cross-site scripting attacks, two of the most exploited vulnerability classes on the web.
Real Numbers From the Field
These are not theoretical risks. Here is what researchers and auditors are finding in production AI-generated code.
| Source | Finding | Scale |
|---|---|---|
| Veracode analysis | 45% of AI-generated code contains security flaws | 4 million code scans |
| Cloud Security Alliance | 62% of AI-generated code samples had vulnerabilities | Research study |
| Georgia Tech Vibe Security Radar | 2,000+ apps flagged with confirmed vulnerabilities | 5,600 vibe-coded apps scanned |
| Beesoul audits | 8 to 14 findings per app; ~70% of Lovable apps have RLS disabled | Ongoing agency clients |
| Damian Galarza assessments | 69 vulnerabilities across 15 AI-built apps | 15 apps |
| Reddit r/VibeCodeDevs scan | Average security score: 52/100 | 200+ sites |
| GrowExx 48-hour audit | Hidden risks found despite passing all linters | 1 production SaaS |
The GrowExx case is especially instructive. They performed a 48-hour deep audit on a production SaaS built entirely with Claude Code. The app passed all automated linters and standard test suites. The manual audit still uncovered risks that no automated tool had flagged. Linters check syntax and style. They do not verify that your business logic keeps data where it belongs.
On the community side, the r/vibecoding thread that bluntly states "vibe coding without a security audit is not a calculated risk, it is negligence" has become one of the most referenced posts in the subreddit. The consensus in that discussion: AI review catches the surface layer, but misses the infrastructure and context-specific problems that matter most.
Why AI Cannot Reliably Audit Its Own Code
The tempting shortcut is to ask the AI to review its own output. Some developers are doing exactly this, and it does catch certain issues. But the approach has a well-documented blind spot.
NetSPI tested this directly in a controlled experiment. They vibe-coded an application, then had the AI audit it, implemented every fix the AI suggested, and finally ran a human penetration test. The pentest still found vulnerabilities the AI had missed entirely.
The X/Twitter community reflects this split. @AwakeAdeimantos claims to "just vibe code an agent to audit my vibe coded code," representing the optimistic camp. On the other side, @shachikyoto argues that "official teams won't trust a vibe coded audit agent," and @pdiomede states flatly: "You cannot vibe code audit." The majority sentiment leans skeptical, aligning with the NetSPI findings.
one brief.
// what shipped · what broke · what to watch.
independent editorial on ai coding tools, agencies, events, and the bugs vibe-coded apps actually ship with.
no spam · unsubscribe anytime
The core issue is that AI models lack context about your specific infrastructure, your threat model, and your business rules. They can check for common patterns (is RLS enabled? are there strings that look like API keys?) but they cannot reason about whether your particular multi-tenant data model actually isolates customer data under concurrent load, or whether your webhook flow could be exploited through a race condition.
AI-assisted review is a useful first pass. It is not a substitute for human review on anything that touches real user data or money.
How to Find These Vulnerabilities Yourself
You do not need to be a security expert to catch the most common issues. Here is a practical approach that takes 1 to 2 hours and costs nothing.
Step 1: Run a Free Scanner
The vibe-codebase-audit tool on GitHub is free and open source (MIT license). It scans for secrets, data exposure patterns, and common vulnerabilities specific to vibe-coded projects. You need an OpenRouter API key for the AI-assisted portion, but the static analysis scans work without one.
Clone the repo, point it at your project, and review the output. It will catch hardcoded keys, obvious data exposure, and many of the CWE patterns listed above.
Step 2: Check the Critical Five Manually
These five checks account for the majority of serious findings. Go through them one by one:
- RLS status: Open your Supabase dashboard and check every table. If RLS is not enabled, enable it and add appropriate policies before doing anything else. See our Cursor code audit guide for Cursor-specific RLS patterns.
- Secrets in code: Search your entire codebase for API keys, tokens, and connection strings. Verify that
.envfiles are in.gitignore. Review your Git history for previously committed secrets usinggit log -p --all -S 'sk_live'or similar patterns. - Webhook endpoints: Find every endpoint that receives external callbacks. Verify each one checks the request signature against your webhook secret.
- Error responses: Trigger errors in your app and check what gets returned to the browser. If you see database details, stack traces, or internal paths, wrap those responses to return generic error messages instead.
- Input handling: Test your forms and API endpoints with unexpected input. Try HTML tags in text fields. Try SQL syntax in search bars. If the app renders or executes them, you have injection vulnerabilities.
Step 3: Use AI as a Second Pass (Not the First)
After your manual check, use Cursor or Claude to review specific files for additional security issues. Give it focused prompts: "Review this file for authentication bypass vulnerabilities" or "Check this API route for input validation gaps." Treat every finding as a suggestion that needs your verification, not as a definitive answer.
For a structured end-to-end process, see our full vibe code audit guide.
When to Bring in a Professional
DIY audits catch the low-hanging fruit. For apps that handle any of the following, a professional audit is worth the investment:
- Payments or financial transactions
- Personal health information
- User-generated content that gets displayed to other users
- Multi-tenant data where one customer's information must never leak to another
- Any data subject to regulatory requirements (GDPR, HIPAA, SOC 2)
Professional security audit pricing in 2026:
| Service Level | Typical Cost | What You Get | Turnaround |
|---|---|---|---|
| Quick check | $500 | Surface scan, critical findings only | 1 to 3 days |
| Full audit | $1,500 | Complete review with prioritized report | 5 to 7 business days |
| Comprehensive | $3,000+ | Deep review, remediation guidance, follow-up | 7 to 10 business days |
Source: Published pricing from Damian Galarza (Quick Check $500, Full $1,500, Comprehensive $3,000) and Beesoul (small MVP from $1,500; mid-size from $3,000).
Agencies like Beesoul and Varyence specialize in vibe-coded applications built with Cursor and Lovable. They know the common patterns because they audit them every week. If you are unsure whether your app needs a professional audit, Beesoul offers a free 30-minute discovery call, and Damian Galarza offers a free 15-minute assessment through VibeAudits.com.
The math is simple. A data breach for a small business runs into tens of thousands of dollars once you factor in notification requirements, lost customers, and potential regulatory fines. A $1,500 audit before launch is cheap insurance.
Frequently Asked Questions
What is a vibe code audit? A structured security and architecture review of AI-generated code, designed to catch issues that AI tools consistently miss before you launch. It covers RLS policies, secrets management, webhook verification, authentication flows, and data access patterns. (Source: Beesoul)
Do I really need an audit if my app "works"? Yes. Functional code often hides critical security and scalability problems that only surface under real traffic or targeted attacks. The Veracode data shows that 45% of AI-generated code contains flaws, and "working" is not the same as "secure."
Can I audit my app myself as a non-technical founder? You can catch a lot with free scanners and the manual checklist above. You do not need to read every line of code. However, for apps handling payments or personal data, professional review is strongly recommended for the infrastructure-level issues that scanners miss.
How much does a professional vibe code audit cost? $500 to $3,000 depending on the depth and size of your application. See the pricing table above for a breakdown by service level.
What are the most common issues in vibe-coded apps? Disabled RLS (CWE-862), hardcoded secrets (CWE-798), missing webhook verification (CWE-345), absent soft deletes, N+1 queries, exposed error messages (CWE-200), and missing input sanitization (CWE-79/CWE-89). Beesoul reports 8 to 14 findings per typical app.
Is AI good at auditing AI code? It catches some surface issues but consistently misses context-specific and infrastructure problems. The NetSPI experiment demonstrated this clearly: after a full AI self-audit and fix cycle, a human pentest still found remaining vulnerabilities.
How long does an audit take? DIY with free tools: 1 to 2 hours for the initial scan and manual checklist. Professional audits: 3 to 10 business days depending on app complexity and chosen service level.
Which tools are best for vibe code audits? Start with the free vibe-codebase-audit scanner on GitHub. For paid options, Beesoul offers a structured 18-check framework, and VibeAudits.com provides human-powered reviews from full-stack developers.
Fix What You Find
Finding vulnerabilities is half the job. Here is where to go next:
- Security vulnerabilities: Our security vulnerabilities fix guide walks through remediation step by step, organized by severity
- Broken authentication: If your audit reveals auth issues, the broken authentication fix guide covers the specific patterns AI tools get wrong
- Lovable-specific issues: Lovable app security covers the RLS and Supabase pitfalls unique to that platform
- Cursor-specific audits: Our Cursor code audit guide includes Cursor-specific audit prompts and workflows
- Full production readiness: For a broader checklist covering performance, monitoring, and reliability alongside security, see our AI MVP to production guide
The goal is not perfect security. That does not exist. The goal is to close the obvious gaps so your app is not the easy target that automated scanners and casual attackers hit first. With AI-generated code shipping vulnerabilities at the rates documented above, even a basic audit puts you ahead of the majority of vibe-coded applications in production today.
Ship fast, but check the locks before you hand over the keys.
Related reading:

Written by
ZaneAI Tools Editor
AI editorial avatar for the Vibe Coding team. Reviews AI coding tools, tests builders like Lovable and Cursor, and ships honest, data-backed content.


