Cursor, Lovable, Bolt, Replit and Google Antigravity can turn a prompt into a working app in one afternoon. Working is not the same as safe. This vibe coding security guide gives you a 30-point audit. Every check names the hole, the fix, and a copy-ready prompt for your AI assistant.

Most AI-built breaches share one pattern. The model writes the happy path well. It skips the boring guards: who is allowed in, who owns what, and what the server re-checks. Attackers hunt exactly those gaps. A short audit closes them before real users arrive.

All of this is defensive work for your own app or a codebase you may work on. Run the checks while you build. Run them again before you deploy. Pair this with our GitHub Copilot beginner tutorial if you are still setting up the workflow.

In this guide: What is vibe coding security? · Why do AI-built apps ship insecure by default? · How do you run a vibe coding security audit? · The scary words, in plain English · Your first audit evening, step by step · The 30 vulnerabilities at a glance · The 18 core audit prompts · The 12 advanced audit prompts · The one master prompt for a full audit · How to report what the audit finds · The 15-point pre-deployment checklist · Which AI platforms can run these prompts? · FAQ: quick answers · Verdict: build fast, but audit before you ship.

What is vibe coding security?

Vibe coding security is a habit. You audit AI-generated code the way you would check work from a junior developer who never says no. The AI writes fast. It agrees with you. It rarely pushes back on a bad idea. Security review is the pushback.

In practice that means three things. Check what the AI wrote, not what you meant. Treat every input as hostile until the server says otherwise. Never trust a price, a role or an identity that came from the browser.

This does not slow the vibe much. A pass over the 30 checks takes an evening on a small app. The same audit after a breach takes a week and a lawyer.

Why do AI-built apps ship insecure by default?

AI coding tools optimise for a working demo. A prompt like build a store returns pages, buttons and API calls that look finished. The demo does not show the missing ownership check on an order. It does not show the API key in frontend code where view-source finds it.

Two reasons come up again and again. First, generated apps often trust the client. Prices, roles and quantities arrive from the browser and get used as-is. Second, secrets drift into frontend code. The model does not always know which keys are safe to expose.

The OWASP Top 10 lists the same failure families for all web apps. AI-built apps hit them more often, not less. CISA's secure-by-design guidance says it plainly: the maker owns the security, not the user. Vibe coding does not move that duty.

How do you run a vibe coding security audit?

Work in this order: access control first, then money logic, then input handling, then configuration. Each prompt below is written for Cursor, Lovable, Claude Code, Codex or your assistant of choice. Paste one in while the project is open.

Three rules make the prompts work. Run them one at a time so the model can focus. Ask for evidence: file names and line numbers. Then treat not-applicable or unverified as an answer you must check yourself, never as a clean pass.

After each fix, ask for a regression test that fails without the fix. That one habit turns a cleanup into a codebase that stays fixed.

The scary words, in plain English

The prompts use short names for each bug family. Here is the same list in plain words, so nothing below reads like a wall of jargon.

IDOR means when the app shows you records that belong to someone else. The long name is insecure direct object reference.

XSS means when attacker text runs as code in another person's browser. The letters stand for cross-site scripting.

CSRF means when another website fires requests using your session. The letters stand for cross-site request forgery.

SSRF means when a user tricks your server into calling addresses it should never call. Server-side request forgery.

RLS means row-level security. A database rule that keeps each user's rows visible only to them.

A JWT is a signed login token. If the app skips the signature check, anyone can fake one.

An OTP is the one-time code you get by SMS or app. Weak OTP checks let attackers sign in without it.

CSP means Content Security Policy. A browser rule that blocks unsafe scripts.

CORS means the rule that decides which websites may read your API answers. A loose setting hands your data to any site.

A rate limit is a cap on how often one user can call you. Without one, a script can take the app down.

A webhook is a call your app receives when a payment or event happens. Skip its signature check and anyone can post fake payments.

Prototype pollution means when attacker keys rewrite how objects behave in JavaScript. It can flip security checks off.

Your first audit evening, step by step

