Early studies say yes, with caveats. One found about 40% of Copilot programs generated for security relevant scenarios were vulnerable, and another found assisted users wrote less secure code and felt more sure of it. Both tested older tools, so use them as a warning about habits, not as a score for today's models.
Study one: vulnerable suggestions
Researchers from NYU and collaborators prompted GitHub Copilot with 89 scenarios tied to high risk weakness types, including entries from MITRE's Top 25. Across 1,689 generated programs, they found approximately 40% to be vulnerable.
What that tells you: a model trained on large amounts of public code can reproduce the mistakes in that code. What it does not tell you: how current tools perform, or how often a developer would accept the insecure suggestion in real work.
Study two: users and confidence
A Stanford study ran a user study on security related coding tasks across several languages. Participants with an assistant built on a codex model wrote significantly less secure code than the control group. They also tended to rate their own code as more secure than it was.
The same paper reported a useful detail: people who trusted the assistant less and reworked their prompts produced fewer vulnerabilities.
How to read these in 2026
Three honest limits apply.
- Models changed. Both studies used tools from the early period of AI coding. Newer models may do better or worse on any given weakness class. Measure your own tools on your own code.
- Tasks were controlled. Lab scenarios are not your codebase. Real projects have linters, reviews and tests that catch some problems.
- The human effect is the durable finding. Overconfidence does not depend on the model version.
What to do with this
Treat assistant output as untrusted input from a fast, confident junior colleague. Run the same scanners and reviews you run on human code. Add checks where the studies point: injection, hard-coded secrets, missing authorization.
A static scan on every pull request is cheap evidence. If you want a baseline, the free scan at gold.safeguard.sh/scan shows what is already in a repository.
Myth versus fact
- Myth: AI code is always insecure. Fact: The studies found elevated risk in specific scenarios, not a universal failure.
- Myth: If it passes tests it is safe. Fact: Tests rarely cover abuse cases unless someone writes them.
- Myth: Human code is the safe baseline. Fact: The models learned from human code, flaws included.
What to measure yourself
Pick a handful of recurring tasks in your codebase, such as adding an endpoint or parsing a file. Have your assistant do each several times, then run your scanner and a reviewer over the results. Count findings by type. A small internal sample tells you more about your tools and prompts than any published rate, and it can be repeated after every model or tool update.
Quick check
Is the 40% figure a rate for all AI generated code today?
No. It came from a specific set of 89 scenarios and one tool at the time of the study. It should not be quoted as a current industry rate.
Sources
- Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions (arXiv)
- Do Users Write More Insecure Code with AI Assistants? (arXiv)
Last reviewed: 19 October 2026.