Security

Is Your AI-Built App Secure? 10 Common Vulnerabilities
(and How to Fix Them)

By Manoj Sainiยท 17 Oct 2026ยท Pilani, India

You described your idea to an AI tool, and a few hours later you had a working app. Login works. The dashboard looks great. Users are signing up. But is your AI-built app secure?

Here is the uncomfortable part: "it works" and "it's secure" are two very different things. AI coding tools are trained to make your request work. Unless you explicitly ask, they rarely think about who else might be calling your database, reading your API keys or guessing another user's ID.

The numbers back this up. Veracode's 2025 GenAI Code Security Report tested more than 100 AI models on 80 coding tasks and found security flaws in 45% of cases. Its 2026 follow-up found the average security pass rate stuck at roughly 56%, even as the same models got much better at writing code that runs. When security firm Escape.tech scanned 5,600 publicly deployed vibe-coded apps, it found over 2,000 high-impact vulnerabilities, more than 400 exposed secrets and 175 cases of exposed personal data.

This guide walks through the 10 vulnerabilities that show up again and again in AI-built apps: what each one looks like, why AI tools create it, and how to fix it before someone else finds it.

Who this is for: founders, product owners and developers who built (or are building) an app with Lovable, Bolt, Replit, Cursor, Claude Code, v0 or similar tools and want to launch it safely.

Why AI-Built Apps Have a Security Problem

AI coding tools are not careless. They are optimised for a different goal. When you say "build a booking app with user accounts," the model focuses on making bookings and accounts work. Security requirements you never mentioned, such as access rules, rate limits and headers, are simply missing from the input.

Three patterns make this worse:

  1. Only the happy path gets tested. You click through the app as a normal user. Attackers do not behave like normal users.
  2. Fix-it loops add code, not checks. Pasting an error back to the AI and accepting the fix keeps the app running but rarely revisits earlier security decisions.
  3. Platform defaults are trusted blindly. Many builders assume the platform "handles security." Often it handles hosting, not your data rules.

The good news: almost every issue below is a known, well-understood problem with a known fix.

The 10 Most Common Vulnerabilities in AI-Built Apps

1. Missing Database Access Rules (Supabase RLS & Firebase Rules)

What it looks like: Your app talks to Supabase or Firebase directly from the browser, but the database has no rules about who can read or write which rows.

Why it matters: This is one of the most damaging issues in AI-built apps, because it exposes everything at once. It is exactly what happened in CVE-2025-48757: a researcher scanned 1,645 apps from Lovable's public showcase and found about 170 apps (303 endpoints) where anyone with the public "anon" key could read or modify data, because Row Level Security had never been enabled.

How to fix it:

  • Enable Row Level Security on every Supabase table, with no exceptions.
  • Write policies scoped to the logged-in user (for example, a user can only read rows where user_id = auth.uid()).
  • For Firebase, replace any allow read, write: if true rules with rules that check authentication and ownership.
  • Test as an attacker: open the browser console, use the public key, and try to read another user's data.

2. API Keys and Secrets Exposed in Frontend Code

What it looks like: A Stripe secret key, OpenAI key or Supabase service_role key sits inside your JavaScript bundle or a public GitHub repository.

Why it matters: Anyone can open your site's source and copy it. A leaked AI key can run up a large bill overnight, and a leaked service_role key bypasses all database rules.

How to fix it:

  • Keep secrets only on the server (environment variables, edge functions or a backend API).
  • Only truly public keys (like a Supabase anon key with RLS on) belong in the browser.
  • If a key was ever exposed, rotate it immediately. Deleting it from code is not enough, because it lives on in git history.
  • Turn on secret scanning in your repository.

3. Broken Access Control (IDOR / BOLA)

What it looks like: Your order page loads /api/orders/1042. Change it to /api/orders/1043 and you see a stranger's order.

