
Vibe coding is the practice of building software by just describing what you want and letting AI handle the rest. This term was coined back in February 2025 by Andrej Karpathy. The productivity gains are real. Devs report 5-10x faster feature delivery
But there's a growing problem that the industry is quietly ignoring: when AI writes the code and humans approve it without really understanding it, then it is bound to get exposed or hacked Some recent research and vendor studies found vulnerabilities in roughly 40% of AI generated coding outputs. There are many incidents where putting a lot of trust in AI has actually backfired and here are two such incidents
Incident 1: Replit agent deletes production data during a freeze
In July 2025, Replit’s vibe-coded AI agent deleted a live production database during a “code freeze,” ignoring instructions not to make changes without permission.
Incident 2: The Moonwell Incident
In February 2026, DeFi protocol Moonwell lost $1.78 million within just four minutes due to a single missing multiplication in an oracle price feed. The code that was authored and reviewed by both Claude and Copilot but nobody caught it and liquidation bots have found out and exploited it immediately
AI can sometimes miss system-level invariants, cross-file assumptions and security boundaries because they don't hold the whole system in context. That means you fix a bug in one file, and it could silently break security invariants in three other areas. If the AI agent hits an error, and to resolve it just deletes security-critical auth check or a validation check because they are designed to complete the task outcome not secure it if the prompts were not given with security constraints.
We assume the code is correct if all tests are passed, but these tests were also written by LLMs. Due to this, tests are often produced with the same blind spots and can be shallow focusing only on happy paths of the codebase
Vibe coded projects accumulate technical debt significantly faster. A recent survey found that many developers admitted deploying AI generated code which they didn't fully understand. Senior engineers and auditors are already describing "hell" working with AI generated unnecessary complexity in the codebase.
When the vibe code project breaks or contains a vulnerability, the developer just re-prompts the AI to fix it. The AI generates a patch and the developer will deploy it without understanding it. This leads to serious vulnerabilities and huge losses. Always remember that top security experts and their deep expertise cannot be replaced by AI as of now or in the near future.
There is also a psychological risk by heavily relying on AI, which reduces engineers’ creativity, focus and craft. This could lead to stress and imposter syndrome in employees which will create long-term problems for engineering organizations
Let us see some examples of good prompting and bad prompting below. Also i highly recommended to read these two articles from Anthropic
https://www.anthropic.com/engineering/claude-code-sandboxing
Writing Tests
Bad Prompt
Write tests for this payment moduleDo not rely only on AI-generated tests. Senior engineers should define tests for core functionality, integration tests and fuzzing
Good Prompt
Write adversarial tests only for this payment module. I already have happy-path coverage.
Focus specifically on:
1. What happens if amount is zero, negative, or a string
2. What happens if currency is missing, null, or an unrecognized value
3. What happens if the database write fails mid-transaction — is the balance rolled back correctly?
4. What happens if the same request is sent twice within 500ms - is idempotency enforced?
5. What happens if a user passes an amount larger than their account balance
For each test, state what invariant it is protecting and what the correct expected behavior is.
Flag any case where you are unsure what the correct behavior should be — do not guess.Build a new feature
Bad Prompt
Build me a user authentication system with login, signup, and password resetWhy this is bad: No constraints, no architecture context, no security requirements. Due to this, the AI will make dozens of silent assumptions about hashing, session handling, token expiry, and rate limiting and we will not be aware what it assumed.
Good Prompt
We use Express.js with PostgreSQL. Passwords must be hashed with bcrypt (cost factor 12).
Sessions use httpOnly cookies with a 1-hour expiry. Rate limit login to 5 attempts per IP per minute.Why this is better: You define the security requirements upfront
Adding a Dependency
Bad Prompt
Add a library to handle PDF generationWhy this is bad: The AI may suggest a package that is abandoned or has known CVEs
Good Prompt
I need PDF generation in a Node.js app. Suggest up to 2 libraries that are
actively maintained (last commit within 6 months), have atleast over 10k weekly npm downloads, and are MIT or Apache 2.0 licensed. Do NOT install anything.
Just list the libraries with the links so I can verify before deciding.
Security Audit
Bad Prompt
Check my smart contract for vulnerabilities and security issues.Why this bad:
No scope defined: The agent doesn't know which files, contracts or functions to actually prioritize so it tries to audit everything but problem is AI can have only limited context.
No audit methodology specified: Due to this. it defaults to surface level pattern matching.
No threat mode: The agent can't reason about what "bad" even means without knowing what's at stake. Audit for what? Is it for Rugpulls, Flash loans or Governance attacks?
Good Prompt
### Audit objective:
Review the codebase as a security auditor. Prioritize exploitability, accounting correctness, invariant breaks, privilege abuse, and fund safety. Focus on real attack paths, not style issues or generic best-practice comments.
### Context:
- Solidity 0.8.24, Foundry test suite in test/
- Vault holds user deposits (ERC-20 + native ETH).
- RewardDistributor calculates per-user reward claims using a global accumulator index.
- We recently added partialWithdraw(). deposit() and fullWithdraw() were battle-tested, but partialWithdraw() is new code and must be treated as high risk.
- The protocol is about to go live with ~$4M TVL.
### Primary targets: contracts/core/Vault.sol, contracts/core/RewardDistributor.sol, contracts/libraries/MathLib.sol
### Primary attack goals:
1. GOAL 1 — Drain reward pool
Any sequence of calls, accounting mismatch, stale index issue, rounding issue, or state-sync bug that lets a user claim more rewards than legitimately earned. Even a small over-claim at scale is critical.
2. GOAL 2 — Borrow against ghost collateral
Any path where a user can increase borrow power, health factor, or collateral credit without actually depositing valid collateral.
3. GOAL 3 — Lock funds permanently
Any reachable state where user funds or protocol funds remain in the contract but cannot be withdrawn, claimed, rescued, or liquidated through intended flows.
4. GOAL 4 — Liquidation bypass
Any sequence where a position falls below the required health threshold but cannot be liquidated, or can delay/block liquidation in a way that creates bad debt.
### Required invariants to test:
- A user cannot claim rewards they did not economically earn
- Total user claims cannot exceed total distributable rewards except for explicitly intended dust bounds
- Withdrawing partially must not preserve full reward entitlement if principal was reduced
- Collateral value / shares / debt accounting must remain consistent before and after partialWithdraw()
- A user must not gain borrow capacity from stale or inflated accounting
- No withdraw path should create unliquidatable bad debt
- No sequence of partialWithdraw(), claim(), borrow(), repay(), or liquidation should lock funds permanently
- Total assets, total shares, and per-user balances should remain internally consistent under repeated operations
### Output rules:
- Save all intermediate work and the final report to .audit/findings/
### Reporting standard:
Present only verified findings.
No speculation.
No “might be.”
No generic warnings without a concrete exploit path, invariant break, or permanent fund risk.
For every finding, include:
- title
- severity
- affected contracts/functions
- exact root cause
- step-by-step exploit path
- impact
- why it is valid
- minimal remediation direction
Good prompts take time to craft and run and may also burn more tokens but they are worth it
Do not trust AI generated code. Review every diff manually. And looking at UI output or seeing tests pass is not enough.
Do not start from a simple basic prompt and ask the LLM to build a project. First, define the Architecture, security invariants, boundaries, coding conventions etc., and make sure the first 1000 lines of code are written by senior engineers following the architecture and best practices and core features. The next 10000 lines generated by AI will be decided based on the foundational code of those 1000 lines
Involve manual review and validations after every major AI step in the workflow. Vibe coding can be useful, but it cannot be a replacement for good engineers who have deep wisdom and understanding.
Run AI in least privilege environments only. It is very important not to give full access like unrestricted shell access or browser/computer control, unless it is absolutely needed.
Do not rely only on AI generated tests to validate AI generated code. Senior engineers should write test cases testing core functionalities and also in major areas like real integration tests, fuzzing to catch shallow coverage. Don't forget to perform penetration testing before release.
Do not allow AI suggested dependencies suggested by AI unless they are explicitly approved. Treat every new dependency as a risk. Verify that the package is actively maintained, comes from a legitimate publisher and is compatible with your license requirements.
Do not use vibe coding in some areas where a tiny mistake can cause real major damage for example code related to data deletion, billing, infra changes, auth, crypto, PII, financial systems, CI/CD, and build pipeline changes are very important and should have top senior engineers and experts involvement in every step
AI can help write code, but humans should own the architecture, security model and the final decision to review and deploy in production. Companies are slowly realizing it as they can't just vibe code production apps as they used to be marketed before. Vibe coding can be great for getting started, but shipping really reliable software requires planning, thinking and good senior engineers with deep expertise
For now you can think of AI as an amazing intern who is Fast, eager, and also wrong sometimes which it cannot see. Organization's wouldn't let an intern push directly to production without a proper review from top seniors, no matter whether tests are passed or Claude code compiles successfully. Also, production credentials and other environment access will not be given to them from day one unless it is really needed. So treat the current LLMs in the same way. Vibe coding can be a powerful acceleration tool for teams with good engineering discipline and it can be a liability for teams without it.
Need an audit for Web2 or Web3 systems - including vibe-coded apps in production? reach out directly to us.
Author: Ashish Lachuria
Security Researcher at TECHFUND