Nexus Void Research
AI Coding Assistant, Vulnerabilities, AppSec, Vibe Coding, Secrets, Dependencies
Can AI Coding Assistants Introduce Vulnerabilities? 1 in 3
Yes. About 1 in 3 AI-generated code samples has a flaw, across 23 studies. The 7 ways Claude Code, Cursor and Copilot add bugs, and how to catch each one.
Yes, AI coding assistants can introduce vulnerabilities, and they do so at a measurable rate. In an academic study of GitHub Copilot, about 40% of generated programs in security-relevant scenarios contained a vulnerability (Pearce et al.). Below are the seven ways it happens and how to catch each one.
Last updated 31 October 2026.
An AI coding assistant introduces vulnerabilities in a handful of predictable ways: insecure code patterns, hardcoded secrets, vulnerable or malicious dependencies, over-permissioned access, missing authorization checks, unsafe handling of untrusted input, and outdated or deprecated APIs. The pattern behind all of them is the same, an assistant optimizes for code that works, not code that is safe, and it produces that code faster than a small team can review it. Knowing the specific failure modes is the first step to catching them.
Nexus Void's review of 23 studies and 48,185 CVEs found roughly one in three AI-generated code samples contains a vulnerability, so these are not rare edge cases but a baseline rate every team using Claude Code, Cursor, or Codex should plan around.
The 7 ways AI coding assistants introduce vulnerabilities
Each has a straightforward fix, but only if something is actually checking for it on every change.
Insecure code patterns. Assistants reproduce common but unsafe idioms: string-built SQL, weak hashing, disabled TLS verification. Fix: static analysis on every commit.
Hardcoded secrets. Keys and tokens get written straight into generated files and configs (see how to find hardcoded secrets). Fix: secret scanning before code is committed.
Vulnerable dependencies. Suggested packages may be outdated, abandoned, malicious typosquats, or names the model invented (research on package hallucination; see how to detect malicious npm packages). Fix: dependency checks against known-vulnerable and malicious package data.
Over-permissioned access. Broad IAM roles and file or shell scopes because they make the code run. Fix: least privilege and scope review.
Missing authorization checks. Endpoints that authenticate a user but never verify what that user may do (missing authorization ranks fourth in the 2025 CWE Top 25). Fix: explicit authz tests.
Unsafe input and output handling. Trusting user or model output that is later executed or rendered. Fix: validation and output encoding.
Outdated or deprecated APIs. Assistants trained on older data suggest APIs with known issues. Fix: keep dependencies and API usage current.
Why do assistants keep making these mistakes?
Because they generate the statistically likely code, and a great deal of public code contains exactly these flaws. An assistant is not reasoning about your threat model; it is completing a pattern. It will also confidently produce insecure code with no warning, which is more dangerous than an obvious error because it looks finished and reasonable.
How do you catch all seven without slowing the team?
Automate the checks and put them in the path to production, because doing seven manual review passes on every AI-generated change does not scale for a small team. The practical model is continuous scanning for code flaws, secrets, and dependency issues, paired with automatic fixes so findings get resolved instead of queued.
That find-and-fix model is what ARGUS provides: it reviews every pull request for insecure code, secrets, vulnerable and malicious dependencies and infrastructure misconfigurations, checks packages before an AI agent installs them, and opens the smallest fix as a pull request, verified with a build and a re-scan, for a person to merge. See a sample ARGUS review. For the bigger picture by tool, see the security risks of Claude Code, Cursor and Codex.
Frequently asked questions
Which of the seven is most common? Insecure code patterns and hardcoded secrets show up most, with vulnerable dependencies close behind.
Can I just prompt the assistant to write secure code? It helps a little, but it is not reliable. The assistant may still produce insecure code, so independent scanning is still needed.
Do these apply to all assistants? Yes. Claude Code, Cursor, Copilot, and Codex all share these failure modes because they share the same underlying approach.
Our read
The seven failure modes are old problems arriving at new speed. That is the whole story of AI coding assistant vulnerabilities: nothing here is novel to security teams, but the volume and velocity are, and manual review was already the bottleneck before assistants multiplied the output. Automate the checks, fix as you find, and the assistant becomes a productivity win instead of a risk multiplier.
Vulnerability-rate figure from Nexus Void analysis of 23 studies and 48,185 CVEs; weakness classes per OWASP Top 10 and NIST SSDF.
Related: Vibe coding security and How to secure AI-generated code.
DATA SOURCES
OWASP Top 10: https://owasp.org/www-project-top-ten/ ; Nexus Void analysis (securing AI-generated code): https://nexusvoidai.com/research-analysis/securing-ai-generated-code-evidence-review ; NIST SSDF: https://csrc.nist.gov/projects/ssdf