51 Next.js Vulnerabilities in a Year: How AI Broke the Old Security Balance and How Vercel Fights BackArticle · digest for November 19
51 Next.js Vulnerabilities in a Year: How AI Broke the Old Security Balance and How Vercel Fights Back
Article4 sections≈ 7 min

51 Next.js Vulnerabilities in a Year: How AI Broke the Old Security Balance and How Vercel Fights Back

Open the security feed for Next.js and you might do a double take: more than fifty security advisories have landed in 2026 alone, compared to a handful two years ago. From the outside, it looks like the framework is falling apart. Yet on the Next.js blog, the team claims it's more secure than at any point in its ten-year history.

That sounds like spin at first. Once you see how AI broke the economics of finding bugs in open source, though, the paradox makes complete sense.

Why Old Code Suddenly Started Looking Leaky

A security advisory is an official notice from a framework's maintainers detailing a discovered flaw, its severity, and the patched version. Over two years, Next.js advisory counts shot up.

Next.js security advisories by year

The obvious guess is that code quality collapsed, but that's not what happened. Every mature project accumulates rare bugs in obscure code paths over the years. When finding one took weeks of expensive manual auditing, minor risks went untouched. Capable LLMs flipped that math: scanning an open-source repo with a model now costs pennies. Once old bugs become cheap to find and exploit, maintainers can't ignore them—they have to patch them and publish an advisory.

That shows up clearly when you sort recent findings by the age of the vulnerable code rather than the patch date.

Age of vulnerable Next.js code found in 2026

Most of these flaws aren't fresh mistakes at all—they are old bugs that sat quietly in production for years. The same wave is hitting other mature projects too, from browsers to programming languages.

There's a second layer as well. Plenty of serious vulnerabilities didn't come from Next.js code itself, but from external image-optimization libraries under next/image. Legacy general-purpose graphics libraries are huge, parse untrusted files from the internet, and make prime targets for AI scanners.

How the Team Clears the Backlog of Old Bugs

Waiting for attackers to find old holes is a losing game. Vercel decided to clear its hidden security debt first across four fronts.

The first line of defense is a bug bounty program on HackerOne, paying researchers to report flaws privately. The goal is simple: make disclosing a bug privately more rewarding than exploiting it quietly. According to the team, a large share of advisories started as bounty reports.

Next, they fight fire with fire. Inside Vercel, engineers built a security bot on top of the Eve framework. It hunts for weak spots and handles incoming reports—triaging them, building minimal reproductions, assessing severity, and verifying whether a patch fully closes the hole.

They don't trust bots blindly, though. The team also brought in independent auditors from Trail of Bits. Human auditors did uncover issues that both the bot and bounty hunters had missed.

Once fixes started landing in batches, unscheduled releases became a headache for everyone. That led to the Next.js Security Release Program. Patches now ship on a predictable monthly cadence with advance notice of the window and maximum severity. Teams can schedule updates calmly, and hosting providers can update firewall rules before details go public. Out-of-band releases happen only for actively exploited flaws.

An Adversarial Bot on Every PR, Adapters, and Safer Codecs

The Next.js team also uses AI to write code faster, which raises the odds of shipping a fresh bug. To counter that, every pull request goes through an adversarial review bot called Vercel Agent.

An adversarial review bot isn't a style linter. On every GitHub push, it reads the diff like an attacker and tries to craft an exploit against Next.js security rules. It checks every PR and has already caught flaws after human reviewers approved and CI passed green.

One telling example was PR #95594, which added a curl hint in packages/next/src/server/lib/curl-agent-hint.ts:

// Vulnerable code from PR #95594 (curl-agent-hint.ts)
export function buildCurlAgentHint(
  pathOnly: string,
  url: string,
  userAgent: string
): string {
  // The developer stripped angle brackets from User-Agent
  const safeUa = String(userAgent).replace(/[<>]/g, '')
  return [
    '<!doctype html>',
    '<html><head><meta charset="utf-8">',
    '<title>Next.js dev server — agent hint</title></head>',
    '<body>',
    // But pathOnly (and url below) went into HTML unescaped:
    // the bot flagged this as Reflected HTML/script injection
    `<p>You requested <code>${pathOnly}</code> ` +
      `with a command-line HTTP client ` +
      `(User-Agent: <code>${safeUa}</code>).</p>`,
  ].join('\n')
}

The painful part is that the author remembered to sanitize userAgent into safeUa, then dropped pathOnly and url straight into HTML. That creates reflected HTML/script injection, where unsanitized request URL data lands in the response markup and lets an attacker inject tags or JavaScript. Standard tests stayed quiet, but the bot sounded the alarm right away. At high commit velocity, tired human eyes aren't enough—a dedicated "hostile" agent in CI catches those blind spots.

At the same time, the team is fixing two systemic weak spots. First is the seam between proxies, CDNs, and runtimes, where differing route interpretations cause auth bypasses. They introduced Next.js Adapters—a strict Adapter API contract for hosting providers backed by an official test suite. Vercel and Bun already have verified adapters, while Cloudflare and Netlify are finishing theirs; elsewhere, discrepancies remain on the provider.

The second weak spot is legacy C/C++ image libraries with memory bugs like buffer overflows. To replace them, Vercel is prototyping sandboxed memory-safe codecs similar to how browsers isolate media decoding. The experimental next-safe-image-optimization repo is already public, though not ready for production yet.

What Changes for You: Dev Alerts and Agent Upgrades

All that defense doesn't help if your app stays stuck on an old version. Starting with Next.js 16.4, next dev and next build check your version against the advisory database and warn you right in the terminal:

> npm run dev

⚠️ Installed Next.js version 16.4.0 is affected by a known
security vulnerability.

Next.js security version upgrade available: 16.4.0 -> 16.4.5

❯ Upgrade now
  Skip
  Skip until next version

You can snooze the warning until the next release, and Next.js DevTools in the browser adds a Vulnerability Insight tab with a ready-made prompt to paste into your coding agent.

If you want the CLI itself to handle the upgrade chore, the agent upgrade docs introduce the --agent flag:

# 1. Default security policy:
# installs the nearest safe patch without jumping major versions
npx next@canary upgrade --agent

# 2. Upgrade to latest stable (or canary for canary projects)
npx next@canary upgrade --agent=latest

# 3. Run from a monorepo root for a specific package
npx next@canary upgrade apps/web --agent=latest

# 4. Move to latest + upcoming defaults (e.g., Cache Components)
npx next@canary upgrade --agent=experimental-future

Using canary here only fetches the newest CLI upgrader itself—under the security policy, your app stays on a stable branch within the lowest suitable major version. Under the hood, the CLI pulls migration guides and Skills into a temp folder, then offers to launch local Claude Code or Codex (with model, reasoning effort, and isolated Git worktree options) or prints a task prompt for another agent. Your chosen policy is saved in next.config under experimental.agentUpgrade, where setting false turns off reminders.

Keep expectations realistic: upgrade --agent is still officially experimental, so never ship agent edits to production without running tests and reviewing the diff. Also, --agent doesn't combine with --revision, and the security policy only supports stable versions—canary apps must use latest or experimental-future.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 7