Why it matters: Broken access control sits at the top of the OWASP Top 10 list of web risks. AI tools often check that a user is logged in but not that the record belongs to them.

How to fix it:

  • On every read, update and delete, check ownership on the server. Never trust an ID sent by the client.
  • Use unguessable IDs (UUIDs) as a second layer, not as the only protection.
  • Test by logging in as two different users and swapping IDs.

4. Authentication Enforced Only in the Browser

What it looks like: The "Admin" button is hidden for normal users, but the admin API behind it accepts requests from anyone.

Why it matters: Anything done only in the frontend can be bypassed in seconds with browser developer tools or a simple script.

How to fix it:

  • Treat the frontend as a display layer. Every permission check must also happen on the server or in database policies.
  • Verify the user's session or token on every protected API route.
  • Store roles server-side, and never trust a role value sent from the browser. Experienced PHP and backend developers build these checks in from day one.

5. SQL Injection and Cross-Site Scripting (XSS)

What it looks like: User input goes straight into a database query, or user-written text (comments, names, reviews) is rendered as raw HTML.

Why it matters: SQL injection can expose or wipe your database. Cross-site scripting lets attackers run code in other users' browsers and steal sessions.

How to fix it:

  • Use parameterised queries or a trusted ORM. Never build SQL by joining strings.
  • Escape output by default, and avoid dangerouslySetInnerHTML or raw innerHTML with user content.
  • Validate input on the server (type, length, format), not just in the form.

6. Missing Security Headers and CSRF Protection

What it looks like: No Content-Security-Policy, no clickjacking protection, and forms that accept requests from any website.

Why it matters: In one test by security firm Tenzai, 15 apps built with five leading AI coding tools contained 69 vulnerabilities, and not one of the 15 set security headers or implemented CSRF protection.

How to fix it:

  • Add standard headers: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, Referrer-Policy and frame protection.
  • Use CSRF tokens or SameSite cookies for any action that changes data.
  • Check your live site with a header scanner after every deploy. A professional web development team treats this as standard.

7. Server-Side Request Forgery (SSRF)

What it looks like: A feature like "import from URL" or "generate a link preview" fetches any URL the user provides, including internal addresses.

Why it matters: Attackers can make your server call internal services or cloud metadata endpoints and leak credentials. The same Tenzai study found every tool tested introduced SSRF flaws.

How to fix it:

  • Allow-list the domains your server is permitted to fetch.
  • Block private IP ranges, localhost and cloud metadata addresses.
  • Run URL-fetching features in an isolated service with minimal permissions.

8. No Rate Limiting on Login, OTP and AI Endpoints

What it looks like: Anyone can hit your login, OTP or AI chat endpoint thousands of times a minute.

Why it matters: Without limits you invite password guessing, OTP abuse that you pay for, scraping and runaway AI API bills.

How to fix it:

  • Rate-limit by IP and by account on login, OTP, password reset and any endpoint that costs you money.
  • Add bot protection on signup and public forms.
  • Set hard spending limits on your AI and SMS provider accounts.

9. Hallucinated Dependencies and Slopsquatting

What it looks like: The AI imports a package that sounds real but does not exist, or pins an old version with known vulnerabilities.

Why it matters: Researchers found that about 19.7% of packages suggested by AI models in their tests did not exist, and many of those fake names came back again and again when the same prompts were rerun. Attackers can register those names on npm or PyPI with malicious code, a technique called slopsquatting. No large-scale campaign has been publicly confirmed yet, but the conditions for one are in place.

How to fix it:

  • Verify every new package: does it exist, who maintains it, how many downloads does it have, and how old is it?
  • Use a lockfile and run npm audit, pip-audit or a dependency scanner in your pipeline.
  • Remove packages you are not actually using.

10. Placeholder Security, Debug Mode and Leaky Errors

What it looks like: A // TODO: add auth check that never got done, a payment webhook that does not verify its signature, debug mode left on, or error messages that print database queries and stack traces.

