Vibe Coding Security Risks: 20 Vulnerabilities Found in AI-Built Apps
The security holes that keep turning up when an app was built by prompting an AI tool and accepting what it wrote: what each one looks like, how it shows up before anyone audits the code, and what closing it involves.
Vibe coding means building software by describing it to an AI tool and accepting the code it writes, judged by whether the app works rather than by reading what was generated. It is a fast way to get an MVP in front of users, and plenty of real products started that way.
The trouble is that "it works" and "it is safe" are tested differently. An AI assistant optimises for the screen in front of you doing what you asked. It rarely asks who else can call that endpoint, what happens when the input is hostile, or where a key ends up once the app is deployed. Those questions only get answered when someone asks them on purpose.
The vulnerabilities below are the ones that recur in apps built this way, grouped by where they live. Each says what it looks like in the code, how it tends to show up for a founder before anyone audits anything, and what fixing it involves. Treat it as a checklist to work through, not a verdict: most vibe-coded apps have a few of these, and all of them can be fixed without starting over.
Exposed secrets and keys
AI tools wire up third-party services quickly, and the quickest place to put a key is wherever the code that needs it happens to be. That is often somewhere the whole internet can read.
01Secret API keys shipped to the browser
- What it looks like
- Keys for an AI model provider, payment processor or email service read in frontend code, or stored in environment variables the framework bundles into the client (such as ones prefixed NEXT_PUBLIC_ or VITE_).
- How you notice it
- Usage on the provider account that nobody on the team generated, a surprise bill, or an email from the provider saying a key was found in public.
- What fixing it involves
- Move every call that needs a secret onto the server, rotate each key that was ever in client code, and keep only keys designed to be public (publishable or anonymous keys) in the frontend.
02Credentials committed to the repository
- What it looks like
- A .env file, config file or test script with real passwords and tokens checked into git, sometimes deleted later but still in the history.
- How you notice it
- Anyone who has ever had access to the repository, including former freelancers and any public fork, can still read production credentials.
- What fixing it involves
- Rotate everything that was committed, add the files to .gitignore, and turn on secret scanning so a new key is caught before it is pushed. Deleting the file does not remove it from history; rotating does.
03The database admin key used where the public key belongs
- What it looks like
- A backend-as-a-service app (Supabase, Firebase and similar) where the frontend uses the service-role or admin credential because the public key "didn't work" when the AI hit a permission error.
- How you notice it
- Everything works, including for anyone who copies the key out of the page source: they can read and change every table.
- What fixing it involves
- Put the public key back in the client, use the admin key only in server code, and write the access rules the public key needs instead of bypassing them.
Broken access control
The most common and most serious group. Generated code usually checks that someone is logged in; it far less often checks that they are allowed to see the thing they asked for.
04Database open to anyone with the public key
- What it looks like
- Row-level security switched off on Supabase tables, Firebase rules left in test mode, or policies written as "allow all" to make an error go away.
- How you notice it
- Nothing visible in the app. Someone outside can list every user, order or message by calling the database directly with the key the frontend already exposes.
- What fixing it involves
- Turn row-level security or security rules on for every table, write a policy per table that limits rows to their owner or team, and test it by querying as a signed-out user and as a different account.
Read more: No-Code and AI-Generated MVP Limitations at Production Scale
05Permissions enforced only by hiding buttons
- What it looks like
- Admin and paid features are hidden in the interface for users who shouldn't have them, but the API routes behind them don't check the user's role or plan.
- How you notice it
- Free users reach paid features, or ordinary users perform admin actions, by calling the endpoint directly with browser tools.
- What fixing it involves
- Check role and plan on the server for every route that changes data or unlocks a feature, in one shared layer, and treat the UI as a convenience rather than a control.
06Records fetched by ID with no ownership check
- What it looks like
- Routes like /api/invoices/123 or /api/projects/456 that load whatever ID is requested without checking it belongs to the signed-in account.
- How you notice it
- Changing a number in the URL or request shows another customer's data. It is often found by a curious user rather than by the team.
- What fixing it involves
- Scope every query by the current user or organisation, use non-guessable IDs where it helps, and add tests that try to read another account's records.
07Debug, admin and test routes left open in production
- What it looks like
- Endpoints the AI generated to seed data, reset accounts, impersonate users or inspect state, still deployed and reachable without authentication.
- How you notice it
- Odd data appears or disappears, or an old admin page turns up in search results or server logs being called by strangers.
- What fixing it involves
- List every route the app exposes, delete the ones nobody needs, and put the rest behind authentication and an admin role check.
Untrusted input
Generated code tends to assume input looks like the example it was shown. Attackers send everything else.
08Database queries built by joining strings
- What it looks like
- SQL assembled with template literals or string concatenation from request parameters, often in a quick search or filter feature.
- How you notice it
- Searches break on an apostrophe in a name. The same opening lets an attacker read or change data the query was never meant to touch.
- What fixing it involves
- Use parameterised queries or the ORM's query builder everywhere, and search the codebase for raw query calls that take user input.
09User content rendered as raw HTML
- What it looks like
- Comments, profile fields or AI responses inserted with dangerouslySetInnerHTML, v-html or innerHTML to keep formatting.
- How you notice it
- Strange pop-ups or redirects for some users, or session tokens stolen through a script someone saved in a text field.
- What fixing it involves
- Render text as text by default, and where HTML or Markdown is genuinely needed, pass it through a maintained sanitiser with an allowlist.
10File uploads accepted without checks
- What it looks like
- Uploads stored with the user's file name and type, no size limit, in a publicly readable bucket, sometimes served from the app's own domain.
- How you notice it
- Storage costs climb, private documents are reachable by anyone with the link, or someone uses the app to host files it should never serve.
- What fixing it involves
- Limit size and type on the server, rename files, keep private uploads in private storage behind short-lived signed URLs, and serve user files from a separate domain.
11AI features open to prompt injection
- What it looks like
- The app passes user-supplied text, documents or web pages to a language model that can call tools, read other records or send messages on the user's behalf.
- How you notice it
- The assistant reveals its instructions or other users' data, or takes actions nobody asked for, after reading content someone crafted for it.
- What fixing it involves
- Give the model the narrowest tools and data the feature needs, run its actions with the requesting user's permissions, and require confirmation before anything irreversible.
Authentication and sessions
Login is easy to generate and hard to get right. When an AI writes it from scratch, the parts that are missing are the parts you only need under attack.
12Home-made login written by the AI
- What it looks like
- Custom sign-up, password storage and session code instead of a maintained library or provider, sometimes with passwords hashed with a fast general-purpose hash, or not at all.
- How you notice it
- It works in every demo. A larger customer's security questionnaire, or a request for SSO or two-factor login, exposes how much is missing.
- What fixing it involves
- Move to a maintained authentication library or provider, and migrate existing users so they can keep signing in without a forced reset for everyone at once.
Read more: Authentication and Session Management in a Production Rebuild
13Tokens that never expire, stored where scripts can read them
- What it looks like
- Long-lived JWTs or session tokens kept in localStorage, with no expiry, no refresh flow and no way to revoke them on logout or password change.
- How you notice it
- Logging out doesn't really log anyone out, and a single leaked token gives access indefinitely.
- What fixing it involves
- Use short-lived sessions in secure, HTTP-only cookies, with server-side revocation on logout and password change.
14No rate limiting on login, sign-up or paid endpoints
- What it looks like
- Login, password reset, sign-up and AI-backed endpoints accept unlimited requests from the same address or account.
- How you notice it
- Floods of fake sign-ups, password-guessing attempts in the logs, or an AI provider bill driven by one account calling an endpoint in a loop.
- What fixing it involves
- Add rate limits per IP and per account on authentication and expensive routes, plus usage caps on anything that spends money per call.
15Password reset flows that can be reused or guessed
- What it looks like
- Reset links with short or predictable tokens that never expire, still work after use, or are generated from the email address or a timestamp.
- How you notice it
- Users report password changes they didn't make, or old reset emails in someone's inbox still open their account weeks later.
- What fixing it involves
- Use long random single-use tokens that expire within a short window, invalidate existing sessions after a reset, and show the same message whether or not an email has an account.
Dependencies, integrations and configuration
Risks that sit around the app's own code: the packages it pulls in, the services it trusts, and the settings it was deployed with.
16Packages the AI suggested without anyone checking them
- What it looks like
- Dependencies installed because an assistant named them, including little-known packages, misspelled names and outdated versions from its training data.
- How you notice it
- Security warnings pile up in the repository. In the worst case a package name the AI invented has since been registered by someone else with malicious code in it.
- What fixing it involves
- Review every direct dependency for who maintains it and whether it is needed, pin versions with a lockfile, and run automated vulnerability checks on each pull request.
Read more: Dependency Management Debt in Production Node and Python Applications
17Payment and webhook calls trusted without verification
- What it looks like
- A webhook endpoint that marks orders paid or upgrades accounts based on whatever JSON arrives, without checking the provider's signature.
- How you notice it
- Accounts upgraded with no matching payment in the provider's dashboard.
- What fixing it involves
- Verify every webhook signature with the provider's library, confirm amounts and status against the provider's API, and handle repeated deliveries safely.
18Development settings left on in production
- What it looks like
- Debug mode on, detailed error pages and stack traces shown to users, CORS set to allow any origin, and default security headers switched off to fix a local error.
- How you notice it
- Error pages show file paths, queries or environment details, and other sites can call the API with a signed-in user's browser.
- What fixing it involves
- Separate development and production configuration, show generic error pages to users while logging details privately, restrict CORS to your own domains and restore the framework's security headers.
Operations and the AI tools themselves
Even a well-written app is hard to defend if nobody can see what happens to it, and the coding tools themselves need limits.
19No record of who did what
- What it looks like
- No audit log of sign-ins, permission changes, exports or deletions, and application logs that are either missing or never read.
- How you notice it
- After a suspected breach nobody can say what was accessed, whose data was involved or when it started, which is exactly what customers and regulators will ask.
- What fixing it involves
- Log security-relevant events with the user and time, keep them somewhere the app itself can't erase, and alert on unusual patterns.
Read more: Incident Response Setup for Early-Stage Production Apps
20AI coding agents with production access
- What it looks like
- An agent in the editor or terminal running with production database credentials, deploy rights or cloud admin keys so it can "fix things directly."
- How you notice it
- A command meant for a local copy runs against live data, or a destructive migration lands without anyone approving it.
- What fixing it involves
- Give agents development and staging credentials only, require human review before anything reaches production, and keep backups you have actually restored.
Read more: When AI-Assisted Development Requires More Senior Engineering Oversight
What to do if your app was vibe coded
- 1
Rotate keys first
Every secret that has ever been in frontend code, a committed file or a chat with an AI tool should be treated as exposed. Rotating them is cheap, fast and closes the most direct way in.
- 2
Test your data from the outside
Sign out, or sign in as a second test account, and try to read the first account's data through the API and the database's public endpoint. Whatever you can reach, an attacker can too.
- 3
Check the server enforces every rule
Walk through each route that touches money, personal data or permissions and confirm the check happens on the server, not just in the interface. Fix those before anything else on this list.
- 4
Get a review before the stakes rise
Before raising money, signing a larger customer or handling sensitive data, have an engineer who did not generate the code review it. Most findings are fixed in place; a rebuild is only worth weighing where the access model itself is wrong.
- 5
Keep a person in the loop
Keep using AI tools, but review what they produce against a written standard, especially changes to authentication, access rules and anything that handles payments.
Further reading
- GuideTechnical Debt Examples: 20 Patterns Found in Startup Codebases
What technical debt actually looks like in an MVP, a freelancer handoff or an AI-generated app, how each kind shows up before anyone reads the code, and what paying it down involves.
- GuideCode Smells: 20 Examples and How to Fix Them
The surface signs that a codebase is getting harder to change, named the way engineers name them: what each smell looks like, how it shows up before anyone reads the code, and what refactoring it involves.
- Technical Debt Created by AI-Generated Code in Production
AI code piles up unchosen debt that reviewers rarely catch.
- Code Review Standards for AI-Assisted Pull Requests
Why AI-written code needs a different review standard.
- What Kind of Engineer Actually Fixes an AI-Generated Codebase
Look for engineers who can map, own, and restructure code nobody explained.
- Rebuilding a Cursor-Generated App Without Losing the Momentum That Made It Worth Saving
Audit first, then keep, refactor, or replace each component.
- Strangler Pattern Applied to AI-Generated Codebases
Incrementally replace AI-generated code without stopping feature work.
- Production Readiness Checklist for Funded Startups
Funded startups often learn production readiness too late, costing time and deals.