You do not need a security team to start. You need one evening and this order.

Step 1: run the master prompt from the section below in read-only mode. Ask for the report only. Do not let it change code yet.

Step 2: read the report. Sort the findings by severity: critical, high, medium, low.

Step 3: fix the criticals with the matching single-check prompts. Access control and money logic come first.

Step 4: ask for a regression test for every fix. Run the tests. Keep them in the repo.

Step 5: re-run the master prompt. Compare the two reports. Repeat the loop next week before you ship anything new.

That is the whole loop. Report, fix, test, re-run. It fits between dinner and bedtime, and it catches the holes that matter most.

Where do these bugs actually bite? A store: prices and coupons get edited in the browser. A chat app: user text runs as script in other tabs. A resume builder: uploaded files land somewhere they can run. A login page: OTPs get replayed. An AI feature: a crafted page makes it leak data. A dashboard: one missing row-level policy exposes every tenant. A landing page: an open CORS setting hands your API to anyone. Launch week: one old package with a known exploit. Each prompt below maps to one of these scenes.

One more habit worth building. Demand evidence for every claim: file, line and the exact code. Then ask what test would have caught this. Add that test. In a month your app has a wall of regression tests, and the next audit finds far less.

The 30 vulnerabilities at a glance

Each entry names the risk in one sentence and the fix in one sentence. The next three sections give you the matching copy-ready audit prompts.

1. Broken access control. Risk: anyone reaches admin pages or private APIs by guessing URLs.

Fix: check identity and role on the server for every request, deny by default.

2. IDOR / BOLA. Risk: changing an ID in the URL shows another user's orders or documents.

Fix: verify the owner of every resource on the server before returning it.

3. Exposed API keys. Risk: secrets ship in frontend bundles and get scraped within hours.

Fix: keep confidential keys in backend-only code and rotate anything that leaked.

4. Price manipulation. Risk: the checkout trusts a price sent by the browser.

Fix: recalculate prices, taxes and totals from server-side data.

5. Negative quantity exploit. Risk: a minus quantity flips the total or inflates stock.

Fix: validate quantities server-side as positive integers with limits.

6. Fake payment. Risk: the app marks orders paid because the client said so.

Fix: verify payment status and webhook signatures with the provider, then fulfil.

7. Coupon & reward abuse. Risk: one coupon gets redeemed fifty times in parallel.

Fix: atomic redemption with usage limits and uniqueness constraints.

8. Privilege escalation. Risk: a normal user posts role=admin to the profile API and gets it.

Fix: roles change only through trusted server-side logic.

9. Authentication & OTP bypass. Risk: OTPs are guessed, replayed or skipped entirely.

Fix: attempt limits, short expiry, single use, server-side verification.

10. Prompt injection. Risk: a crafted page or message makes your AI call tools or leak data.

Fix: treat external content as data, give AI tools least privilege, confirm sensitive actions.

11. Cross-site scripting (XSS). Risk: user content runs script in another user's browser.

Fix: context-aware output encoding, safe rendering, a restrictive CSP.

12. Malicious file upload. Risk: an upload lands where it can execute.

Fix: validate type, size and signature on the server, store outside executable paths.

13. Environment variable exposure. Risk: database credentials sit in git history, logs or build output.

Fix: secret scanning, rotation, no secrets in client code.

14. SQL / NoSQL injection. Risk: crafted input rewrites your queries.

Fix: parameterised queries or safe ORM calls everywhere, strict input schemas.

15. JWT vulnerabilities. Risk: tokens are accepted without signature or claim checks.

Fix: allowlist algorithms, verify signature, issuer, audience, expiry, purpose.

16. Rate limit bypass & DoS. Risk: unlimited requests exhaust the app.

Fix: distributed rate limits, request size caps, timeouts, concurrency limits.

17. Row-level security bypass. Risk: a missing policy exposes every row to every user.

Fix: RLS policies on every table, tested with cross-user checks.

18. Predictable security tokens. Risk: reset links built on Math.random are guessable.

