How secure is AI-generated code? What the research says in 2026
MilesUp · 2 December 2026
AI coding tools now write working code almost every time. Whether that code is secure is a separate question. University researchers, developer surveys and security companies give a consistent answer: often not, and not much better than a year ago.
- In a peer-reviewed Stanford study, developers with an AI assistant wrote less secure code than those without one, and were more likely to believe their code was secure.
- Georgia Tech traced 35 published vulnerabilities to AI coding tools in March 2026 alone, more than in all of 2025.
- In Veracode's 2026 lab tests, 44% of AI code-generation tasks introduced a security vulnerability, almost unchanged from 45% in 2025.
- Developers know it: in Stack Overflow's 2025 survey, 46% distrust the accuracy of AI tools and only 3% highly trust it.
How we picked these sources
We group the sources by who produced them, and we say who each one is. Peer-reviewed and university research has no product to sell. Developer surveys show what practitioners see day to day. Security companies publish useful data, but they sell tools that address the problems they report, so we list them last and label them.
Peer-reviewed research
Stanford: developers with AI wrote less secure code and trusted it more
Who: Perry, Srivastava, Kumar and Boneh, Stanford University · Published: ACM CCS 2023
In what the authors call the first large-scale user study of its kind, they compared participants who had an AI assistant (based on OpenAI's codex-davinci-002 model) with participants who did not.
- Participants with the AI assistant wrote significantly less secure code than those without it.
- They were also more likely to believe they had written secure code.
The second finding is the important one for teams shipping with AI: the risk is not only in the code, but in the false confidence that comes with it.
NYU: about 40% of Copilot's code was vulnerable
Who: Pearce, Ahmad, Tan, Dolan-Gavitt and Karri, New York University · Published: IEEE Symposium on Security and Privacy 2022
The researchers asked GitHub Copilot to complete 89 security-relevant scenarios, producing 1,689 programs. About 40% were vulnerable. It was one of the first rigorous studies of AI-written code, and later work, including the 2026 results below, keeps finding the same pattern.
University tracking
Georgia Tech: vulnerabilities from AI tools are now showing up in public code
Who: Systems Software & Security Lab, School of Cybersecurity and Privacy, Georgia Tech · Published: 9 April 2026
Georgia Tech's Vibe Security Radar scans public security advisories and traces each vulnerability back through the code history to see whether an AI coding tool wrote it, using signals such as co-author tags and bot emails in commits.
security advisories scanned
confirmed cases so far: 14 critical, 25 high
cases in the second half of 2025, over seven months
in March 2026 alone, more than all of 2025 combined
The radar only sees code that still carries an AI tool's signature, so it misses tools that leave no trace. The researchers say Claude Code and Copilot make up most detections partly because they leave the clearest signatures. Treat these numbers as a floor.
Developer surveys
Google DORA 2025: more AI, less stable delivery
Who: DORA, Google Cloud's long-running software delivery research program · Published: 23 September 2025 · Google also sells AI coding tools
technology professionals surveyed worldwide
use AI at work
have little or no trust in AI-generated code
DORA found that AI now helps teams ship faster, but that AI adoption still has a negative relationship with software delivery stability. More changes, shipped faster, lead to more failures unless testing and review keep up.
Stack Overflow 2025: developers don't trust AI's accuracy
Who: Stack Overflow's annual Developer Survey · Published: 2025, over 33,000 responses on the AI questions
use or plan to use AI tools, up from 76%
distrust the accuracy of AI tools; 33% trust it
highly trust AI output
say their top frustration is AI code that is "almost right, but not quite"
Security vendor research
Veracode: lab tests across 100+ models
Who: Veracode, an application security testing company · Published: July 2025 and July 2026
Veracode gives AI models coding tasks that can each be solved securely or insecurely, and checks the output with static analysis. The tasks cover SQL injection, weak cryptography, cross-site scripting (XSS) and log injection, in Java, Python, C# and JavaScript.
2025 report
- 80 coding tasks across more than 100 large language models. AI-generated code introduced a security flaw in 45% of tests.
- Java was the weakest language, failing more than 70% of the time. Python, C# and JavaScript failed 38–45% of the time.
- Models failed to defend against cross-site scripting in 86% of cases and log injection in 88%.
2026 report
of AI code-generation tasks introduced a risky vulnerability
average security pass rate, vs 55% in the first report
of generated code is now syntactically correct
- The best model in the snapshot (GPT-5.5) passed 68% of security tests. More than half of the tested models scored 50–53%.
- Pass rates by weakness: cryptographic algorithms 87%, SQL injection 83%, cross-site scripting 15%, log injection 12%.
The code compiles and runs, and models are good at avoiding SQL injection, but they still rarely escape output correctly for the web or clean what they write to logs.
CodeRabbit: AI vs human pull requests
Who: CodeRabbit, an AI code review company · Published: 17 December 2025
CodeRabbit compared 470 open-source GitHub pull requests: 320 co-authored by AI and 150 written by humans only.
issues per AI co-authored PR, vs 6.45 for human-only
more issues overall in AI PRs
the high end for security issues
- Critical and major findings were ~1.4–1.7× higher. Logic and correctness issues were 75% more common, and error-handling gaps nearly 2× more common.
- The most prominent security patterns were improper password handling and insecure object references.
CodeRabbit inferred AI authorship from signals in each PR and says it cannot guarantee that every PR labelled human-only had no AI help.
Escape.tech: live vibe-coded apps on the internet
Who: Escape, an API security testing company · Published: October 2025, updated June 2026
Escape scanned real, publicly deployed apps built with vibe-coding platforms, mostly Lovable, plus Create.xyz, Base44, Vibe Studio and Bolt.new.
public vibe-coded apps analysed
high-impact vulnerabilities
exposed secrets, such as API keys
instances of exposed personal data, including medical records
Escape calls these a lower-bound estimate from a single snapshot. Its summary page uses an earlier count, 2,038 critical vulnerabilities across 1.4K apps.
What this means if your app was built with AI
- Working is not the same as safe. Every source above finds code that runs while carrying real flaws, and the Stanford study shows people trust it more than they should.
- The same gaps keep showing up: output escaping (XSS), logging, access control, password handling, exposed secrets and open database rules.
- Newer models are not fixing this on their own. Veracode's average pass rate barely moved in a year, and Georgia Tech's count is rising, not falling.
These studies use different methods and samples, so read them as direction, not as a forecast for any single app. The only way to know where your app stands is to check its code.
Sources
- Perry et al., "Do Users Write More Insecure Code with AI Assistants?", ACM CCS 2023: https://arxiv.org/abs/2211.03622 (published version: https://doi.org/10.1145/3576915.3623157)
- Pearce et al., "Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions", IEEE S&P 2022: https://arxiv.org/abs/2108.09293
- Georgia Tech College of Computing, "Bad Vibes: AI-Generated Code is Vulnerable, Researchers Warn" (9 April 2026): https://www.cc.gatech.edu/news/bad-vibes-ai-generated-code-vulnerable-researchers-warn
- Vibe Security Radar dashboard (linked from the Georgia Tech article): https://vibe-radar-ten.vercel.app/
- Google Cloud, "Announcing the 2025 DORA Report: State of AI-Assisted Software Development" (23 September 2025): https://cloud.google.com/blog/products/ai-machine-learning/announcing-the-2025-dora-report
- Google, "How are developers using AI? Inside our 2025 DORA report" (23 September 2025): https://blog.google/technology/developers/dora-report-2025/
- Stack Overflow Developer Survey 2025, AI section: https://survey.stackoverflow.co/2025/ai
- Veracode, 2025 GenAI Code Security Report press release (30 July 2025): https://www.veracode.com/press-release/ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/
- Veracode, 2026 GenAI Code Security Report (28 July 2026): https://www.veracode.com/blog/2026-genai-code-security-report-ai-risk/
- CodeRabbit, State of AI vs Human Code Generation Report (17 December 2025): https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report
- Escape.tech, methodology (29 October 2025, updated 17 June 2026): https://escape.tech/blog/methodology-how-we-discovered-vulnerabilities-apps-built-with-vibe-coding/
- Escape.tech, state of security of vibe-coded apps: https://escape.tech/state-of-security-of-vibe-coded-apps
Figures checked against each source on 2 December 2026.