Is AI-Generated Code Security Keeping Up With AI-Assisted Attackers?
AI coding tools give developers and attackers the same kind of speed, and the security gap comes from where that speed lands. Developers ship more code, and Veracode’s October 2026 testing still found vulnerable code in 38% of AI coding tasks. Attackers use similar models to find and exploit weaknesses faster. AI-generated code security therefore depends on testing that scales with output.
AI adoption in software teams is usually measured in productivity, such as faster releases and more output per engineer. The same models also change what happens on the attacker’s side of every release. This piece is for engineering leaders, AppSec teams, platform owners, and CISOs deciding how security testing should change now that both sides work with the same class of tools.

Table of Contents
What the Security Asymmetry Means
The security asymmetry is the gap between how fast software changes and how fast it is verified, measured against how fast attackers can probe it. When building and attacking both accelerate while verification stays on its old schedule, the window in which a weakness is live and untested gets wider.
AI widens that window from both ends. It speeds up writing code, and it speeds up finding flaws in code. AI-generated code security is the work of closing that window before an attacker reaches it.
How AI Coding Tools Change the Volume and Shape of Code
AI coding tools are now part of everyday development. The Stack Overflow 2025 Developer Survey found that 84% of respondents use or plan to use AI tools, and 51% of professional developers use them daily. Veracode reports that AI now generates roughly half of all committed code.
Security has improved more slowly than capability. The October 2026 edition of Veracode’s GenAI Code Security Report measured an average security pass rate of 62% across 18 models, up from 56% in July and the first meaningful gain since the series began in 2025. Most of that gain came from cross-site scripting. Log injection held at 13%, Java at 31%, and the weakest models still passed only 44 to 50% of security tasks. Coding-specialized models averaged 51%, below general-purpose models at 54%, so a newer or more specialized model does not settle AI-generated code security on its own.
The amount of code each reviewer sees has grown as well. Apiiro’s analysis of repositories at Fortune 50 enterprises found that AI-assisted developers produced three to four times more code and packed it into fewer, larger pull requests, which makes each review harder.
The shape of the code changes too. The table below sets out four patterns that affect review and testing once AI coding tools become standard.
| Pattern | What happens in practice | Security implication |
|---|---|---|
| Scaffolded endpoints | A prompt generates a full set of create, read, update, and delete routes in minutes | Each route needs its own ownership check, and generated routes often share a template that skips it |
| Fluent, plausible code | Generated code reads cleanly and passes linting | Clean-looking code tends to get lighter scrutiny, so logic gaps can survive review |
| Larger pull requests | More code arrives in fewer, bigger changes | Review depth per line drops as volume rises |
| Dependency sprawl | Coding agents add packages to solve problems quickly | More third-party code enters the build with less scrutiny |
What Vibe Coding Security Means for Small Teams
Vibe coding is the practice of building software by describing what you want to an AI model and accepting much of the generated code with light review. Most professional developers still keep it out of their day jobs: in the Stack Overflow 2025 survey, nearly 77% said vibe coding is not part of their professional work. For founders and small teams shipping early products, the habit is harder to avoid, which makes vibe coding security a practical concern.
The exposure sits in the review step. When a developer ships code they did not write and may not have read line by line, every route depends on whether the model chose safe defaults, and Veracode’s results show that it often does not. For a small team, vibe coding security comes down to four habits:
- Write security rules into the prompt and the coding assistant’s configuration, including an ownership check on every data access.
- Read every generated route that touches login, payments, roles, or customer data before it ships.
- Run authenticated tests against the running application after each significant release, because generated authorization logic can look correct and still fail at runtime.
- Retest each fix, since a regenerated file can quietly undo an earlier correction.
How Attackers Use the Same Tools
The capabilities that help a developer write an API also help an attacker map one, and public reporting now documents AI carrying much of the operational work in real intrusions.
In November 2025, Anthropic disclosed a state-sponsored campaign in which the attackers built an attack framework around Claude Code. According to Anthropic, AI executed roughly 80 to 90% of tactical operations against about 30 targets, from reconnaissance through vulnerability discovery and exploitation, while human operators stepped in at a handful of decision points. In July 2026, Sysdig documented JadePuffer, the first agentic ransomware operation on record, which entered through CVE-2025-3248, a Langflow flaw that already had a fix.
Exploitation is now also the most common way into a breach. The 2026 Verizon DBIR found that vulnerability exploitation opened 31% of breaches, overtaking credential abuse for the first time, while organizations fully remediated only 26% of the critical vulnerabilities on CISA’s Known Exploited Vulnerabilities list, down from 38% a year earlier.
The same report gives a measured view of where attackers apply AI today. For AI-generated code security, the practical effects look like this:
1. Threat actors used AI assistance across a median of 15 techniques per campaign, and phishing accounted for 44% of the AI-assisted initial access techniques Verizon identified.
2. Most AI-assisted malware development reused well-known techniques, and fewer than 2.5% of observations involved less common methods, so known classes of flaw remain the main exposure.
3. Targeting runs across many systems at once. In a campaign documented by Palo Alto Networks’ Unit 42, a DeepSeek-driven agent found 84 exposed Langflow instances and pulled a public exploit after a single instruction.
4. Failed attempts are corrected in seconds. JadePuffer fixed a failed account-creation step and confirmed it worked 31 seconds later.
Recommended read: If you or your team are planning a dependency audit after an AI-assisted build sprint, this article on how to check whether the Shai Hulud npm compromise reached you is a great place to start.
Where the Asymmetry Creates the Most Risk
The asymmetry is uneven. Existing tools still cover some classes of weakness well, while others grow faster than any team can review by hand.
1. Authorization and Business Logic: AI coding tools write functional code, and the rules about who may do what are specific to each application. A generated endpoint can return the right invoice to the right user in testing and still return any invoice to anyone who changes an ID. In a March 2026 study by DryRun Security, broken access control appeared in code from all three coding agents tested. Pattern-based scanners rarely flag it, because every request is well formed. Broken access control remains first in the OWASP Top 10:2025, and an AI-generated code security program should weight it accordingly.
2. Review Capacity: Code review was designed for human output rates. When pull requests grow in size and frequency, reviewers sample instead of reading, and subtle logic errors are the first to slip through.
3. Testing Cadence: An annual pentest assumes the application stays roughly the same between tests. With AI-assisted development, authentication flows, roles, and APIs can change several times in a quarter. Our article on penetration testing frequency for AI-assisted development [LINK PENDING] covers how to set a cadence that keeps up.
4. Supply Chain Exposure: Agents that install packages, call external APIs, and copy snippets widen the set of code nobody on the team wrote. Supply chain compromises such as the Axios incident show how quickly a trusted package can turn hostile.

