Scorecard of five AI-built SaaS apps pentested by the NoMoreBreach Team

Vibe Coding Security: We Pentested 5 AI-Built SaaS Apps

We gave five AI coding agents the same prompt: build a multi-tenant file-sharing SaaS called TeamVault. It needed teams, roles, file uploads, a billing plan field and an admin page. Then we spent a day trying to break into each build.

We expected IDOR everywhere, because that’s the usual story about AI-written apps. We didn’t find a single cross-tenant bug. What we found instead was a session secret printed in a README, an admin account with a password anyone could look up, and login forms that let us guess passwords forever. One build had all three.

Here’s what we did, what broke, and the exact requests behind it.

Key takeaways

  • No cross-tenant or role bugs in any of the five builds. Authorization was in the prompt, and every agent built it.
  • The failures were all things the prompt didn’t mention: a fallback session secret, a seeded admin, no login throttling, weak hash cost, unsafe file serving.
  • The worst build let us forge an admin cookie with a key printed in its own README.

The setup

Every builder got the same six-point prompt, one shot, no follow-ups. The prompt said nothing about security. That was deliberate: we wanted to see what an agent does when a founder simply asks for the product. In short, the prompt asked for:

  • email and password signup, login and logout
  • teams with owner, admin and member roles; owners add users by email
  • per-team file upload, list and download
  • a free/pro plan field that only the owner can change
  • an /admin page for site administrators
  • SQLite and local disk, a README, “make sure it starts”

We ran seven builders on 11 November 2026 and five produced a working app:

Build Harness Model Result
B1 Claude Code 2.1.322 claude-opus-5-5 built
B2 Claude Code 2.1.322 claude-sonnet-5-5 built
B3 Claude Code 2.1.322 claude-haiku-5-5 built
B4 opencode 2.1.4 deepseek-v4.1-flash (free tier) built
B5 opencode 2.1.4 qwen2.5-coder:7b, local no files; printed its tool call as text
B6 aider 0.86.2 qwen2.5-coder:7b, local not run (blocked by our own sandbox policy)
B7 opencode 2.1.4 glm-5.3-flash (free tier) built

We wrote the test plan before any build finished: nine checks per app. We started each app from a fresh data directory on 127.0.0.1, created four users across two teams (alice and bob as owners, mallory as a member of alice’s team, and eve for mass-assignment probes), then ran scripted requests and read the source. Every verdict in this post links back to a raw request and response or a file and line number in our notes.

Know the limits before you quote any of this. It’s five apps, one prompt and one run each. A rerun tomorrow could produce a different app. Three of the five working builds came from one vendor’s models, because those were the ones we could run without new accounts. We didn’t test hosted builders like Lovable, Bolt or v0; their managed backends are a different risk surface. Treat it as five data points, not a model ranking.

The scorecard

Pass means the control was enforced server-side and our bypass failed. Fail means we bypassed it live or the control wasn’t there at all. Partial means no working exploit, but a standard defence is missing or below the published minimum.

Check B1 B2 B3 B4 B7
Cross-tenant access (IDOR) Pass Pass Pass Pass Pass
Role checks Pass Pass Pass Pass Pass
Mass assignment Pass Pass Pass Pass Pass
Secrets / default creds Pass Pass Pass Pass Fail
Sessions / password hashing Pass Pass Partial Partial Fail
Login rate limiting Pass Pass Fail Partial Fail
Upload handling Pass Pass Pass Partial Partial
Security headers Pass Pass Pass Pass Fail
CSRF Pass Pass Partial Pass Pass

Out of 45 cells, that’s 34 Pass, 6 Partial and 5 Fail. B1 and B2 were clean. Four of the five Fails belong to B7.

What they all got right

Every build scoped data access to team membership. Using mallory’s session, we tried to view, download and upload bob’s team’s files, change his plan and add ourselves to his team. Every attempt got a 404 (B7 returned 403). Members couldn’t promote themselves, add admins or remove the owner. We also added is_admin=1, role=owner and plan=pro to the signup and team-creation forms; every build ignored or rejected the extra fields.

All five used parameterised SQL and auto-escaping templates. That came from code review only; we didn’t fuzz for injection.

Authorization was in the spec. “Only the team owner can change it” is a requirement, and every agent implemented it. The problems were all in the parts the prompt didn’t mention.

B7: a session secret anyone could read

B7 rolled its own session cookie: a base64url JSON payload with an HMAC signature. That design is fine if the key is secret. Here’s how B7 loads the key (server.js, lines 26-27):

