All vulnerabilities
MEDIUMAI/LLM

AI-COPILOT-INSECURE-CODE-2021

GitHub Copilot · GitHub Copilot

Summary

NYU researchers conducted the 'Asleep at the Keyboard?' study assessing the security of GitHub Copilot's code suggestions across scenarios derived from MITRE's Top 25 CWE weaknesses. Across 89 scenarios that produced 1,689 generated programs, approximately 40% were found to contain security vulnerabilities. The finding established that AI code-completion tools frequently emit insecure code and should be paired with security-aware tooling and human review.

How to avoid it in your code

  • Treat AI completions as untrusted drafts requiring mandatory human security review.
  • Run SAST and dependency scanning on all AI-authored code in CI before merge.
  • Never auto-merge or ship code-completion output without testing and review.
  • Add security linters and CWE-targeted checks for the Top 25 weakness classes.
  • Pair completions with secure-by-default frameworks and templates.

References

Related vulnerabilities

All AI/LLM →