What I found in one vibecoded app
Mass assignment, client-trusted prices, unsigned Apple tokens, and an endpoint that handed out the entire user table, bank details and password hashes.
Introduction
A few weeks ago a founder reached out and asked if I could take a look at his vibecoded app. He gave me access to the code and I agreed.
What follows are some of the critical holes I found, in roughly ascending jaw-drop order.
1 Request and you are admin
I’m not going to spell out in minute detail what this app is and what these endpoints do. I assume you already know the very basics to understand this code.
So, straight to the point.
The user-profile update endpoint:
app.patch("/api/user/profile", async (req, res) => {
if (!req.isAuthenticated()) {
return res.status(401).json({ message: "Not authenticated" });
}
const userId = (req.user as any).id;
const updatedUser = await storage.updateUser(userId, req.body);
// ...
res.json(updatedUser);
});
The above function calls:
async updateUser(id: string, updateData: Partial<InsertUser>) {
const [user] = await db
.update(users)
.set({ ...updateData, updatedAt: new Date() })
.where(eq(users.id, id))
.returning();
return user;
}
And the users table:
export const users = pgTable("users", {
id: varchar("id").primaryKey().notNull(),
email: varchar("email").unique(),
// ...
role: varchar("role").default("General User"),
// ...
});
A sharp eye should’ve already spotted what’s wrong.
req.body is passed to the DB update with no field whitelist. Any authenticated user can PATCH /api/user/profile with {"role": "admin"} and become an admin. One request. Same primitive works for email, passwordHash, anything in the column list.
The fix is to define an allow-list of editable fields, validate the body against a schema (Zod, Valibot, whatever), and strip anything the user shouldn’t be able to set on themselves. This is OWASP’s A01 — Broken Access Control, the current #1 category in the Top 10 (2025 version).
Hold your horses, it’s only the beginning.
Checkout for a penny
The previous bug could be an omission even an experienced developer could make. But this one looks more like a deliberately-placed backdoor rather than an accidental omission.
The payment intent handler:
app.post("/api/create-payment-intent", async (req, res) => {
const { cartItems, shippingCost } = req.body;
const subtotal = cartItems.reduce((total, item) => {
const itemPrice = item.product?.price || item.price || 0;
return total + (itemPrice * item.quantity);
}, 0);
const baseAmount = subtotal + (shippingCost || 0);
const calculatedProcessingFee = (baseAmount * 0.05) + 0.30;
const totalAmount = baseAmount + calculatedProcessingFee;
const paymentIntent = await stripe.paymentIntents.create({
amount: Math.round(totalAmount * 100),
currency: "gbp",
// ...
});
// ...
});
The client sends the price. The server multiplies by quantity and charges Stripe that amount. Yes, client is the source of truth here. Open DevTools or Burp Suite, intercept the request, send {"price": 0.01, "quantity": 1} for any product. Checkout for a penny.
And the follow-up finding, which is almost worse: the payment intent ID is never persisted. Nothing retrieves the intent from Stripe to confirm it succeeded. There’s no webhook listener verifying payment_intent.succeeded with signature verification. I grepped, grepped the entire project for payment_intent.succeeded and stripe.paymentIntents.retrieve hoping it’s hiding somewhere, but no. It is never used in this app. The order endpoint — a 1000+ line monster, I’ll spare your eyes — just fulfills the order on form submit and trusts that money moved. And since the payment ID is not persisted anywhere, even without these 2 bugs, I could’ve replayed the same payment over and over again.
There is no check “has this payment been used for any past order?”
The fix is trivially simple - look up prices from your own database by product ID on the server, never read them from the request body. Persist the payment intent ID with the order. Set up a Stripe webhook with signature verification and only fulfill once you see payment_intent.succeeded.
“trust me, bro” Apple sign-in
The Apple Sign-in handler:
export async function handleAppleSignIn(claims: AppleUserClaims) {
const { appleUserId, email, firstName, lastName } = claims;
// Block "Hide My Email" — Apple Privacy Relay emails
if (email && email.endsWith("@privaterelay.appleid.com")) {
return { user: null, error: "APPLE_HIDE_EMAIL_BLOCKED" };
}
// Require email for identity verification
if (!email) {
return { user: null, error: "APPLE_NO_EMAIL" };
}
let user = await storage.getUser(`apple_${appleUserId}`);
if (!user) {
const existingUser = await storage.getUserByEmail(email);
if (existingUser) user = existingUser;
}
if (!user) {
user = await storage.createUser({
id: `apple_${appleUserId}`,
email,
firstName,
lastName,
role: "General User",
emailVerified: true,
// ...
});
}
return { user };
}
claims is the input. Nothing validates that these claims actually came from Apple.
Apple returns an identity token — a JWT signed with ES256 using one of Apple’s rotating keys. The signature is the entire point. Verify it against Apple’s JWKS at https://appleid.apple.com/auth/keys, check iss == https://appleid.apple.com, aud == your client id, exp, and the nonce you issued. Then trust the claims inside.
Here, none of that happens. Whoever can hit the endpoint feeding this function logs in as any existing user by sending {"appleUserId": "x", "email": "victim@example.com"} — or by matching an existing account via the email-linking branch. If no account exists, they can create one with any email, pre-verified (emailVerified: true, right there in the create call).
The irony - there’s careful logic to block Apple’s “Hide My Email” relays and a comment that says “Require email for identity verification” - right next to the hole that lets you fabricate the identity entirely.
Bank details giveaway
I am not joking, it really does.
The users endpoint:
app.get("/api/users", async (req, res) => {
const users = await storage.getAllUsers();
res.json(users.map(user => {
const { password, ...userWithoutPassword } = user;
return userWithoutPassword;
}));
});
One curl "https://.../api/users" and you have the entire users table returned in response. Yes. Every single user, every single row.
It is intended to be accessible only by admin users - the only page requesting it is the admin dashboard. But something went wrong…
There is no isAuthenticated nor requireAdmin middleware on this endpoint. The only admin check in the entire flow was a frontend React redirect on the admin page - which is a UI decision, not an access control. The endpoint did not care who called it.
One anonymous request returned 1,100+ accounts in 12.6 MB of JSON. It included 929 phone numbers, 329 postal addresses, 106 delivery addresses, 42 sets of bank details - account holder name, bank name, sort code, account number - and 46 plaintext guest passwords.
The fix was to add requireAdmin middleware to the endpoint, which already existed, but seems like LLM’s next token prediction didn’t care.
Well, at least it excluded the password hash from the response, thanks for that. Wait…
My password hash is …
The previous endpoint removed password from the response. This single-profile endpoint did not:
app.get("/api/user-profile/:id", async (req, res) => {
const user = await storage.getUser(req.params.id);
//...
const userProfileData = {
user: {
...user
},
stats: { ... }
};
res.json(userProfileData);
}
user is the ORM row. So the response included the bcrypt password hash, email, phone number, postal address, delivery address, date of birth, banking details and guest default password - to anyone who asked, no auth required.
The same pattern shows up elsewhere. A public search endpoint returned full user rows, password hashes included. The order endpoints stripped password and shipped the rest of the row to the other party: buyers received sellers’ bank details, sellers received buyers’. One public endpoint exposed any user’s purchase history.
Ironically, there was a protected route, sitting a few thousands lines below this one. But having the same path, the first match wins - meaning this one shadowed the protected one, and the protected one was dead code.
The fix is not another destructure. Define an allow-list helper function/serializer per audience - public user, public profile, order counterparty - and use it at the response boundary. Never res.json(ormRow).
Takeaway
Every one of these is WebDev 101 material. Mass assignment, trusting the client, trusting an unsigned token, and treating an ORM row as a response DTO. I did not need adversarial creativity to find them - I spotted them by reading the code.
An LLM will happily emit code that looks like an auth handler, a payment handler, a profile handler, a sanitiser - the shape is right. The semantics are not. It will remove password with a destructure and ship the other thirty columns. It will put the admin check on frontend. It will write the guarded route and then register a public one above it. The shape of “security” is indistinguishable from security to a reader who doesn’t know what the code is supposed to defend against. And the shape is all the LLM is giving you.
When used right, AI gives you a noticeable boost in productivity, no doubt - and that’s silly to deny this and keep typing code by hand, producing 300 lines per day. But when AI is used wrong - when you let it do literally everything for you - well, you see what happens.
Take care and see you soon.