Thinking
Vibe coding security risks: plan for the breach
Vibe coding security risks are not just bad code. Breaches are a when, so the question is who owns the code, keys and data when one happens.
Most vibe coding security risks come back to one problem: nobody owns what the AI ships. Whether AI writes worse code than people matters less. Even well-defended systems get breached, so what counts is how far an attacker gets once inside and how quickly you notice. Vibe-coded software, meaning AI-generated code shipped without an engineer reviewing it, struggles here because no named person understands the code, the packages it pulls in or the keys it holds.
Why last week changes the question
In the past week the PHP project shipped fixes for two critical vulnerabilities that can allow unauthenticated remote code execution. Remote code execution means an attacker can run their own commands on your server without logging in. The PHP team said the exposure covers all PHP installations serving web requests, and that there are no complete mitigations, updating is the only safe choice.
Three details matter for anyone running software, whoever wrote it.
First, your own code did not have to be at fault. Wiz Research found that even a simple “Hello World” application running on an affected PHP version can be vulnerable, and that the vulnerable code had been present for more than a decade. Careful teams were exposed along with careless ones.
Second, the attackers were early. Amazon Threat Intelligence saw an exploitation attempt four days before public disclosure, and its advice is that defenders should not assume the public disclosure date is the earliest date of exploitation. Once the patch was out, the flaw was seeing broad exploitation attempts in the wild.
Third, AI is shortening the path from flaw to exploit. Amazon’s assessment is that AI-assisted analysis makes it cheaper to turn a patch diff or advisory into a working exploit. Wiz said that with frontier models, a single researcher completed in a week what previously would have taken a world-class team months of work. In the same week, Node.js shipped a fix for a flaw in the Brotli decoder, reported by OpenAI Codex Security researchers.
You cannot keep every attacker out, and the gap between a flaw being found and being used is closing. As Amazon put it, a 7-day or 30-day SLA assumes a delay that no longer exists. What you control is how much damage one breach can do, how quickly you hear about it, and how fast you get back.
The immediate question for your team or supplier: do we run PHP or Node.js anywhere, are the fixes applied, and have we looked for compromise as Amazon advises? Its guidance is to start investigations from the earliest known exploitation, not from the disclosure date.
What are the limitations of vibe coding?
AI coding tools are weakest where a breach tests them.
They miss context. In one study of AI coding tools, the output across 15 applications (three each) was found to contain a total of 69 vulnerabilities. The researchers found the tools are good at avoiding security flaws that can be solved in a generic way, but struggle where what distinguishes safe from dangerous depends on context. The most serious flaws were about rules for checking who is allowed to access a resource or perform an action, and about business logic that let users do things they should not. Judging those rules takes someone who knows your business, because, as the researchers put it, agents lack this ‘common sense’ and depend mainly on explicit instructions.
Bigger models do not fix it. Veracode found only 55% of AI-generated code was secure, and that newer and larger models don’t generate significantly more secure code than their predecessors. That figure describes AI output on its own, not a comparison with your developers. Waiting for the next model is not a security plan.
They invent dependencies. A dependency is a ready-made package of someone else’s code that yours relies on. AI tools can suggest potentially non-existent packages that attackers could exploit through typosquatting, where an attacker publishes a malicious package under a name the AI is likely to guess.
They accept defaults. Platforms are set up to make building easy and leave going live safely to you. One security team found that Supabase’s default security rules are permissive for development and leave gaps if nobody configures them before launch.
Nobody owns the result. This turns the other weaknesses into a breach. Veracode warns that AI-generated vulnerabilities often lack clear ownership. When something goes wrong at 2am, someone has to understand the code well enough to change it under pressure. With vibe-coded software, that person often does not exist.
Review alone does not cure it either. Security firm Intruder found a flaw that a seasoned penetration tester missed during code review, and put it down to AI Automation Complacency: people trust output that looks competent. As they put it, security vulnerabilities are just one quick merge away from production, and only a keen-eyed code review is in its way.
How to tell a working app is not ready for real customer data
The hard part for a leader is that an unsafe app can look finished. A review we did recently shows what to look for.
The platform had been built almost entirely with AI coding agents, and its owners knew it was heavily vibe coded.
On paper it looked good. It had a large automated test suite, a default-deny permission check and secret scanning in its build. It was also live, holding real customers’ personal and financial data.
Underneath, the picture was different:
- The data was hosted overseas, on infrastructure the business did not own. It was the AI tool’s default, and nobody had chosen it.
- A pre-production task to fix how a login signing secret was handled was still open.
- Personal data was not encrypted at rest.
- Keeping one customer’s data apart from another’s depended on application code that had been tested but never independently checked.
- The application ran as the server’s all-powerful root user, so anyone who broke in would own the whole machine.
- Nobody could say whether the database was backed up.
- There was no error tracking, logging or alerting, so a live incident would have been invisible.
None of it was malicious or careless. The AI wrote code that worked. Nobody had made the decisions that keep it safe when something goes wrong.
Now read that list as a breach would. The blast radius is the share of your systems and data an attacker can reach from one foothold. Here the app ran as root on the same server as its database, so one foothold would reach the whole machine and every customer’s data on it. No logging means you find out from a customer. No known backup means you may not recover at all. The test suite proved the features worked and said nothing about any of this. If your own app has strong test numbers, ask what those tests do not cover.
We recommended fixing recovery and visibility before anything else. The first phase we proposed moves the platform onto hosting the business owns, with a proper deployment pipeline, backups with a rehearsed restore, and monitoring and alerting. We scoped that at 3 to 4 weeks. Only then come an audit of how customers’ data is kept apart, an independent penetration test, encryption of personal data at rest and multi-factor sign-in.
This was our recommendation; the work had not started when we wrote this.
What are the top 10 vulnerabilities?
The standard reference is the OWASP Top 10, a list of the most critical web application security risks maintained by the Open Worldwide Application Security Project. Ask whoever builds your software how they test against the four below.
You do not need to master all ten. These four map directly onto the weaknesses of vibe coding and onto the breach questions above.
Access control decides blast radius. OWASP found that 100% of the applications tested were found to have some form of broken access control. The AI coding study flagged the same category as most serious. OWASP’s rule is that access control is only effective when implemented in trusted server-side code, not in the screens a user sees. A vibe-coded app that hides a button but never checks on the server is open to anyone who calls the server directly.
Misconfiguration is the default you never chose. Permissive database rules, data hosted wherever the tool put it, an app running as root. None of these show up as a bug, which is why they survive testing.
Supply chain failures arrive through dependencies. OWASP now ranks A03:2025 - Software Supply Chain Failures among its top risks. The 2025 Shai-Hulud worm, a self-spreading piece of malware in the npm package registry used by Node.js projects, reached over 500 package versions before being disrupted by npm. An AI that adds packages freely makes this worse. OWASP’s own guidance speaks directly to vibe coding: no single person should be able to write code and promote it all the way to production without oversight from another human being.
Logging and alerting decide how long a breach lasts. OWASP is blunt: without logging and monitoring, attacks and breaches cannot be detected. It cites a case where, with no logging or monitoring, the data breach could have been in progress since 2013, a period of more than seven years. Wiz adds a warning for flaws like the PHP ones: they execute below the application layer, so application logs may contain little context. Log your own app, and keep server and platform logs too.
The guardrails to insist on before AI-written code ships
Before AI-written code touches real customers, require four guardrails. Each assumes a breach will happen and aims to keep it small. We run all four on our own platform, where AI agents write much of the code, so the detail below comes from practice.
| Guardrail | What it limits | What to ask to see |
|---|---|---|
| No standing credentials, least privilege | Blast radius | The permission policy and the test that checks it |
| Managed secrets, scanned changes | Leaked keys, poisoned dependencies | The secrets store and the merge checks |
| Server-side checks on every route | Data leaking between users | A test where one user tries to read another’s data |
| Alerts and rehearsed restores | Time to detect and recover | The last alert and the last restore record |
Limit what a break-in can reach. A standing credential is a password or key that works forever until someone remembers to revoke it; if it leaks, the attacker has it too. Least privilege means each person and system gets only the access its job needs. In practice, deployments use short-lived tokens that only work from the main branch. Our rule for permissions is to allow broadly where a mistake can be undone and explicitly deny what cannot. The deployment role can change most of the infrastructure. It is denied any action on the database and denied creating new credentials, and a test checks that policy on every change. The database has no public access at all. Ask your supplier to show what a stolen deployment key could reach, change or destroy, and the test that fails if someone widens that access.
Keep secrets out of the code. Secrets, such as passwords and API keys, live in a managed secrets store. They are set separately, never in the code or a configuration file in the repository. Every change is scanned for leaked secrets and known-vulnerable dependencies before it can merge, and the dependency audit runs again before each release.
Check who is asking, every time. Every route checks on the server who the user is and what they are entitled to, not just at the front door. Text the AI reads from outside, such as an email or a web page, can carry instructions of its own. So it is fenced off as untrusted and never passed to the AI as a command. We wrote more about software that knows its limits in teaching software to know when not to answer.
Watch, and rehearse recovery. Alarms on the database and on errors go straight to the team’s chat. Trust a backup only once it has been restored into a scratch database and the data checked. Until then it is a hope.
Every change should also carry a short threat model naming each trust boundary, the points where data or requests cross from something you do not control into something you do. A separate security review, not the AI that wrote the code, has to pass it.
What this asks of your team: the setup is a few weeks of engineering for most mid-market systems, not a programme. It means wiring the checks into the build and the alarms into chat. After that it’s part of how every change ships: the scans and tests run automatically, and the ongoing human work is reading each threat model, answering alerts, applying critical patches and rehearsing restores on a schedule. If no one on your team can review AI-written code with security in mind, buy that judgement from your supplier or an independent reviewer; don’t let the AI review itself. Retrofitting all of it after customer data is live, as in the review above, is harder.
Five questions to ask your team or supplier this week
Each of these has an answer you can check, so you do not need a security team to ask them.
- Where is our customers’ data physically hosted, and who chose that?
- If a breach happened tonight, how would we know, and who gets woken up?
- When did we last restore a backup and check the data was there?
- Who on the team understands the code well enough to change it safely, and who reviewed what the AI wrote before it went live?
- Where are our passwords and keys kept?
For question 4, use a test. Ask the named owner to walk you through how one customer is stopped from seeing another’s data, and what they would do in the first hour of a breach. Someone who owns the code can answer without opening the AI tool.
Worry if the answers match the review above:
- The data sits wherever the tool defaulted to.
- There is no alerting, so you would hear about a breach from a customer.
- Nobody knows whether backups exist.
- The keys sit in a file on the server.
If customer data is live and nobody can show you alerting or a tested restore, fix those two first, this month, before new features. If nobody can say where the data is or who reviewed the code, commission an independent review. Pause releases if access control between customers is unverified, and get an independent reviewer to judge anything else that looks serious, such as an exposed secret or an app with more access than it needs.
A confident answer is not enough. Ask to see the alert, the restore record and the review. Good evidence is recent and specific: an alert from the last month and who answered it, a restore with a date and the data checked, a review that names what the reviewer looked at. Anything that is a policy rather than a record is a gap. Given last week, add a sixth question: when a critical patch like PHP’s lands, how many hours until we are running it, and who decides?
If you are deciding whether a specific prototype is ready to go live, our earlier piece on whether your vibe-coded prototype is safe for production covers that checklist. Whoever builds your software, you should be able to name the person responsible for each change, see who reviewed it and hear how they would contain a breach. How we work sets out the accountability you can expect from us.
Common questions
What are the main vibe coding security risks?
The main risks are weak access control, permissive default settings, dependencies nobody chose or checked, secrets stored in code, and no logging or alerting. Underneath all of them is ownership: when AI writes code that ships without review, nobody understands it well enough to contain or fix a breach quickly.
Is AI-generated code less secure than human-written code?
AI tools handle generic security problems reasonably well but struggle where safety depends on business context, such as who is allowed to see or do what. Veracode found only 55% of AI-generated code was secure, and newer, larger models were not significantly better. That figure describes AI output on its own, so treat it as a reason to review AI-written code rather than as a comparison with your developers. You still need review by someone who knows the business.
What guardrails should a company insist on before AI-written code goes live?
Insist on four: least-privilege access with no long-lived credentials, secrets held in a managed store with every change scanned for leaked keys and vulnerable dependencies, server-side permission checks on every route, and alerting plus a backup that has actually been restored and checked. Once set up, the scans and tests run automatically, while people still review threat models, answer alerts and rehearse restores.
If breaches are inevitable, why does secure engineering still matter?
Secure engineering decides how bad a breach gets. Limiting what an attacker can reach keeps the damage small, logging and alerting mean you find out in hours rather than from a customer, and tested backups mean you can recover. Without those, a single flaw can expose everything for a long time.