Photo by Markus Spiske on Unsplash (free license) Source

Updated October 23, 2026: replaced the early-2026 figures with Veracode’s July 2026 GenAI report, Georgia Tech’s count of AI-attributed CVEs, the SusVibes agent benchmark, Sonar’s per-model data and GitHub’s Octoverse findings, and corrected or removed statistics that did not match their primary sources.

AI-generated code introduces a security vulnerability in roughly 44% of security-relevant coding tasks, and that number has barely moved in a year. Veracode’s 2026 GenAI Code Security Report (July 2026), which has now tracked more than 100 models, puts the average security pass rate at 56%, against 55% in its first report. The code compiles almost every time. It just isn’t safe. Other studies frame it differently and point the same way: AppSec Santa confirmed at least one vulnerability in 25.7% of 522 samples from six LLMs, and on the SusVibes benchmark the best coding agent produced functionally correct code 57% of the time but secure code only 11.8% of the time. The flaws cluster in a few classes: cross-site scripting, log injection, broken access control, SSRF and path traversal, hardcoded secrets. And they are reaching production. Georgia Tech researchers have traced 74 published CVEs to AI-authored commits, 35 of them in March 2026 alone.

The volume is what makes this urgent. In Sonar’s survey of more than 1,100 developers (January 2026), AI already accounts for 42% of committed code, and developers expect 65% by 2027. Only 48% say they always check AI-assisted code before committing it. Meanwhile the 2026 Verizon DBIR found that 31% of breaches now start with an exploited software vulnerability, which has overtaken stolen passwords as the top way in. A flat vulnerability rate multiplied by a rising share of AI-written code means more exploitable bugs, in exactly the category attackers now use most.

Related: Vibe Coding vs. Agentic Coding: What Actually Changes for Enterprise Teams

AI Code Vulnerability Statistics: What the 2026 Research Shows

The studies count different things (samples, tasks, pull requests, real CVEs), so their headline percentages are not interchangeable. Here is what each one tested and found.

SourcePublishedWhat was testedKey finding
Veracode GenAI Code Security ReportJul 2026Code-generation tasks in four languages and four CWE classes, no security prompting; 100+ models tracked56% average security pass rate; best model (GPT-5.5) 68%
SusVibes (ICML 2026)Sep 2026 (v4)186 feature requests in real open-source repos, solved by coding agentsBest agent: 57% functionally correct, 11.8% secure
Georgia Tech Vibe Security RadarApr 202643,000+ security advisories traced back to the commit that introduced the bug74 CVEs from AI-authored code (14 critical, 25 high)
AppSec SantaMay 2026 update522 samples from six LLMs, five SAST tools plus manual triage25.7% had at least one confirmed vulnerability
CodeRabbitDec 2025470 GitHub PRs: 320 AI-co-authored, 150 human-only~1.7x more issues per AI PR; security issues up to 2.74x higher
BaxBench2025392 backend tasks attacked with real exploits62% of solutions from even the best model were incorrect or vulnerable
Georgetown CSETNov 2024Five LLMs, C code checked with the ESBMC model checker~48% compiled but contained a flagged bug; ~30% verified clean
NYU, “Asleep at the Keyboard”IEEE S&P 20221,689 GitHub Copilot programs across 89 scenarios~40% vulnerable

Veracode: A Year of Testing, No Real Progress

