Skip to content
Access control Write-up Intermediate

We fixed a critical auth bypass in Cloudflare's AI-generated Next.js

In viNext's Pages Router, named proxy exports in proxy.ts were silently ignored in production builds, so authentication or authorisation logic defined there disappeared. An attacker could reach private routes or unauthenticated areas that the proxy was meant to protect.

cubic.dev

Published on cubic.dev

Cloudflare's pitch for viNext was straightforward: a project that would normally take months, maybe years, shipped in under a week by one engineer with about $1,100 of model spend.

The author, on cubic.dev

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The generated code looked for a default export or a middleware export but never checked for a proxy export in its fallback chain.

Impact

Authentication and authorisation checks in proxy.ts could be bypassed in production, allowing access to private routes or tenant data, though the text does not detail a specific exploit.

What the attacker needed

Application uses proxy.ts for auth; production build

The fix

The fix was submitted as a pull request and merged upstream, adding the missing proxy export to the fallback chain.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A proxy file is where developers put checks like 'send logged-out users to the login page'. In this framework, a particular way of writing that file worked when testing locally but was skipped in the real deployed version, so the checks never ran. That means anyone could reach pages that were supposed to be protected.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.