Why it matters: AI tools sometimes stub out a security step to get a feature working and move on. Detailed error messages then hand attackers a map of your system.

How to fix it:

  • Search the codebase for TODO, FIXME, mock, test and bypass before launch.
  • Verify webhook signatures from payment providers (Stripe, Razorpay and others) on the server.
  • Turn off debug mode in production. Show users friendly errors and keep full details in server logs.

AI-Built App Security Checklist: Test Your App in 30 Minutes

#CheckHow to testRisk if it fails
1Database rules on every tableQuery another user's data with the public keyFull data leak
2No secrets in the browserSearch page source for "sk_", "key", "secret"Account takeover, large bills
3Ownership checksSwap record IDs between two test usersOther users' data exposed
4Server-side permissionsCall admin APIs as a normal userAdmin takeover
5Safe input handlingEnter <script> and quote characters in formsXSS / SQL injection
6Security headersRun a header scanner on the live URLClickjacking, script injection
7URL fetching locked downTry internal addresses in URL fieldsCredential leaks
8Rate limitsSend rapid repeated login/OTP requestsBrute force, cost abuse
9Dependencies verifiedRun a dependency auditMalicious or vulnerable packages
10No placeholders or debugSearch code for TODO/mock; trigger an errorBypassed checks, info leaks

If more than two of these fail, treat your app as not ready for real user data.

Can AI Write Secure Code?

Yes, when security is part of the process. AI tools are excellent at speed. The problem is not the AI; it is shipping AI output without the review steps a professional team would apply to any code.

A practical approach that keeps the speed of AI and adds the safety of engineering:

  1. Put security in the prompt. Ask for RLS policies, server-side validation and rate limiting explicitly.
  2. Separate prototype from production. Use AI freely to validate an idea, then harden the code before real users and payments arrive. This is where professional app development makes the difference.
  3. Automate the basics. Add secret scanning, dependency audits and a static security scanner to every deploy.
  4. Get a human review before launch. A security-focused developer can spot access-control and logic flaws that automated scanners miss. Our AI development team uses AI tools daily and reviews every line before it ships.

Frequently Asked Questions About Vibe Coding Security

Is vibe coding safe?

Vibe coding is safe for prototypes and idea validation. For apps that handle real user data or payments, the AI-generated code needs a security review, because studies such as Veracode's show AI-written code fails security tests in a large share of cases.

Are apps built with Lovable, Bolt or Replit secure?

The platforms themselves can be secure, but the apps you build on them are your responsibility. The most common issues are missing database access rules, exposed secrets and missing server-side checks.

How do I know if my Supabase data is exposed?

Check that Row Level Security is enabled on every table in the Supabase dashboard, then try to read another user's data using only the public anon key. If you can, your data is exposed.

What should I do if an API key was exposed?

Rotate (regenerate) the key immediately in the provider's dashboard, move it to a server-side environment variable, and review usage logs for abuse. Deleting it from code alone is not enough.

Can AI write secure code?

AI can write secure code when security requirements are stated clearly and the output is reviewed and tested. Without that, it often chooses the convenient approach over the secure one.

Conclusion: Launch Your AI-Built App Safely

AI has made building software faster than ever, and that is a real win for founders. But attackers use the same tools to find weak apps faster too. The ten vulnerabilities above (open databases, exposed keys, broken access control, browser-only checks, injection, missing headers, SSRF, no rate limits, fake dependencies and placeholder security) cover most of what goes wrong in AI-built apps.

Fix them before launch, and your AI-built app can be as safe as anything a traditional team would ship. Security is not a one-time task either. If you want a real-world reminder of what happens when it is skipped, read what happened when our Facebook page got hacked.

Keep reading

Facing something similar
in your own business?

Free 30-minute call โ€” real answers from the team that lived this one, not a sales script.

support@thetechnosquare.com  ยท  Pilani, India  ยท  Working worldwide ๐ŸŒ