Generative artificial intelligence (GenAI) has rapidly changed software development by allowing developers to generate functional code faster and at greater scale.
However, Veracode’s 2026 GenAI Code Security Report reveals a disconnect between improvements in AI coding capability and improvements in security.
Although modern large language models (LLMs) can produce syntactically correct code almost perfectly, their ability to produce secure code has barely improved over the past year.
This finding suggests that organizations adopting AI-assisted development must treat generated code as untrusted until it has undergone appropriate security testing.
Key takeaways of the Veracode report
- AI-generated code security remains largely stagnant, with Veracode reporting an average security pass rate of approximately 56% despite near perfect syntax performance.
- More advanced AI models are not necessarily more secure, as coding-specific models performed similarly to general purpose models and larger models showed little security advantage.
- Security performance varies significantly by AI model, with GPT-5.5 leading at 68% while six of the 11 models tested scored between 50% and 53%.
- Programming language and vulnerability type affect AI code security, with Python outperforming Java and results varying widely across vulnerability categories.
- AI-generated code still requires security testing and remediation before organizations deploy it into production environments.
Veracode 2026 AI code security findings at a glance
| Finding | 2026 result | What it means |
| Overall AI code security pass rate | 56% | Nearly 44% of code security tests failed |
| Syntax pass rate | ~100% | Functional code does not necessarily mean secure code |
| Best-performing model | GPT-5.5: 68% | Even the leader failed nearly one-third of security tasks |
| Coding vs. general-purpose models | 51% vs. 52% | Coding specialization did not provide a security advantage |
| Large vs. medium vs. small models | 53% / 51% / 51% | Larger model size did not substantially improve security |
| Reasoning vs. non-reasoning models | 56% vs. 51% | Reasoning models showed a modest security advantage |
| Python vs. Java | 63% vs. 30% | Security performance varied substantially by language |
Veracode finds AI-generated code security remains stuck at 56%
Veracode evaluated more than 100 AI models across four testing snapshots using standardized code-generation tasks involving multiple programming languages and vulnerability categories.
The report found that the average security pass rate in 2026 was approximately 56%.
Roughly 44% of code-generation tasks produced code with a detectable OWASP Top 10 vulnerability.
By comparison, models generated compilable code at nearly a 100% syntax pass rate.
Functional AI-generated code is not always secure
The gap demonstrates an important distinction between functional and secure software: Code that compiles and operates as expected is not necessarily safe for deployment.
Veracode’s findings show that while LLMs have nearly mastered syntax, their security performance has remained relatively flat across recent generations.
AI code security varies by model
Individual model performance also varies considerably.
OpenAI’s GPT-5.5 achieved the highest security pass rate in Veracode’s Summer 2026 leaderboard at 68%, followed by GPT-5.3-Codex and Anthropic’s Claude-Opus-4.8 at 62%.
However, six of the 11 models evaluated for the leaderboard scored between 50% and 53%.
Larger AI models do not guarantee more secure code
One important finding is that models designed specifically for coding are not necessarily more secure.
Coding-specialized models averaged a 51% security pass rate compared with 52% for general-purpose models.
This suggests that optimizing an AI system to generate code efficiently does not automatically improve its ability to recognize or avoid security vulnerabilities.
Reasoning matters more than AI model size for security
Increasing model size also provides little security advantage.
Large models with more than 100 billion parameters averaged a 53% security pass rate, while medium and small models both averaged approximately 51%.
Reasoning models performed somewhat better, averaging 56% compared with 51% for non-reasoning models.
Veracode suggests that the additional reasoning process may function similarly to an internal code review process.
AI code security varies by programming language
Security performance also differs substantially according to programming language and vulnerability type.
Python achieved a 63% security pass rate, while Java remained the weakest language at approximately 30%, although Java showed a consistent upward trend.
The report also found substantial differences across Common Weakness Enumeration (CWE) categories.
Models performed relatively well against SQL injection (SQLi) and cryptographic algorithm vulnerabilities, with mean pass rates of approximately 83% and 87%.
In contrast, cross-site scripting (XSS) and log injection produced mean pass rates of only about 15% and 12%.
How to reduce security risks in AI-generated code
The findings demonstrate that AI-generated code should not be assumed secure simply because it is functional or produced by an advanced model.
As AI-generated code becomes more common in software development, organizations may face greater exposure if code-generation speed exceeds their ability to identify and remediate vulnerabilities.
- Embed security controls into AI and agentic workflows to enforce secure coding standards and prevent unsafe actions.
- Use software composition analysis (SCA) and package security controls to detect or block vulnerable, malicious, and noncompliant dependencies.
- Require human review of high-risk AI-generated code rather than relying solely on an AI model’s ability to produce functional code.
- Integrate DevSecOps tools into CI/CD pipelines to automate security checks such as static and dynamic application security testing, secrets scanning, and vulnerability remediation.
- Establish AI coding governance and access controls that define approved models, acceptable use, secure coding requirements, and least-privilege access.
- Test incident response plans and use attack simulation tools with scenarios around AI-generated code vulnerabilities.
Collectively, these measures can help organizations reduce risk from AI-generated code.
Bottom line
Ultimately, Veracode’s 2026 findings show that while AI can accelerate software development, speed and functionality do not guarantee security.
Organizations should treat AI-generated code like other unreviewed code, requiring security testing, remediation, and validation before it reaches production.
Securing AI-generated code is only one part of the equation, as organizations must also address vulnerabilities and risks across the broader software supply chain.





