Why AI code needs checking

Vibe coding is fast. For attackers too.

Describe what you want and AI builds the app. No reading the code, no review. It works, right up until someone starts trying to break it. Here is what research says about the security of AI-written code, and what has already happened in the wild.

“Fully give in to the vibes, embrace exponentials, and forget that the code even exists.”

Andrej Karpathy, February 2025 · coined the term vibe coding
1 · Code quality
45%

Nearly every other task ends with a security flaw

Veracode gave more than 100 language models 80 coding tasks, each with both a secure and an insecure way to solve it. In 45% of cases the model picked the insecure one and introduced an OWASP Top 10 vulnerability.

Newer models write more syntactically correct code, but according to the report their security is not improving. Java did worst, along with defenses against XSS and log injection.

How often AI failed at security
Share of tasks where the model generated vulnerable code
By flaw type
Log injection CWE-117 88%
Cross-site scripting CWE-80 86%
By language
Java 70+%
Python, C#, JavaScript range 38–45%
Overall
All tasks 45%
Source: Veracode, 2025 GenAI Code Security Report, July 2025.
2 · Type of flaws

AI fixes the typos. And opens holes in the architecture.

Apiiro analyzed tens of thousands of repositories at Fortune 50 companies. Developers with an AI assistant made 3 to 4 times more commits, but packed them into fewer, larger pull requests that are harder to review.

Small mistakes went down. What went up is the kind a regular linter won't catch: privilege escalation paths and design flaws. By June 2025, AI-generated code was adding more than 10,000 new security findings per month in these companies, ten times more than in December 2024.

Change in flaws with an AI assistant
Compared with developers not using AI, in percent
DecreasedIncreased
Syntax errors −76%
Logic bugs −60%
Design flaws +153%
Privilege escalation +322%
Source: Apiiro, 4x Velocity, 10x Vulnerabilities, September 2025. Vendor research, not a peer-reviewed study.
3 · The human factor

With AI we write worse code and feel surer about it

A Stanford study gave 47 programmers security-related tasks. Those with an AI assistant wrote significantly less secure code, especially for encryption and SQL queries. They were also more likely to believe their code was secure.

Developers don't fully trust AI either. In the Stack Overflow survey, 84% use or plan to use it, yet only a third trust its accuracy. The top complaint: code that is “almost right, but not quite.” Exactly the kind of code that passes the tests and fails under attack.

Use of and trust in AI tools
Share of developers, Stack Overflow Developer Survey 2025
Use or plan to use AI 84%
Deal with “almost right” code 66%
Distrust AI accuracy 46%
Trust AI accuracy 33%
Sources: Stack Overflow Developer Survey 2025 · Perry et al., Stanford: Do Users Write More Insecure Code with AI Assistants?
4 · Specific risks

Keys, packages and open databases

Three mistakes that keep coming back in vibe-coded apps. None of them shows up just because the app “works.”

Leaked API keys

With Copilot 6.4%
GitHub average 4.6%

Repositories where Copilot helped leaked a key or password more often than average. In 2024 alone, 23.8 million secrets ended up on public GitHub.

Made-up packages

Open-source models 21.7%
All models 19.7%
Commercial models 5.2%

AI invents library names, often the same ones again and again. An attacker registers them with malicious code and waits for someone to install them. This is called slopsquatting.

Axis 0–100%. 576,000 code samples, 205,474 invented names. Spracklen et al., USENIX Security 2025

Open databases

1 square ≈ 16 apps · 170 of 1,645 open

Apps from Lovable's public showcase had Row Level Security switched off. Anyone with the public key could read and overwrite tables with users, payments or API keys. No login needed.

CVE-2025-48757, CVSS 9.3. Lovable disputes responsibility; the setting is up to each app's creator.
5 · What already happened

2025 in short

In a few months, vibe coding went from a joke tweet to word of the year. The first public incidents came along with it.

  1. Karpathy names vibe coding

    Programming where you only describe what you want and never read the code.

  2. A quarter of Y Combinator startups have 95% AI-written code

    According to YC, true for 25% of companies in the Winter 2025 batch.

    CNBC / NBC
  3. 170 Lovable apps with an open database

    Vulnerability CVE-2025-48757, rated 9.3 out of 10.

    NVD
  4. Replit's AI agent deletes a production database

    During a code freeze it wiped records of more than 1,200 executives and companies, then claimed recovery was impossible. A backup existed.

    eWeek
  5. Veracode: 45% of AI code with a vulnerability

    More than 100 models tested on 80 tasks.

  6. Apiiro: +322% privilege escalation paths

    Analysis of repositories at Fortune 50 companies.

  7. “Vibe coding” becomes word of the year

    Named by Collins Dictionary.

    CNN
6 · What to do

Don't ban vibe coding. Check it.

AI saves you weeks of work. All it takes is a check before every release that doesn't assume everything is fine.

  1. Never ship code nobody has checked. Neither a person nor a tool.

  2. Keys belong in environment variables, not in code. And find the ones that already leaked.

  3. Verify every package the AI added. Does it exist? Is it current? Any known CVEs?

  4. Verify data access. Who can read and write to the database without logging in?

  5. Scan regularly. New library vulnerabilities appear every week.

RiskExampleWhat catches it in Greenlit Code
Leaked keys and passwordsStripe key hardcoded
Gitleaks
Injection and XSSSQL query built from strings
SemgrepESLint securityPMD
Vulnerable dependencieslodash 4.17.15 with a CVE
TrivyOSV
Misconfigured infrastructureDocker container running as root
Checkov
SQL problemsRisky, inconsistent queries
SQLFluff
Logic and access rightsMissing permission check
AI code reviewRoot cause
greenlitcode.dev

Ship AI code with a clear conscience.

Upload your project and in a few minutes you know what to fix before the next deploy.

Scan my code