Fix: cryptographically secure generators with enough entropy and expiry.

19. Cross-site request forgery. Risk: another site fires actions with your session.

Fix: CSRF tokens, SameSite cookies, origin checks, no state changes on GET.

20. CORS misconfiguration. Risk: any website can read your API responses.

Fix: explicit origin allowlist, restricted methods and credentials.

21. Server-side request forgery. Risk: a user-supplied URL makes your server call internal services or cloud metadata.

Fix: validate destinations and restrict outbound traffic.

22. Insecure session management. Risk: sessions never expire or leak to subdomains.

Fix: Secure, HttpOnly, SameSite cookies; rotate after login; revoke on logout.

23. OAuth / SSO vulnerabilities. Risk: a forged provider response signs an attacker in.

Fix: validate state, nonce, issuer, audience, redirect URIs; use PKCE.

24. Prototype pollution. Risk: a merged config object rewrites object internals.

Fix: strict schemas, safe merges, protect __proto__ and constructor keys.

25. Regular expression DoS. Risk: one crafted string pins the CPU.

Fix: bounded patterns, input length caps, safe regex libraries.

26. WebSocket hijacking. Risk: unauthenticated sockets join private channels.

Fix: authenticate the handshake, validate origins, authorise each channel.

27. Server-side template injection. Risk: user text becomes template code on the server.

Fix: treat content as data, escape by default, sandbox templates.

28. Dependency vulnerabilities. Risk: one outdated package carries a known exploit.

Fix: scan dependencies, patch fast, remove what you do not use.

29. Mass assignment. Risk: the API copies request fields straight into the database.

Fix: allowlist fields per endpoint; protect roles, balances, ownership.

30. Security misconfiguration. Risk: debug mode, open buckets and verbose errors in production.

Fix: harden defaults, least privilege, generic error messages.

These 30 items mirror the OWASP Top 10 families and the checklists professional auditors use. Numbers 1 to 18 cover the classic web stack. Numbers 19 to 30 add the modern cases: CSRF, CORS, SSRF, OAuth, AI integrations and supply chain. AI-built apps hit those hardest.

The 18 core audit prompts

Paste one prompt at a time into your assistant while the project is open. Each prompt asks for implementation plus regression tests, so every fix lands with proof.

01. Broken access control — Copy-ready prompt: "Audit my entire application for broken access control. Review frontend routes, backend endpoints, middleware and admin features. Make the server enforce identity and permissions on every request. Deny by default. Add regression tests for unauthorized requests."

02. IDOR / BOLA — Copy-ready prompt: "Review every endpoint that accepts user IDs, order IDs, document IDs or other resource identifiers. Make each request check who owns the resource and what access it allows. Implement object-level authorization. Add cross-account isolation tests."

03. Exposed API keys — Copy-ready prompt: "Scan my frontend, backend, config files and production build for exposed API keys. Separate public config from confidential secrets. Move confidential credentials to the backend. Recommend rotating every exposed key. Prevent future leakage."

04. Price manipulation — Copy-ready prompt: "Audit the full checkout and pricing workflow. Compute prices, taxes, discounts and totals from trusted server-side data. Reject any price the client sends. Add automated tests for transaction integrity."

05. Negative quantity exploit — Copy-ready prompt: "Review all cart, checkout, inventory and refund endpoints. Validate quantities on the server. Quantities must be positive integers within set limits. Add database constraints and boundary-value tests."

06. Fake payment — Copy-ready prompt: "Audit my payment integration. Verify payment status with the provider on the backend. Validate webhook signatures, amounts, currencies and order IDs. Add idempotency. Do not fulfil an order before payment is confirmed."

07. Coupon & reward abuse — Copy-ready prompt: "Review coupon, referral, loyalty and reward flows. Use atomic transactions, redemption limits, expiry checks and uniqueness constraints. Concurrent requests must not double-redeem."

08. Privilege escalation — Copy-ready prompt: "Audit registration, profile updates, role management and admin endpoints. Assign roles only through trusted server logic. Block edits to privileged fields. Add role-based authorization tests."

09. Authentication & OTP bypass — Copy-ready prompt: "Review login, signup, OTP checks, two-factor auth and account recovery. Cap attempts. Expire OTPs fast. Use each code once. Handle sessions and replay safely. Add auth regression tests."

10. Prompt injection — Copy-ready prompt: "Audit all AI integrations: system prompts, retrieved documents, tool calls and user input. Treat outside content as untrusted data. Give AI tools least privilege. Check authorization separately. Validate structured output. Confirm sensitive actions with the user."

11. Cross-site scripting (XSS) — Copy-ready prompt: "Review all user content, HTML rendering, DOM operations and dynamic templates for reflected, stored and DOM-based XSS. Encode output for its context. Render safely. Sanitize HTML where allowed. Add a restrictive Content Security Policy."

12. Malicious file upload — Copy-ready prompt: "Audit all upload and download flows. Check file signature, type, size and name on the server. Store uploads in isolated, non-executable storage. Add access controls and malware scans where needed."

13. Environment variable exposure — Copy-ready prompt: "Review env files, git history, config files, CI/CD pipelines, logs and build artifacts for secrets. Set up secret scanning. Rotate every leaked key now. Never print secret values."

14. SQL / NoSQL injection — Copy-ready prompt: "Audit all database queries, ORM calls, filters and user-controlled search params. Replace unsafe query building with parameterized queries or safe ORM methods. Enforce strict input schemas. Limit database privileges. Add injection regression tests."

15. JWT vulnerabilities — Copy-ready prompt: "Review JWT signing, verification, expiry and refresh flows. Allowlist trusted algorithms only. Verify signature, issuer, audience, expiry and purpose. Manage keys securely. Rotate refresh tokens where relevant."

16. Rate limit bypass & DoS — Copy-ready prompt: "Audit rate limits, proxy settings, request handling and resource use. Add distributed limits, trusted proxy config, size caps, timeouts and concurrency limits. Check HTTP/2 settings and install security patches."

17. Row-level security bypass — Copy-ready prompt: "Review all RLS policies, views, functions, storage permissions and service accounts. Users must reach only their own records. Views and functions must keep the same restrictions. Add cross-user and cross-tenant tests."

18. Predictable security tokens — Copy-ready prompt: "Audit session IDs, reset tokens, verification codes and any security random values. Replace weak random sources with a crypto-grade generator. Enforce length, entropy, expiry and single use."

The 12 advanced audit prompts

These twelve cover the modern attack surface: request forgery, cross-origin reads, server-side fetch abuse, sessions, OAuth, prototype pollution, regex blow-ups, WebSockets, templates, dependencies, mass assignment and configuration.

19. Cross-site request forgery — Copy-ready prompt: "Audit all state-changing endpoints for CSRF. Add CSRF tokens, SameSite cookies and origin checks. GET requests must never change state."

20. CORS misconfiguration — Copy-ready prompt: "Review CORS settings on every API and environment. Replace open policies with a trusted origin allowlist. Limit methods, headers and credentialed requests to what the app needs."

21. Server-side request forgery — Copy-ready prompt: "Review every URL fetch, webhook, image proxy, import and integration. Validate destinations. Restrict outbound network access. Handle redirects safely. Block internal services and cloud metadata endpoints."

22. Insecure session management — Copy-ready prompt: "Audit session creation, storage, expiry, logout and invalidation. Use Secure, HttpOnly and SameSite cookies. Rotate session IDs after login or role changes. Invalidate sessions when needed."

23. OAuth / SSO vulnerabilities — Copy-ready prompt: "Review every Google, Microsoft, GitHub, OAuth, OIDC and SAML flow. Validate the provider response: issuer, audience, redirect URIs, signatures, state and nonce. Use PKCE where it applies. Make account linking safe."

24. Prototype pollution — Copy-ready prompt: "Audit object merges, recursive assignment, config parsing and user-controlled keys. Enforce strict schemas. Use safe merges. Block __proto__ and constructor keys. Check dependencies for known pollution bugs."

