My team used AI coding assistants (Cursor with Claude, Copilot) to speed up feature development. The AI generated code that compiled clean, passed linters, and looked correct at first glance. But in production, we discovered critical security vulnerabilities: improper input sanitization, missing authentication checks, and race conditions the AI had glossed over. When I asked the AI to review its own code, it confidently stated everything was fine. A security audit later found 23 vulnerabilities across the 4,000 lines of AI-generated code — 17 of which the AI had introduced.
1 Answer
The AI-generated code described here contains serious security flaws that reflect well-documented limitations of current AI coding tools. A 2026 Georgia Tech study found that AI code assistants tend to repeat the same mistake patterns across projects — meaning a single vulnerability class can appear in thousands of codebases. The study's lead researcher, Dr. Zhao, warned that attackers who identify one AI-generated bug pattern can scan for it across countless repositories. The experience matches what cybersecurity firm Veracode found in their 2026 analysis: AI-generated code is 2.5x more likely to contain security vulnerabilities than human-written code, particularly around input validation, authentication, and proper error handling. AI models optimize for code that looks correct and compiles, not code that is secure. METR and GitClear data from the same period shows 41% of all code written globally in 2025 was AI-generated. While this accelerates development, it also amplifies risk — every AI-introduced bug pattern gets multiplied across thousands of codebases simultaneously. The core issue: AI coding tools lack true understanding of security context. They generate code based on patterns in training data, not on an understanding of your specific threat model, compliance requirements, or deployment environment. As Dr. Zhao put it: "Find one pattern in one AI codebase, you can scan for it across thousands of repositories." The recommended approach security experts now call 'Vibe & Verify' — use AI for boilerplate and routine tasks, but have human experts review every line of security-critical code through a dedicated security audit process.
Your answer
Sign in to verify this AI response.
Don't trust us — or the AI. Ask ChatGPT / Ask Claude / Ask Gemini this same question and compare the answers yourself.
More from this topic
Amazon's retail website took four high-severity incidents in a single week, including a six-hour meltdown that locked shoppers out of checkout, account information and product pricing. Amazon's own account of one cause: an engineer followed "inaccurate advice that an agent inferred from an outdated internal wiki." Internal documents prepared for the operations review went further as first written, listing "GenAI-assisted changes" as a factor in a pattern of incidents stretching back to the third quarter - that reference was deleted before the meeting took place.
Ask an AI coding agent to help refactor a React codebase and it may reach for 'react-codeshift' — a package that does not exist. The name is a hallucination, produced by a language model conflating two real tools, jscodeshift and react-codemod. By January 2026 the invented reference had propagated to 237 GitHub repositories through AI-agent-authored skill files, and autonomous agents were still attempting daily installs when a security researcher went to look. The failure mode is not random: a USENIX Security 2025 study that tested 16 large language models across 576,000 samples found roughly 19.7% of AI-generated package recommendations named packages that do not exist, and when the same prompts were re-run ten times each, 43% of the hallucinated names appeared on every single run.
Three AI coding agents - Claude Code running Sonnet 4.6, OpenAI Codex on GPT 5.2 and Google Gemini on 2.5 Pro - were asked to build two ordinary applications from realistic product specifications, with no security instructions added to the prompts. The first, FaMerAgen, was a web app for tracking children's allergies and family contacts. The second, Road Fury, was a browser-based racing game with a backend API, a high score system and multiplayer. Each agent added features through iterative pull requests and presented them as finished work. Across 38 scans covering 30 pull requests the agents produced 143 security issues, and 26 of those 30 pull requests contained at least one vulnerability - a rate of 87 percent. Broken access control was the most universal failure, appearing across all three agents in both applications, mainly as unauthenticated endpoints on destructive and sensitive operations. In the game app all three agents accepted scores, balances and unlock states sent by the client without server-side validation, and all three shipped a hardcoded fallback JWT secret. Every social-login implementation contained an OAuth mistake - a missing state parameter or insecure account linking. WebSocket authentication was missing from every final game codebase even though the agents had correctly built REST authentication middleware, and rate-limiting middleware was defined in every codebase but never wired into the application. The code compiled and ran.