Short answer

Code generated by artificial intelligence (AI) must be treated as potentially insecure until it has undergone the appropriate checks. Even if the code correctly performs its intended tasks, that does not guarantee its security.

Before introducing such code into a production system, it must undergo expert code review, automated security testing and analysis of the libraries and dependencies it uses for known vulnerabilities.

AI can significantly accelerate software development. However, increasing the volume of generated code without proper oversight can increase the risk of vulnerabilities. Responsibility for the quality, security and reliability of the software product must therefore remain with qualified engineers.

Recent news about critical vulnerabilities in PHP and Node.js discovered with AI caused a stir online. But there is another side to this story that receives much less attention: the security of code generated by that same AI.

Veracode’s latest report for 2026 revealed some interesting figures:

  1. 44% of code generation tasks produced code with detected vulnerabilities.
  2. In 2023, models passed 55% of security checks. In 2026 — 56%.

For SQL injection, models passed 83% of checks. For XSS, however, they passed just 15%.

Despite progress in code generation capabilities, these Veracode results do not demonstrate an improvement in code security.

Why can AI find vulnerabilities and create them at the same time?

Because the ability to find a vulnerability and the ability to guarantee that you will not introduce one are two different tasks.

An LLM may know what secure code looks like, but that does not mean every piece of code it generates will reflect that knowledge.

This brings us to the most concerning issue: scale.

Building a complete, high-quality software product still requires engineering knowledge, experience, and time. Yet new technologies let someone who does not understand the basic principles of software development use AI to build an application, connect a database, authentication, and a payment system, and put it all online. The number of these products keeps growing.

Programmers make mistakes too.

You might say that programmers also make mistakes and that not all of them fully understand security, and you would be absolutely right. Security was an issue even before the widespread use of generative AI, but the software development industry has a certain hierarchy of specialists. In experienced development teams, tasks involving data security and potentially vulnerable components of any system are always assigned to more experienced specialists, while large companies even have a dedicated Security Engineer role. There is also one key point to consider: a person cannot write as much code in a short period of time as generative artificial intelligence can. This brings us back to the problem of scale that I wrote about above, because a simple rule applies: more uncontrolled code means a high likelihood of more potentially dangerous areas.

What happens next?

Meanwhile, open AI models, autonomous agents, and automated vulnerability discovery tools continue to evolve. These technologies are available to potential attackers as well as cybersecurity professionals. This means that vulnerabilities can now be found and exploited at an incredibly high speed, creating new threats.

Are we opening Pandora’s box?

Personal, financial, and other sensitive data are particularly at risk. For companies operating in the EU, this also creates risks of GDPR violations and significant financial consequences.

What should we do about it?

I fully agree with Veracode’s advice: treat AI-generated code as potentially unsafe and always verify it before integrating it into the main project. This means checking both the generated code itself and its dependencies for vulnerabilities. The test results confirm that quickly generating working code does not guarantee its security, because standard functional tests may fail to uncover hidden threats.

Conclusions

Code review, automated security checks, dependency audits, and using LLMs as an additional analysis tool are the basic minimum for live projects built with GenAI that are accessible over the internet.

Updated:

Was this article useful?

3 likes
← Back to all articles