Recommended read: If you or your team are planning an access control review of a plugin or API, this article on CVE-2026-10753, a broken access control flaw CredShields found in Google’s Site Kit, is a great place to start.
How Secure Code Review Changes for AI-Generated Code
Secure code review still has a place in AI-generated code security, with a narrower focus. Reviewers cannot read every line at the rate AI coding tools produce it, so review effort should go where a missed flaw costs the most:
- Prioritize pull requests that change authentication, sessions, roles, payments, or tenant boundaries.
- Check each new data access for an ownership or permission check, since generated routes often share a template that skips it.
- Review every new dependency and the reason the agent added it.
- Give fluent, idiomatic code the same scrutiny as rough code.
- Record which flaws review caught, so the team learns where its models tend to fail.
Whether authorization actually holds once real users and roles reach the running application is a question for authenticated testing, which the next section covers.
What Secure AI-Assisted Development Looks Like
Teams that handle AI-generated code security well treat AI output as high-volume code that still needs proof at runtime. The controls below work together, and each covers a different layer.
| Control | What it catches | Where it needs support |
|---|---|---|
| Security requirements in prompts and coding rules | Insecure defaults before code exists | Cannot verify the code that was produced |
| Static analysis (SAST) and dependency scanning | Known insecure patterns and vulnerable packages | Application-specific authorization and workflow logic |
| Pipeline gates through DevSecOps integration | Regressions on every merge | Behavior that only appears with real users, roles, and data |
| Authenticated agentic pentesting | Exploitable flaws, including business logic and chained weaknesses, proven against the running application | Needs scope, credentials, and a test environment that mirrors production |
| Retesting after every fix | Incomplete patches and regressions | Depends on findings that carry reproduction steps |
Agentic pentesting is the layer that scales with code output. AI agents explore the running application, attempt exploitation, test workflows and business logic, and report only the findings they could reproduce, so the volume of testing can rise with the volume of releases.
Recommended read: If you or your team are planning an incident runbook for a compromised package, this article on the Axios 1.14.1 supply chain attack and remediation is a great place to start.
AI-Generated Code Security Checklist
Use this checklist to see whether verification in your program keeps pace with AI-assisted output.
- Coding assistants are configured with security rules, including object-level authorization on every data access.
- Pull requests that touch authentication, roles, payments, or tenant boundaries require a focused security review.
- SAST and dependency scanning run on every merge, with clear owners for findings.
- Authenticated penetration testing runs on each significant release of a high-impact application.
- Findings include proof of exploitation and reproduction steps before they reach engineering.
- Every fix is retested, and the retest result is recorded.
- New packages added by agents are reviewed against an approved list.
Recommended read: If you or your team are planning how automated and manual testing should split the work, this article on manual versus automated penetration testing is a great place to start.
Frequently Asked Questions (FAQs) About AI-Generated Code Security in 2026
These answers cover the questions engineering and security leaders ask most often about AI-generated code security.
Is AI-generated code secure?
AI-generated code usually compiles and runs, and a large share of it still fails security tests. Veracode’s October 2026 testing found vulnerable code in 38% of AI coding tasks across 18 models, with most of the recent improvement coming from cross-site scripting.
Which vulnerabilities are most common in AI-generated code?
In Veracode’s October 2026 testing, log injection and cross-site scripting had the lowest pass rates, at 13% and 18%. Broken access control is also common: in a 2026 DryRun Security study, it appeared in code from all three coding agents tested.
Are attackers using AI to hack applications?
Yes. Anthropic documented a 2025 campaign in which AI executed roughly 80 to 90% of tactical operations, and the 2026 Verizon DBIR found threat actors using AI assistance across a median of 15 techniques per campaign.
Can SAST tools catch insecure AI-generated code?
SAST catches many known insecure patterns and belongs in every pipeline. It cannot confirm whether authorization and business logic hold up at runtime, which requires authenticated testing against the running application.
How should security testing change for teams using AI coding tools?
Testing should scale with release volume. Keep SAST and dependency scanning on every merge, add authenticated agentic pentesting on significant releases, and retest every fix so verification keeps pace with output.
What is vibe coding security?
Vibe coding security is the practice of securing software built largely by prompting an AI model and accepting its code with light review. It relies on security rules in prompts, focused review of sensitive routes, authenticated testing of the running application, and a retest of every fix.
How should secure code review change for AI-generated code?
Secure code review should concentrate on pull requests that touch authentication, roles, payments, and tenant boundaries, and check every new data access for an ownership check. Authenticated testing then confirms whether that authorization holds at runtime.
What is agentic pentesting?
Agentic pentesting is penetration testing carried out by AI agents. They explore an application, attempt exploitation, test business logic, chain weaknesses, and report the findings they validated, with evidence and remediation guidance.
Are AI-assisted attacks increasing?
Public reporting points that way. Data Anthropic shared with Verizon for the 2026 DBIR shows the volume of AI-assisted text in malicious emails has doubled, and vulnerability exploitation became the leading initial access vector, at 31% of breaches.
Where to Start With AI-Generated Code Security
Start with the application your team changed most this quarter and list the routes AI coding tools generated or rewrote. Those routes are where authorization gaps are most likely to sit, and where a test against the running application tells you the most.
CredShields One tests that layer directly. It signs in with an account for each role, attempts exploitation across those routes, and reports only the findings it verified, with evidence and remediation guidance attached. When engineering ships a fix, the retest can run straight away, so verification keeps pace with your release cadence. For customers or regulators that require independent third-party testing, CredShields also provides human-led penetration testing.