Skip to content
OverKnightsOverKnights home

Is AI-generated code secure? What the 2026 research says

Two large studies and a public CVE tracker agree: AI coding tools still add known vulnerabilities at a steady rate. The numbers and what they mean.

OverKnightsPublished 3 min read
Short answer

About 44% of AI code generation tasks in Veracode's tests introduced a risky vulnerability. IOActive found 31.6% of AI-generated samples fully exploitable, across 27 models and tools. Bigger models were not meaningfully safer.

  • About 44% of AI code generation tasks in Veracode's tests introduced a risky vulnerability.
  • IOActive found 31.6% of AI-generated samples fully exploitable, across 27 models and tools.
  • Bigger models were not meaningfully safer.
  • Confirmed CVEs from AI-written code are climbing, and the researchers say the count is a lower bound.

The pass rate is flat

Veracode runs the same security tests against each new generation of models. The average pass rate is now 56%, against 55% in its first report.1

44% of AI code generation tasks introduced a risky security vulnerability in Veracode's tests. The pass rate has barely moved since the first report.1

  • Model size made little difference: large models averaged 53%, medium and small models 51%.1
  • Cross-site scripting checks passed only 15% of the time, log injection 12%.1
  • In organisations that use AI coding tools, AI now writes roughly half of committed code.1

A second study agrees

IOActive tested 27 models and coding tools with 730 prompts across 27 languages and 219 vulnerability categories. The prompts never mentioned security, which is how most developers actually prompt.2

  • Average security score across all models: 59%.2
  • 31.6% of samples were fully exploitable.2
  • Infrastructure code was worst: Dockerfiles, Terraform and CI pipelines showed vulnerability rates of 70% to 97%.2
  • Authentication, rate limiting and cryptography failed across nearly every model.2
  • Asking the model to write secure code was often useless. Security-aware system prompts and wrapper tools added up to 25 points.2

It is already showing up as CVEs

Georgia Tech's SSLab tracks published advisories where AI-written code contributed to the flaw. From May 2025 to March 2026 the team confirmed 74 such CVEs, 14 of them critical.3

  • Claude Code was linked to 49 (11 critical) and GitHub Copilot to 15 (2 critical).3
  • The team analysed 43,849 advisories. For most of them, AI involvement simply could not be detected either way.3
  • The lead researcher estimates the real number is likely 5 to 10 times higher.3

Note: Read tool-by-tool counts with care. They depend on how often each tool leaves a detectable trace and how widely it is used. They are not a safety ranking.

What this means for a team of 2 to 15 engineers

  • Treat AI output as untrusted input and review it before it ships, as IOActive recommends.2
  • Expect the same weaknesses to repeat: authorisation checks, input validation, secrets and infrastructure config.
  • Security prompts help at the margin. They do not replace review.
  • Review has to keep pace with output. That means every day, not once a quarter.

Sources

  1. Veracode, 2026 GenAI Code Security Report: AI is writing more of your code but security hasn't caught up, Jul 2026. Vendor research. Generated code tested with Veracode's own SAST tool.
  2. IOActive, The Security Gap in AI-Generated Code, May 2026. 27 models and tools, 730 prompts, 27 languages, about 20,000 samples.
  3. The Register, Using AI to code does not mean your code is more secure, Mar 2026. Reports the Georgia Tech SSLab tracker of CVEs attributed to AI-written code.
OverKnights

Want to know what your repo would show?

Send one public repo. We reply with three verified findings and the prompts to fix them. No call needed.