app.use(
  sessionMiddleware(process.env.SESSION_SECRET || '<redacted>')

If SESSION_SECRET isn’t set, the app falls back to a fixed string. The README’s environment-variable table lists that same string as the default. Anyone who has seen the repo has the key.

The cookie format is simple (src/session.js):

function serialize(session, secret) {
  const payload = b64url(JSON.stringify(session));
  return `${payload}.${sign(payload, secret)}`;
}

So we signed {"userId":1} ourselves, without logging in:

GET /admin HTTP/1.1
Host: 127.0.0.1:5107
Cookie: teamvault.ses=<forged {"userId":1}>

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

User 1 is the seeded site admin, so we had the admin page. We then forged bob’s user id and pulled his team’s file:

GET /teams/2/files/1/download
Cookie: teamvault.ses=<forged {"userId":3}>

200, Content-Disposition: attachment; filename="bob-secret.txt"

Nothing was wrong with the tenancy check. The server asked “is user 3 a member of team 2?” and got a correct answer. It just had no way to know the attacker wasn’t user 3.

It gets worse. On first boot, B7 seeds a site admin (src/db.js):

function seedAdmin() {
  const email = process.env.ADMIN_EMAIL || 'ad***@*******lt.local';
  const password = process.env.ADMIN_PASSWORD || '<redacted>';

Both defaults are in a README table titled “Default site administrator”, and logging in with them worked. Logout doesn’t help either. The handler just sets req.session = null and tells the browser to drop the cookie. The cookie itself carries no expiry and there’s no server-side session to delete. A cookie we captured before logout still loaded /teams afterwards. Steal one, and it stays valid until someone rotates the secret.

B7 also sends no security headers, and it has no .gitignore, so the SQLite file with password hashes gets committed by default. And on the very first boot with an empty data directory, it crashes on every logged-in request because of a circular require between db.js and helpers.js. The agent never saw that crash, because its own smoke test reused a data directory that already existed. We tested B7 after a second boot.

B7 documented its weak defaults in the README, with a note to change them for production, instead of fixing them. If you deploy it without setting those environment variables, you ship them.

Login forms nobody throttles

B3 has no rate limiting, and its README says so: “There is no rate limiting on login or sign up.” We sent 60 wrong passwords for alice from one IP and got 60 responses of 401. B7 behaved the same way.

B4 is more interesting, because it looks protected. One account from one IP gets a 429 on the 9th attempt. But look at the limiter key (src/routes/auth.js, line 42):

const limiterKey = `${req.ip}|${email}`;

Each IP and email pair gets its own bucket. Try one common password against 20 different accounts and you never hit a limit; we got 20 responses of 400 and no 429. That’s password spraying, and it’s how most credential attacks on SaaS logins actually work. A limiter keyed on the pair stops the attack nobody runs.

B1 limits per email and per IP separately (429 on the 11th attempt). B2 limits per IP only, so it would miss a distributed attack on one account; we still scored it a Pass for this test. Every limiter we found keeps its counters in process memory, so they reset on restart and aren’t shared across instances. That’s fine for a demo, but not once you run more than one instance.

Smaller issues

Password hashing. B3, B4 and B7 call Node’s crypto.scrypt with its default cost (N=214, r=8, p=1). The OWASP Password Storage Cheat Sheet lists N=217 as its minimum at p=1. That’s roughly 8x cheaper for an attacker who has dumped the database. It isn’t broken, but it’s below the minimum. B1 and B2 use bcrypt at cost 12.

Uploaded files keep their type. B4 stores uploads under UUID names, so path traversal didn’t work; a filename of ../../../../../../tmp/nmb-pentest-traversal.html just became a UUID. It keeps the original extension, though, and Express’s res.download() picks the Content-Type from that extension. Our test HTML file came back as text/html. Content-Disposition: attachment, nosniff and a strict CSP stop it from running in a current browser, so this isn’t stored XSS today. Only the attachment header is doing the work, and if someone later adds an inline preview, it becomes XSS. B7 does the same with no CSP and no nosniff behind it. B1 and B2 serve every upload as application/octet-stream with a sandbox CSP, which is the right answer.

CSRF that fails open. B3 has no CSRF tokens. It relies on SameSite=Lax cookies plus this check:

const origin = req.headers.origin;
if (origin) {
  // reject if origin host != request host
}
next();

If there’s no Origin header, the request goes through. A POST to /teams/1/plan with alice’s cookie and no Origin header changed the plan to pro; with Origin: http://evil.example it got a 403. Current browsers send Origin on cross-site form posts, so we couldn’t turn this into a browser exploit. Still, the OWASP CSRF cheat sheet says not to skip validation when Origin is missing, and a check that fails open is one proxy or browser quirk away from not working.

Admin bootstrap that promotes strangers. We didn’t score this one. If you set ADMIN_EMAIL on B4 and an account with that email already exists, startup promotes that account to site admin. Signup has no email verification, so anyone who registers your intended admin email first becomes admin on the next restart.

What we took from it

The agents built what the prompt asked for, and did it well. Tenancy, roles and input handling were solid in all five. What they didn’t build was anything the prompt didn’t ask for: real secret management, revocable sessions, throttling that matches real attacks, proper hash cost, and safe file serving. You won’t notice any of that in a demo. You’ll notice it in a breach, or in an enterprise customer’s security questionnaire.

The two clean builds came from the two largest models in the set, and both Fails came from smaller ones. That’s consistent with what you’d expect, but five builds can’t separate model, harness and luck, so we aren’t claiming it.

Other research puts this in context. Veracode (July 2025) found vulnerabilities in 45% of AI-completed coding tasks, but those were snippets, not whole apps. SecurityWeek’s write-up of a Tenzai study reports authorization flaws, which we didn’t see. Our spec was narrow and our sample small, so we’d still test authorization first on any real app.

If an agent wrote your app, check these first

These checks take about half an hour and cover every failure above.

# 1. Fallback secrets and seeded accounts
grep -rnE "process\.env\.[A-Z_]+ *(\|\||\?\?) *['\"]" --include=*.js --include=*.ts . | grep -v node_modules
grep -rniE "seed|default.*(admin|password)" --include=*.js --include=*.ts . | grep -v node_modules

# 2. Throttling: same account, then many accounts
for i in $(seq 1 30); do curl -s -o /dev/null -w "%{http_code} " -d "email=yo*@*.com&password=wrong$i" https://app/login; done
for u in $(cat emails.txt); do curl -s -o /dev/null -w "%{http_code} " -d "email=$u&password=Spring2026!" https://app/login; done

# 3. Log in, save the cookie, log out, replay it. Anything but a redirect to login is a bug.

# 4. Upload test.html and test.svg, download them, read the Content-Type.

# 5. Check your hash cost: bcrypt >= 10, scrypt N >= 2^17, or Argon2id m=19MiB t=2.

And the fixes, roughly in order of how much they matter:

// No fallback. Refuse to boot without a real secret.
const SESSION_SECRET = process.env.SESSION_SECRET;
if (!SESSION_SECRET || Buffer.byteLength(SESSION_SECRET) < 32) {
  throw new Error('SESSION_SECRET must be set (32+ random bytes)');
}

// Throttle on two independent keys, in a shared store (Redis etc.).
if (!byEmail.allow(email) || !byIp.allow(req.ip)) return res.status(429).end();

// Serve uploads as inert bytes, whatever the extension.
res.attachment(file.originalName);
res.set({
  'Content-Type': 'application/octet-stream',
  'X-Content-Type-Options': 'nosniff',
  'Content-Security-Policy': "sandbox; default-src 'none'",
});

Beyond that, use server-side sessions you can delete on logout, create the first admin with a one-time CLI command instead of a seeded password, and put CSRF tokens on every state-changing request.

The prompt is also where you can fix this. Next time you ask an agent for an app, add “no default secrets or seeded credentials; throttle login per account and per IP; serve uploads as octet-stream”. We didn’t test whether that works. We may next.

FAQ

Are AI-built apps full of IDOR?

Not in our five builds. Each one checked team membership on every lookup. Other studies have found authorization bugs, so test it anyway: two accounts, two teams, swap the IDs.

Would adding “make it secure” to the prompt fix this?

We didn’t test it. Our prompt had no security wording on purpose. Naming the specific controls is more likely to work than a vague instruction, and you still need to verify the result.

What’s the fastest check on an AI-built app?

Grep for process.env.X || '...' fallbacks and seeded users. Most of the damage in our run came from those two patterns.

Want a human to try this on your app?

This is what our web and API pentests do: we test tenancy, sessions, defaults and everything else an agent wasn’t told to build. If you’re facing a SOC 2 audit or an enterprise questionnaire, our SOC 2 pentest guide covers what auditors actually look for. Or start with a free external snapshot, no access needed.

Last updated 11 November 2026. Tested 11 November 2026 by the NoMoreBreach Team. All testing was on our own local builds. Secrets and session values in this post are redacted.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *