AI coding assistants speed up boilerplate, but they also autocomplete insecure patterns. Security researchers have measured how often GitHub Copilot suggests vulnerable code across common tasks.

What the research found

Empirical studies evaluated Copilot suggestions against known vulnerability classes (e.g. SQL injection, cross-site scripting, path traversal, weak crypto). The results vary by language and prompt, but a consistent finding is: a meaningful fraction of suggestions are insecure if taken as-is.

StudyScopeKey finding
Pearce et al. (2022)89 security-sensitive scenarios in C, C++, Java, PythonCopilot produced insecure code in ~40% of cases
Asare et al. (2023)Comparison to human developers on security tasksCopilot did not introduce new vulnerabilities beyond those humans also wrote, but also did not reliably fix them
Sandoval et al. (2023)User study in a realistic coding taskParticipants with access to LLMs introduced similar or slightly more vulnerabilities than control group in that setup

The takeaway: Copilot is not inherently secure or insecure, but it reflects insecure patterns from training data. Uncritical acceptance is the main risk.

Practical mitigations

Suggestion flow with guardrails Copilot suggests code Security review (human + tools) Only merge if safe Never auto-accept across trust boundaries treat as suggestion, not source of truth

VERDICT

Copilot can suggest insecure code. Developers must review suggestions with security in mind and rely on automated checks.

Sources