Veracode gives each model the same code-generation tasks (80 of them across Java, Python, C# and JavaScript, per its March 2026 update) with no security instructions, then checks the output for four CWE classes. Syntax correctness is near 100%. Security is not:

  • By vulnerability class: SQL injection (CWE-89) passes 83% of the time and cryptographic algorithm choice (CWE-327) 87%. Cross-site scripting (CWE-80) passes only 15%, log injection (CWE-117) only 12%.
  • By language: Python is the safest at 63%. Java is the worst at 30%, which Veracode calls “the riskiest language for AI code generation by a significant margin.”
  • By model: GPT-5.5 leads at 68%. Six of the 11 models in the current snapshot sit between 50% and 53%, with Qwen3.7-max last at 50%.
  • By model type: Reasoning models average 56%, non-reasoning models 51%. Coding-specialized models (51%) are no safer than general-purpose ones (52%), and large models (53%) barely beat small ones (51%).

Veracode co-founder Chris Wysopal put it bluntly: the models “may be almost syntactically perfect, but they are still failing on nearly half of all tasks.”

The split by vulnerability class is the interesting part. SQL injection is the flaw every tutorial now warns about, so parameterized queries are all over the training data. XSS and log injection require knowing where a value ends up (an HTML page, a log another system parses), and that context is rarely in the prompt.

Newer Models Are Not Reliably Safer

Sonar runs each new frontier model through the same 4,444 Java tasks and scans the output with SonarQube. The results swing between releases. GPT-5.6 Sol (August 2026) produced 197 vulnerabilities per million lines of code, up from 68 for GPT-5.5, while its functional pass rate rose from 78.66% to 81.99%. Claude Opus 5.5 (September 2026) moved the other way, from 251 to 229 per million lines, with BLOCKER-severity findings falling from 19 to 9. For both, cryptography misconfiguration and insecure system resource handling are the two largest categories.

A model upgrade can nearly triple your vulnerability density while your test suite turns greener. Re-baseline security every time you switch models.

Coding Agents in Real Repositories Do Worse

Single-prompt benchmarks flatter the models. SusVibes gives agents 186 real feature requests from open-source projects where human developers had previously shipped a vulnerable implementation. The best setup, SWE-Agent with Claude 4 Sonnet, produced functionally correct solutions 57% of the time, but only 11.8% were secure. The authors also found that simple security prompts, such as vulnerability hints, did not fix the problem. BaxBench saw the same gap on backend apps: exploits worked against around half of the correct programs each model generated.

Real CVEs, Not Just Benchmarks

Georgia Tech’s Systems Software & Security Lab launched the Vibe Security Radar in May 2025. It scans public vulnerability databases, finds the commit that introduced each bug, and flags it when the commit carries an AI tool’s signature: co-author tags, bot emails or other known markers. By April 2026 it had scanned more than 43,000 advisories and confirmed 74 CVEs from AI-written code, 14 rated critical and 25 high. About 18 surfaced in the second half of 2025. The first three months of 2026 brought 56, including 35 in March.

Treat that as a floor. Strip the co-author tag and the radar can’t see the code, and researcher Hanqing Zhao told The Register the real number is “likely 5 to 10 times higher than what we currently detect.” Claude Code and GitHub Copilot dominate the count partly because they leave the clearest signatures, not necessarily because they write worse code.

What Organizations Report

  • Incidents: In Aikido Security’s 2026 survey of 450 CISOs, developers and AppSec engineers in Europe and the US, 20% said they had suffered a serious incident linked to AI-generated code, and another 49% reported a minor issue.
  • Codebase growth: Black Duck’s 2026 OSSRA report audited 947 codebases. Mean vulnerabilities per codebase more than doubled, from 280 to 581, while mean file counts grew 74%. 78% of codebases contained high-risk vulnerabilities and 44% critical ones. These are mostly open source dependency flaws rather than bugs in AI-written lines; Black Duck names AI-assisted development velocity as one driver, next to component growth and faster disclosure. Only 24% of organizations run comprehensive IP, license, security and quality evaluations on AI-generated code.
  • Security debt: Veracode’s 2026 State of Software Security report, covering 1.6 million applications, found that 82% of organizations carry security debt (up from 74%) and that flaws both highly severe and highly exploitable rose from 8.3% to 11.3% of findings. Its framing: “When the velocity of development in the AI era makes comprehensive security unattainable, the strategy must evolve.”

Why the Numbers Vary

A 25.7% vulnerable rate and an 11.8% secure rate are not contradictory. They come from different methods. AppSec Santa only counts a sample as vulnerable if a scanner flags it and a human confirms it, so anything all five scanners miss doesn’t count. Veracode writes prompts that tempt a specific CWE. SusVibes and BaxBench require the code to work and then attack it with real exploits. CSET used a formal model checker on C code. The consistent signal: without security-specific guidance, a quarter to a half of AI outputs carry an exploitable flaw on contained tasks, far more on realistic agent work, and recent model generations have not changed that.

What Is Actually Breaking: The Vulnerability Classes

The vulnerabilities are not random. They cluster where secure code depends on context the model doesn’t have.

Cross-Site Scripting and Log Injection

These are the worst performers in Veracode’s testing, with pass rates of 15% and 12%. Both need output encoding or sanitization that depends on where the data goes next. The model writes res.send("Hello " + name) because it works in the demo, and nothing in the prompt says that name comes from an attacker.

Broken Access Control

GitHub’s Octoverse 2025 report found that broken access control overtook injection as the most common CodeQL alert, flagged in more than 151,000 repositories, up 172% year over year. GitHub attributes part of that to “AI-generated scaffolds that skip critical auth checks”: endpoints that look complete and return the right data to anyone who asks. Scanners struggle here because a missing check has no pattern to match.

SSRF, Path Traversal and the Rest of the Injection Family

SQL injection has improved (83% pass rate at Veracode), but its cousins have not. In AppSec Santa’s triaged results, SSRF (CWE-918) was the most frequent confirmed finding with 32 instances, followed by path traversal (CWE-22/23) with 30. Injection-pattern weaknesses, counting SSRF and path traversal, made up 78 of 154 confirmed findings, roughly half. The model generates requests.get(user_url) or open(os.path.join(base, filename)) because that is what works. Allowlisting hosts, blocking internal IP ranges and normalizing paths take security reasoning the prompt never asked for.

Hardcoded Secrets and Client-Side Auth

Wiz Research (September 2025) kept finding the same four misconfigurations in vibe-coded apps: authentication logic that runs entirely in the browser, API keys shipped in client-side JavaScript, Supabase tables left open by permissive or disabled Row-Level Security, and internal apps deployed to the internet without authentication. Escape.tech scanned 1,400 vibe-coded apps and found 2,038 highly critical vulnerabilities, more than 400 leaked secrets and 175 instances of exposed personal data. The root cause is mundane: putting the key in the file makes the code run. Moving it behind a backend proxy requires understanding a deployment the model can’t see.

Cryptography Misconfiguration

Models mostly pick acceptable algorithms (87% pass on Veracode’s CWE-327 test), yet cryptography misconfiguration is the single largest category in Sonar’s evaluations of the newest frontier models: 104 of Claude Opus 5.5’s 229 vulnerabilities per million lines. Choosing AES is easy. Configuring it correctly is where generated code still slips.

Related: OWASP Top 10 for Agentic Applications: Every Risk Explained with Real Attacks

The Vibe Coding Amplifier

Vibe coding, prompting AI to generate code and shipping it without reading it, amplifies every class above. The risk is not only that AI writes flawed code. It is that the human review layer has been removed, and the people removing it feel safe doing so.

That second part has been measured. In a Stanford study published at ACM CCS 2023, participants with an AI assistant wrote significantly less secure code than those without one, and were more likely to believe their code was secure. Sonar’s 2026 survey shows the same gap at industry scale: 96% of developers don’t fully trust AI-generated code to be functionally correct, yet only 48% always check it before committing.

Iterating Makes It Worse

Asking the model to “improve” its own code is not a security review. A 2025 arXiv preprint ran 400 code samples through 40 rounds of AI-driven refinement and measured a 37.6% increase in critical vulnerabilities after just five iterations. It hasn’t been peer reviewed, but it fits the pattern: each round optimizes for the request in front of the model, not for the threat model behind it.

The Amazon Incidents

Amazon is the most cited enterprise example, and the facts are messier than the headlines. After a roughly six-hour outage in March 2026 that left shoppers unable to check out, CNBC reported that an internal document listed “GenAI-assisted changes” as a factor in a “trend of incidents” since the third quarter. That bullet was deleted before the meeting, and Amazon later said only one incident was related to AI and none involved AI-written code. The memo still called for additional review of “GenAI-assisted” production changes. Whatever the root cause, the response shows where Amazon thinks the risk sits.

Related: Amazon Kiro AI Outage: 6.3 Million Lost Orders and the 90-Day Code Safety Reset

Slopsquatting: A New Attack Vector

AI coding assistants invent package names. In a USENIX Security 2025 study of 576,000 code samples from 16 LLMs, the hallucinated package rate averaged at least 5.2% for commercial models and 21.7% for open-source models, producing 205,474 unique fake package names. Attackers can register those names on npm or PyPI and wait for the next developer, or the next agent, to install them. An agent that runs pip install on its own output closes that loop without any human looking.

What SAST Tools Miss (and Why That Matters)

AppSec Santa ran five open-source scanners (OpenGrep, Bandit, the ESLint security plugin, njsscan and CodeQL) over every sample and hand-triaged the results. 59.5% of confirmed vulnerabilities (91 of 153) were flagged by only one of the five tools. Rely on a single scanner and you will miss a large share of what AI introduces.

Part of that is coverage, and part is the nature of AI bugs. AI-generated code is syntactically clean, follows naming conventions and compiles without warnings. The flaws sit in data flow and missing logic (an absent authorization check, an unvalidated URL), which pattern-matching rules catch unevenly.

The vendors’ answer is to have models review models. Anthropic launched Claude Code Security in February 2026 and says Claude Opus 4.6 found more than 500 vulnerabilities in production open-source codebases. OpenAI followed in March with Codex Security, which first generates an editable threat model of the repository; during the beta it scanned more than 1.2 million commits in external repositories and reported 792 critical and 10,561 high-severity findings. Both sets of numbers are self-reported. Use these tools as an extra layer on top of deterministic scanners, not as a replacement.

Related: OpenAI Codex Security: The AI Agent That Found 10,561 Vulnerabilities in 30 Days

A Remediation Playbook That Fits Reality

Telling developers to stop using AI is not a strategy when it already writes 42% of committed code. Here is what the 2026 data supports.

Layer Your Scanners

Run at least two or three SAST tools on AI-generated code, plus an AI reviewer if the budget allows. With 59.5% of confirmed issues caught by just one of five tools in AppSec Santa’s data, single-tool coverage leaves real gaps. A workable baseline: CodeQL plus Semgrep or OpenGrep, plus a language-specific scanner (Bandit for Python, njsscan for Node.js).

Test the Model, Not Just the Code

Model choice moves the numbers. In Veracode’s data the best model passes 68% of security tasks while most cluster at 50-53%, and reasoning models beat non-reasoning ones by five points. Sonar’s data shows an upgrade can also make things worse. Treat a model or agent switch like a compiler upgrade: rerun your security checks before rolling it out. Don’t count on security prompts alone; the SusVibes authors found vulnerability hints didn’t solve the problem.

Mandate Human Review for Security-Critical Paths

Not all code needs the same review depth. Authentication, authorization, payment processing, data handling and API endpoints need human review regardless of who or what wrote them. Broken access control is now the most common CodeQL alert on GitHub, and a missing check is exactly what a reviewer can spot and a scanner often can’t.

Block Secrets at the Pipeline Level

Use tools like GitGuardian, TruffleHog or gitleaks as pre-commit hooks and CI gates. AI models will keep generating hardcoded secrets because that is what makes code run in the immediate context. The fix is infrastructure, not developer discipline.

Lock Down Dependencies

Slopsquatting turns hallucinated imports into a supply chain attack. Install only from an internal mirror or allowlist, run software composition analysis on every pull request, and treat any package that is brand new or has no history as suspect. Veracode’s own recommendation in its 2026 report is the same pair: software composition analysis plus a package firewall.

Keep the AI Fingerprints and Treat AI Output Like Third-Party Code

Georgia Tech can only attribute CVEs to AI because tools leave co-author tags in commits. Keep those trailers on. Black Duck found that only 24% of organizations evaluate AI-generated code comprehensively, and you can’t evaluate what you can’t find. Treat AI output like a third-party dependency: scan it, review its license implications, validate its security properties, and keep a record of which code was AI-generated for audits.

Know Your Regulatory Clock

The EU Cyber Resilience Act’s reporting obligations have applied since September 11, 2026, and its main obligations apply from December 11, 2027, according to the European Commission. The CRA makes no distinction between a vulnerability a human wrote and one a model wrote. If you ship products with digital elements in the EU, the AI-generated code in them is your liability.

Related: AI Agent Prompt Injection: The Attack That Breaks Every Guardrail

Frequently Asked Questions

How much AI-generated code contains security vulnerabilities?

In Veracode’s July 2026 GenAI Code Security Report, AI models produced secure code in only 56% of security-relevant coding tasks, so roughly 44% introduced a vulnerability, a rate that has barely changed since 2025. AppSec Santa confirmed vulnerabilities in 25.7% of 522 samples from six LLMs. Realistic agent tasks are worse: on the SusVibes benchmark the best coding agent produced functionally correct code 57% of the time but secure code only 11.8% of the time.

What are the most common vulnerabilities in AI-generated code?

Cross-site scripting and log injection fail most often in Veracode’s tests, with pass rates of 15% and 12%. Broken access control is now the most common CodeQL alert on GitHub, which GitHub partly ties to AI-generated scaffolds that skip auth checks. SSRF and path traversal led AppSec Santa’s confirmed findings. Hardcoded secrets, client-side authentication and cryptography misconfiguration round out the list.

Is vibe coding dangerous for enterprise software?

Yes, when the output ships without review. Escape.tech found 2,038 highly critical vulnerabilities and more than 400 leaked secrets across 1,400 vibe-coded apps, and Wiz Research found the same misconfigurations recurring in vibe-coded projects: client-side auth, exposed API keys, open Supabase tables and unauthenticated internal apps. Georgia Tech has traced 74 published CVEs to AI-authored commits, 35 of them in March 2026 alone, and its researchers estimate the real number is 5 to 10 times higher.

Which AI coding model is most secure?

In Veracode’s July 2026 snapshot, GPT-5.5 led with a 68% security pass rate, while six of 11 models scored between 50% and 53%. Reasoning models averaged 56% against 51% for non-reasoning models. Rankings are unstable between releases: Sonar measured 197 vulnerabilities per million lines of code for GPT-5.6 Sol versus 68 for GPT-5.5. No model produces consistently secure code, so all output needs scanning and review.

How should enterprises secure AI-generated code?

Layer several SAST tools, since 59.5% of confirmed AI code vulnerabilities in AppSec Santa’s study were caught by only one of five scanners. Require human review for authentication, authorization and payment code. Block secrets with pre-commit hooks. Lock down dependencies against hallucinated packages. Re-test security whenever you change models, keep AI co-author tags in commits, and treat AI output like third-party code.