25. Regular expression DoS — Copy-ready prompt: "Review regex used in validation, search, parsing and request handling. Find patterns with heavy backtracking. Replace them with bounded forms. Cap input length. Add execution safeguards."

26. WebSocket hijacking — Copy-ready prompt: "Audit WebSocket connections, auth, subscriptions and message handlers. Validate origins. Authenticate every connection. Authorize each channel and message. Add connection limits, message checks and session expiry."

27. Server-side template injection — Copy-ready prompt: "Review all server-side templates, dynamic rendering and email generation. Treat user content as data, never as template code. Escape by default. Limit template features."

28. Dependency vulnerabilities — Copy-ready prompt: "Audit direct and transitive dependencies, manifests and lockfiles. Find known CVEs and unsupported packages. Apply compatible patches. Remove unused packages. Turn on automated dependency scanning."

29. Mass assignment — Copy-ready prompt: "Review all create and update endpoints for blind request-to-model copying. Allowlist fields per endpoint. Enforce strict request schemas. Protect roles, balances, payment status and ownership."

30. Security misconfiguration — Copy-ready prompt: "Audit production config, security headers, debug settings, database permissions, storage buckets, admin endpoints and error pages. Turn off unused services. Enforce HTTPS. Use least privilege. Keep errors generic."

The one master prompt for a full audit

Short on time? One prompt covers all 30 areas. Expect a long answer. Ask the assistant to work in phases. It must stop for your approval before it touches code.

Copy-ready prompt: "Act as a senior cybersecurity engineer, an app security architect and a full-stack developer. Run a full defensive security audit of my authorized app and its code. Audit these 30 areas: broken access control; IDOR / BOLA; exposed API keys; price manipulation; negative quantity exploits; fake payments; coupon and reward abuse; privilege escalation; authentication and OTP bypass; prompt injection; cross-site scripting; malicious file upload; environment variable exposure; SQL / NoSQL injection; and JWT vulnerabilities. Then continue with: rate limit bypass and denial of service; row-level security bypass; predictable security tokens; cross-site request forgery; CORS misconfiguration; server-side request forgery; insecure session management; OAuth / SSO vulnerabilities; prototype pollution; regular expression DoS; WebSocket hijacking; server-side template injection; dependency vulnerabilities; mass assignment; and security misconfiguration

Cover the frontend, backend, APIs, database, auth, middleware, payment flows, AI flows, env vars, dependencies and deploy config.

Work in phases. Phase 1: study the architecture. Name the trust boundaries.

Phase 2: find vulnerabilities. Record evidence, files, line numbers, severity, impact and fixes. Mark irrelevant checks as not applicable. Mark unverified checks as unverified.

Phase 3: present a fix plan before you change code.

Phase 4: after my approval, apply fixes. Do not change the UI, the UX or the business logic more than needed. Never hardcode secrets. Never weaken auth.

Phase 5: add security regression tests. Run the test suite in a safe local or staging environment. No destructive tests. No load tests on production.

Phase 6: give me a final report with findings, fixes, files changed, test results, open risks and deploy advice.

Guardrails: do not invent vulnerabilities. Do not call untested features secure. Never expose secret values. Do not deploy without my approval. Keep the code secure, clean and production-ready."

How to report what the audit finds

Ask the assistant to fill this template for every finding, then work the list top down.

Vulnerability — the name of the issue.

Severity — critical, high, medium or low.

Affected file — the path and line number.

Description — what is wrong, in plain language.

Evidence — the code or config that proves it.

Impact — what an attacker could do with it.

Recommended fix — the change you will make.

Test result and status — verification output, plus fixed, pending, not applicable or unverified.

The 15-point pre-deployment checklist

Deploy only when all fifteen are true. Print this list and tick it by hand.

All API endpoints have appropriate authorization.

Resource ownership is validated on every request.

No confidential API keys are exposed in client code.

Prices and payments are verified server-side.

Authentication and OTP systems are secured.

User inputs are validated on the backend.

Database queries are protected against injection.

