AI in Cybersecurity: Arming Hackers and Defenders
AI is reshaping enterprise security on both sides of the fight — expanding attack surfaces while giving defenders tools that operate at machine speed.
45% of AI-generated code fails security tests. Developers know it. Vendors know it. Nobody's stopping.
LindleyLabs Editorial
2026-08-24
Veracode tested over 100 large language models across 80 coding tasks and found that 45% of AI-generated code samples introduce OWASP Top 10 vulnerabilities.
That's not a typo. Not a worst-case scenario. Not an edge case on a hard benchmark. Nearly half of the code your AI tool generates is insecure.
But here's what matters more: This pass rate has not improved across multiple testing cycles from 2025 through early 2026 despite vendor claims to the contrary.
The problem isn't new. The problem isn't getting better. The problem is that you're shipping it to production anyway because the productivity gain is too large to question.
AI-assisted developers produce commits at three to four times the rate of their peers but introduce security findings at 10x the rate, creating a security debt that accumulates faster than organizations can remediate it.
Let's be precise about what that means. Your team is shipping code 3-4x faster. And security issues 10x faster.
That's not a trade-off. That's a ticking bomb.
Forty-five percent of AI-generated samples failed security tests overall, with Java performing worst at a 72% failure rate. Java has a 72% failure rate. That means if you generate 10 code segments in Java with Copilot or Claude, more than 7 will contain security vulnerabilities.
The specific vulnerabilities are worse:
86% of generated samples failed to defend against cross-site scripting, and 88% failed on insecure cryptographic algorithms.
Cross-site scripting (XSS) and cryptographic failures. These aren't novel attacks. These are solved problems in security. But AI models consistently fail at them.
Why? Because XSS requires understanding context (where is this data going? is it user-controlled?). Cryptographic patterns require knowing threat models (what are you protecting against?). AI models don't reason about context or threat models. They pattern-match on training data.
The training data doesn't emphasize security. So the generated code doesn't emphasize security.
Vendors know about this. Despite vendor claims to the contrary says everything.
GitHub, Microsoft, OpenAI, Anthropic—all have internal data on security rates of generated code. They publish aggregate benchmarks (speed, accuracy, reasoning). They don't publish security vulnerability rates because the numbers look bad.
Organizations know about this too. But they're in a bind:
So everyone ships insecure code and hopes the automated scanners catch it before an attacker does.
Here's where the abstraction meets reality.
CVE-2025-48757 revealed that Lovable had been generating Supabase schemas without Row Level Security, exposing over 170 production applications. Moltbook leaked 1.5 million authentication tokens and 35,000 email addresses because API endpoints returned sensitive data without checking authorization. The Tea App exposed 72,000 user images and 1.1 million private messages through similar missing access controls.
These aren't theoretical vulnerabilities. These are real applications, built with AI coding tools, shipping to production with missing access controls.
Row Level Security in Supabase is foundational. It's not an edge case. It's the basic security boundary. An AI model that generates schema without RLS isn't making a subtle mistake. It's generating security architecture that doesn't work.
Escape.tech scanned 5,600 publicly accessible AI-coded applications and uncovered over 2,000 vulnerabilities, 400+ exposed secrets, and 175 instances of personally identifiable information sitting in the open.
Over 2,000 vulnerabilities in 5,600 applications. That's an average of 0.36 vulnerabilities per application. Nearly 1 in 3 apps had at least one serious issue.
And those are the applications someone built with AI and then put on the public internet. Most AI-generated code never gets scanned by Escape.tech. It just ships.
The root cause is simple: AI coding tools generate code that is functionally correct and contextually blind. They complete the prompt. Such tools do not reason about your threat model, your authentication architecture, your data access rules, or your regulatory obligations.
Your Cursor or Copilot doesn't know:
It knows: what pattern did I see in my training data that looks like this prompt?
So when you ask Claude to "build a user management system," it generates:
All syntactically correct. All contextually blind.
Developers under productivity pressure accept AI-generated code without deep review. And why wouldn't they? The code compiles. The tests pass. It ships. Then three months later, an attacker realizes there's no access control and extracts customer data.
GitHub and OpenAI have security features. Copilot Enterprise includes security scanning. Claude has safety rules. Amazon Q has built-in checks.
These are table stakes, not solutions. Mitigation requires human expert review—not better prompts.
You can't prompt-inject your way to secure code. You can't fine-tune away the structural problem. The problem is that models don't reason about threat models.
A scanner can catch some obvious patterns. SAST tools can find SQL injection if the code looks like obvious injection. But they can't catch subtle logic errors. "This endpoint returns user data without checking if you're authorized" isn't a syntax error. It's a logic error that requires understanding the data model and the permissions architecture.
If you're going to use AI tools for code generation, you need:
1. Authenticated Security Testing
NowSecure research found that authenticated testing detects 78% more sensitive data exposure per scan, because it exercises the code paths—token handling, API calls, session logic—that AI-generated code is most likely to get wrong.
Authenticated testing means running the code against your actual security architecture, not just static analysis.
2. Human Security Review
Not code review. Security review. Someone who understands threat modeling, authentication, authorization, data flows.
You need a security engineer to look at AI-generated code before it ships. Not a developer looking for style issues. Someone who thinks like an attacker.
3. OWASP-Based Testing
Focus on four vulnerability categories aligned with OWASP: SQL injection (CWE-89), cross-site scripting (CWE-80), log injection (CWE-117), and insecure cryptographic algorithms (CWE-327).
These four categories are where AI fails hardest. Build testing around them.
4. Data Classification
Know what data is sensitive. Know what regulatory constraints apply. Document your threat model. Feed that context to your developers (and your AI tools when possible).
AI can't infer context. But you can provide it.
# Example: Secure code generation workflow
# Instead of:
# "Build a user API endpoint"
# Do:
# "Build a user API endpoint that:
# - Returns only the authenticated user's data
# - Never includes password hashes in responses
# - Uses row-level security in the database
# - Logs access to sensitive fields
# - Is tested against OWASP A01:2021 Broken Access Control"
# Then:
# 1. Generate with Cursor/Copilot
# 2. Run authenticated security tests
# 3. Have security engineer review
# 4. Commit only after review
# 5. Run SAST scanner on merge
You gain 3-4x velocity. You introduce 10x more security issues.
That's the trade you're making.
For some applications, the math works out. If you're shipping a prototype or internal tool, security debt is acceptable. You can fix it later.
For production applications handling customer data, payment information, or regulated data, the math doesn't work.
Yet teams are shipping AI-generated code to production anyway because:
When 45% of AI-generated code is insecure, is the productivity gain worth it?
The joke that "the S in vibe coding stands for security" has become something closer to industry consensus.
That's the industry admitting the problem exists. Now the question is whether anyone will actually do something about it.
The answer, right now, is: almost nobody.
Security teams are starting to push back. But they're arguing against development teams, not against the fundamental economics of shipping fast. And the economics of shipping fast are winning.
45% of AI-generated code fails security tests. This isn't improving. Vendors know. Teams know. Nobody's stopping.
The vulnerability rate is highest for Java (72%), XSS (86%), and cryptography (88%). These are not hard problems. Models just don't generate secure patterns.
AI-assisted developers ship 3-4x more code and 10x more security issues. You're not gaining velocity. You're trading security debt for speed.
Real applications built with AI have real breaches. Lovable exposing 170 apps with no RLS. Moltbook leaking 1.5M tokens. Tea App exposing millions of messages. These aren't hypothetical.
Guardrails and scanners don't solve the problem. They catch obvious patterns. They don't catch logic errors. You need human security review.
Authenticated security testing catches 78% more vulnerabilities than static analysis, because it exercises the code paths AI generates incorrectly.
AI tools are blind to threat models. They pattern-match, not reason. You need to provide context explicitly.
The uncomfortable truth: most teams won't fix this. The cost is high, the benefit is invisible, and the pressure to ship is relentless.
Until there's a breach that costs enough to move the needle, teams will keep shipping insecure AI-generated code and hoping nobody exploits it first.
Tags: security, ai-generated-code, owasp, vulnerability, code-quality, development-tools
// RELATED ARTICLES
AI is reshaping enterprise security on both sides of the fight — expanding attack surfaces while giving defenders tools that operate at machine speed.
Auto mode is now the default for Claude Code. Your AI can execute, modify, and decide—without asking. You need to understand the tradeoff.
AI employees are real and fragile. Here's a practical engineering guide to building agentic workflows that survive production in 2026.