Book a free call

Vibe Coding Security Risks: What Can Go Wrong?

Vibe coding lets AI write code from plain-language prompts, but that code can hide security gaps. Here are the risks and how to check the code before it ships.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Vibe Coding Security Risks: What Can Go Wrong?
On this page

Short answer

Vibe coding security risks are the weaknesses that appear when an AI tool writes software from plain-language prompts without a person checking the result. The generated code can expose data, skip login checks or store secrets in plain text, and those gaps reach production if nobody reviews the code before it ships.

What is vibe coding, and where do the risks come from?

Vibe coding is a way of building software in which a person describes what they want in plain language and an AI tool writes most of the code. The person tests the result, describes the next change, and the tool updates the code, so a working app can appear in days rather than months.

The security risks come from how the tool works. It predicts code that looks right based on patterns it has seen, not code that is safe. It does not know which data is sensitive, which pages need a login, or which secrets must stay hidden, so it can produce code that works in a demo and still leaves the door open.

The risk grows when the person prompting has no coding background. They cannot spot a missing check or a weak password rule, and the tool will not warn them. The app looks finished, so it ships with gaps that only show up when someone probes it. For background on the approach, see AI vibe coding for startups.

What security risks does vibe coding create?

Vibe-coded apps tend to fail in the same few ways, because the AI repeats the most common patterns it has seen, including the unsafe ones. Knowing the list helps a reviewer check for each one.

RiskHow it happensWhat it exposes
Secrets in codeAPI keys and passwords written into filesAccounts and paid services
Missing login checksPages or APIs with no auth checkOther users' data
Injection flawsUser input passed straight to a queryDatabase contents
Weak password rulesShort passwords, no lockout after failuresUser accounts
Unsafe file uploadsAny file type accepted and servedServer control
Old or fake packagesImports the AI invented or that are out of dateKnown vulnerabilities

None of these is new. They are the same flaws that have affected hand-written code for years. The difference is speed: a vibe-coded app can collect several of them in a single afternoon, and nobody on the team may know they are there.

Why does AI-written code fail security checks?

AI-written code fails security checks because the tool optimises for code that runs, not code that is safe. A login page that accepts any password still works in a demo, and a database query that ignores the user ID still returns data, so the tool sees no reason to change them.

The tool also has no view of the whole system. It writes one file at a time, so it cannot see that an admin page it just built has no login check, or that a key it placed in a config file is also copied into the public code. Each part looks fine alone, and the gap only appears when the parts are joined.

Finally, the tool copies what is common, and common code is not always safe code. Old tutorials and public examples often skip security steps to keep the example short, and the AI repeats those shortcuts. A human reviewer who knows the shortcuts can catch them; a tool that learned from them cannot.

How to check vibe-coded code in 6 steps

Checking vibe-coded code takes a short routine, and it should happen before the app reaches real users. The steps below catch most of the common gaps without needing a security specialist.

  1. Search for secrets. Look for API keys, passwords and tokens in the code and config files, and move any you find into a secrets store or environment variables.
  2. Test every page as a stranger. Log out and try to open each page and API directly. Anything that should need a login must refuse access.
  3. Try bad input. Enter quotes, long strings and odd characters in every form and search box, and check that the app rejects them safely.
  4. Check the packages. List every library the app imports, confirm each one is real and current, and remove any the AI invented.
  5. Run a scanner. Use a free code scanner or the built-in checks in the hosting platform, and fix what it flags before launch.
  6. Turn on logging. Record logins, failed attempts and errors, so unusual activity is visible after launch.

If the app handles payments or health data, a professional review is worth the cost. The checks above catch the common gaps, but regulated data needs deeper testing. The AI security service page explains what that review usually covers.

Example (hypothetical): a small team ships a booking app

Example (hypothetical): a team of three builds a booking app with an AI coding tool in four weeks. Before launch, a developer spends one day reviewing the code and finds a hard-coded API key, two places where user input reaches the database unchecked, and an admin page with no login check.

Fixing the four issues takes 6 hours, and the review itself took 8 hours, so the total is 14 hours. At $75 an hour, the review and fixes cost $1,050. The key alone would have let anyone read every booking, so the cost of finding it early is small next to the cost of a breach.

The team adds the six checks from this guide to its launch list. Each new feature now goes through the same review, and the check takes about two hours per release instead of a full day, because the common gaps are already fixed.

What are the common mistakes?

The most common vibe coding security mistakes are trusting the output, skipping the review, and assuming the tool understands the business.

  • Shipping the first version. The first draft of AI-written code is a starting point, not a finished product, and it usually carries at least one of the flaws in the table above.
  • Only testing the happy path. Trying the normal flow proves the app works, but it does not prove it is safe. Security checks need the odd and hostile inputs too.
  • Asking the AI to check itself. The same tool that wrote the code will often approve it, because it repeats the same patterns. A separate scanner or a human reviewer catches more.
  • Copying the key into chat. Pasting real keys or passwords into the AI tool can store them where others can see them. Use test values while building.
  • Ignoring updates. AI tools suggest packages that may already be out of date, and old packages carry known flaws that attackers can look up.

When is vibe coding safe to use?

Vibe coding is safest for prototypes, internal tools and low-risk features, where the data is not sensitive and the audience is small. A demo, a dashboard for the team, or a landing page are good fits, because a flaw there has limited reach.

It is riskier for apps that hold personal data, take payments or control other systems. Those apps need the review routine from this guide, and the more sensitive the data, the more review they need. That does not mean the AI tool cannot be used, only that its output needs checking before it reaches users.

The practical rule is simple: the AI can write the code, but a person owns the security. If nobody on the team can review the code, the app should stay a prototype until someone who can review it is involved. Comparing the main tools helps too, and the best vibe coding platforms shows which tools teams use most.

Key takeaways

  • Vibe coding is fast, but the AI writes code that works, not code that is safe
  • Common gaps are secrets in code, missing login checks, injection flaws and unsafe uploads
  • A short review routine before launch catches most of the common flaws
  • Never paste real keys or customer data into an AI coding tool
  • The riskier the data, the more human review the code needs

Frequently asked questions

What is vibe coding?

Vibe coding is building software by describing what you want in plain language and letting an AI tool write the code. You test the result, describe the next change, and the tool updates the code. It suits prototypes and small apps, but the output needs checking before it reaches real users.

Is vibe coding safe for business apps?

It can be, if the code is reviewed before launch. The main risks are secrets left in code, missing login checks and unsafe handling of user input. A short review routine, plus a scanner, catches most of these. Apps with payments or personal data need a deeper professional review.

Can AI coding tools check their own code?

Only partly. The same tool that wrote the code will often approve it, because it repeats the same patterns. A separate code scanner, a different tool, or a human reviewer catches more flaws, so self-checking should never be the only check.

What is the biggest vibe coding security risk?

Secrets in code are the most common and most damaging. An API key or password left in a file can be found in minutes once the code is public, and it can give access to accounts, data and paid services. Moving secrets into a secrets store is the first fix.

Should beginners use vibe coding tools?

Yes, for learning and prototypes, but beginners should be careful with real data. Without coding experience it is hard to spot a missing login check or a weak password rule. Pairing the tool with a review by someone experienced keeps the learning safe.

How long does a vibe code security review take?

For a small app, a first review takes about a day, including fixes for the common gaps. Later reviews take less time, often around two hours per release, because the recurring issues are already fixed and the checks become routine.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building with an AI coding tool and want a security review?

A senior engineer replies within one business day. Or see our AI Security service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call