File uploads are securely handled.

JWT and session security is implemented.

Rate limiting and resource protection are enabled.

Database access policies are verified.

AI tools have restricted permissions.

Dependencies are scanned for vulnerabilities.

Production configurations are hardened.

Security regression tests have passed.

Which AI platforms can run these prompts?

The prompts are plain text. They run wherever your code lives: Google Antigravity, Cursor, Lovable, Bolt.new, Replit, Claude Code, OpenAI Codex, GitHub Copilot, Windsurf and ChatGPT. They adapt to MERN, Next.js, React, Node.js, Python, Django, Flask, Firebase, Supabase, PostgreSQL and MongoDB stacks. The checks target what your app does, not one framework.

Two notes on tools. In agent-style tools such as Cursor, Claude Code, Codex and Antigravity, the assistant can open files and edit code. Keep the phased master prompt and approve the plan before it writes. In chat-only tools, paste the code sections with each prompt and check the line numbers yourself.

Which one should you pick? Copilot and Windsurf sit inside your editor, so single-check prompts fit their flow. Claude Code and Codex run long multi-file tasks well, so the master prompt suits them. ChatGPT reviews well when you paste one file at a time. Match the prompt size to the tool, not the other way round.

FAQ: quick answers

Is vibe coding safe for production apps? — It can be, if you audit. The 30 checks above cover the holes AI-built apps actually ship with. Run them before real users and real money arrive. Rerun the master prompt after every major feature.

How long does a full audit take? — The master prompt gives a first pass in under an hour on a small app. Budget one evening for the fixes. Add the regression tests that keep them fixed.

Should I fix everything the AI reports? — Start with critical and high items that touch access control and money. Medium items can ship with a tracking issue. Verify anything marked unverified first. Fix the rest next week.

Does this replace a professional audit? — No. It clears the obvious ninety percent. If you ever need a professional audit, its hours go to your business logic instead of the basics.

My AI says a check is not applicable. Now what? — Confirm it by hand. Not applicable is a real answer. A blog with no payments has no price-manipulation risk. The AI must show you why, not just declare it.

Can I run these prompts on code I did not write? — Only if you own the code or have permission to test it. Scanning someone else's app without consent is not an audit. It is an attack. Stick to your own projects and authorised work.

What if a fix breaks my app? — Small breaks are normal. That is why every prompt asks for regression tests. If a fix breaks a feature, revert it. Read the test output. Re-apply the change with the failing behaviour as context.

Verdict: build fast, but audit before you ship

Vibe coding has earned its place. The speed is real. The output is good. The trade is that security defaults to nobody, so make it somebody: you, tonight, with the prompts above. Audit access control and money logic before your first real user. Audit input handling and configuration before your first hundred. Rerun the master prompt after every major feature. An app that looks finished and works perfectly can still be wide open. Thirty checks and one evening close the gap.

Written and tested by Arjun Mehta. Tested date: 1 December 2026, against a Next.js and PostgreSQL sample app using Claude Code and Cursor. Update log: first published 1 December 2026. Prompts are re-checked after each major model release and corrected in place.

Affiliate disclosure: AILarn earns nothing from this post. No affiliate links appear here. Every reference points to free, official documentation.

Sources and further reading: the OWASP Top 10 at owasp.org, the OWASP Cheat Sheet Series at cheatsheetseries.owasp.org, secure-by-design guidance at cisa.gov, the Node.js crypto documentation at nodejs.org and the Next.js production security docs at nextjs.org.

Keep the momentum going: our GitHub Copilot beginner tutorial at ailarn.com/guides/github-copilot-beginners-tutorial sets up your AI workflow, the Writesonic vs ChatGPT comparison at ailarn.com/compare/writesonic-vs-chatgpt helps you pick a writing assistant, our post on why AI text gets flagged at ailarn.com/blog/why-your-ai-text-gets-flagged keeps generated content human, and the 12-point checklist at ailarn.com/blog/12-point-checklist-before-recommending-tools shows how we vet every tool we cover.