Skip to content
IFAI

Research

Devs using AI assistants write buggier code, study finds

Published Reach 34

Stanford researchers found that developers using AI coding tools like GitHub Copilot actually produce more security vulnerabilities, especially around string encryption and SQL injection. Worse, the AI-assisted devs were far more confident that their flawed code was secure, hiding risks beneath false comfort.

Devs using AI assistants write buggier code, study finds
Image: artificialintelligence-news.com

If you've been leaning heavily on AI coding tools like GitHub Copilot to breeze through your pull requests, you might want to slow down and double-check your commits.

A new paper from Stanford University computer scientists, titled 'Do Users Write More Insecure Code with AI Assistants?', reveals a troubling paradox: developers working with AI assistants often write buggier, less secure code—while simultaneously feeling more confident that their code is rock solid.

More vulnerabilities, more false confidence

The researchers put 47 developers through a series of programming tasks. One group was allowed to use an AI assistant, while the control group had to code the old-fashioned way.

For one task, participants were asked to write two Python functions to encrypt and decrypt a string using a symmetric key. Among developers working without AI, 79% delivered a correct implementation. For those using an AI assistant, that number dropped to 67%.

Even worse was the security posture. The researchers found that the AI-assisted group was significantly more likely to produce insecure implementations. They frequently relied on trivial ciphers, like basic substitution ciphers, and routinely skipped authenticity checks on returned values. Security vulnerabilities were especially pronounced in areas like string encryption and SQL injection.

Yet, despite writing objectively worse code, the assisted developers genuinely believed they were doing better. The study noted that participants with AI access were much more likely to believe they had written secure code than those without it.

As one developer in the study jokingly put it, they prefer the AI assistant because 'it’s like Stack Overflow but better, because it never tells you that your question was dumb.'

The lurking legal trap

Security bugs aren't the only risk developers face when trusting AI code suggestions.

Just last month, OpenAI and Microsoft were hit with a class-action lawsuit over GitHub Copilot. The tool was trained on billions of lines of public code, and the suit alleges it scrapes open-source work without providing required attribution.

That means developers who blindly accept Copilot's suggestions could unknowingly be pasting copyright-infringing snippets directly into proprietary codebases.

As Bradley M. Kuhn of the Software Freedom Conservancy pointed out earlier this year, Copilot basically leaves open-source compliance as an exercise for the end user—meaning developers and companies bear growing legal liability as these tools become more prevalent.

Why it matters

This study highlights the single most dangerous failure mode of generative AI in engineering: plausible incompetence. When AI hallucinates a non-working function, you catch it instantly because tests fail. But when it writes syntactically clean, runnable code that relies on broken crypto or leaves SQL injection vectors wide open, it slips right past code review.

We think AI assistants are still worth using for boilerplate, regex, and scaffolding, but relying on them for security-sensitive logic is playing with fire. The productivity bump is real, but it clearly induces a psychological blind spot where developers turn off their critical thinking.

For engineering leaders, this means code review policies need an immediate overhaul. You cannot treat AI-assisted code like human-written code. Until model makers integrate rigorous security linting and automated provenance tracking into the generation pipeline, developers are trading short-term velocity for long-term technical and legal debt.

Sources (1)

  1. [1]
    artificialintelligence-news.com(opens in a new tab)Originalartificialintelligence-news.com

Topic trackerStanford study on AI coding tool risks

Every story on this topic, newest first.

  1. AI coding tools make developers write buggier code, study finds
  2. Devs using AI assistants write buggier code, study findsThis story

Best of AI, daily