---
title: "How we're using AI to make Next.js more secure"
description: "Why you're seeing more Next.js security advisories, and what we're doing about it."
url: "https://nextjs.org/blog/how-were-using-ai-to-make-nextjs-more-secure"
docs_index: /docs/llms.txt
publishedAt: November 17th 2026
---



If you’ve been following recent Next.js releases, you’ve seen an increasing number of security advisories over the past few years:

- 2024: 6 advisories
- 2025: 14 advisories
- 2026: 51 advisories (as of today)

While these numbers might seem alarming at first glance, Next.js is more secure today than it’s ever been.

In this post, we want to explain why you’re seeing more advisories, how we’re using AI to prevent security bugs in new code, and how we’re making it easier for all apps to ensure they’re always running a secure version of Next.js.

```
> 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
```

## Why are there more vulnerabilities?

The simple answer is that AI has made it much easier to find them.

Any popular open-source project with a working process for receiving security reports should expect to see an increase in advisories in the current era, as LLMs with ever-increasing capabilities are becoming more widely available.

But why the increasing number over time?

Part of the answer is that every framework has a backlog of edge-case bugs that were never discovered or were too impractical to exploit. With AI, finding and exploiting them has become cheap, turning these bugs from edge cases into risks that are now worth fixing.

Of the 51 vulnerabilities discovered this year, **70% of them were in code at least one year old**, with 43% coming from code three years or older. And we’re seeing this same pattern in other mature frameworks and programming languages across the industry.

<figure className="not-prose my-10">
  <figcaption className="mb-6 flex flex-wrap items-baseline gap-x-2 gap-y-2 uppercase text-copy-16! font-mono! text-gray-1000!">
    {'Vulnerabilities by code age'}
    <span className="text-gray-900">{'in 2026'}</span>
  </figcaption>
  <div className="grid gap-5">
    <div className="grid grid-cols-[96px_minmax(0,1fr)] items-center gap-3">
      <span className="text-label-13-mono text-gray-900">{'Under 1 year'}</span>
      <div className="flex items-center gap-3">
        <span
          aria-hidden="true"
          className="h-4 shrink-0 bg-blue-800/45"
          style={{ width: '50%' }}
        />
        <span className="text-label-13-mono text-gray-1000 tabular-nums">
          {'30%'}
        </span>
      </div>
    </div>
    <div className="grid grid-cols-[96px_minmax(0,1fr)] items-center gap-3">
      <span className="text-label-13-mono text-gray-900">{'1–3 years'}</span>
      <div className="flex items-center gap-3">
        <span
          aria-hidden="true"
          className="h-4 shrink-0 bg-blue-800/70"
          style={{ width: '45%' }}
        />
        <span className="text-label-13-mono text-gray-1000 tabular-nums">
          {'27%'}
        </span>
      </div>
    </div>
    <div className="grid grid-cols-[96px_minmax(0,1fr)] items-center gap-3">
      <span className="text-label-13-mono text-gray-900">{'3+ years'}</span>
      <div className="flex items-center gap-3">
        <span
          aria-hidden="true"
          className="h-4 shrink-0 bg-blue-800"
          style={{ width: '71.666667%' }}
        />
        <span className="text-label-13-mono text-gray-1000 tabular-nums">
          {'43%'}
        </span>
      </div>
    </div>
  </div>
</figure>

Additionally, this story is also playing out in our upstream dependencies.

Next.js includes optimizations to make every aspect of your site as fast as possible. One of the ways we do this is with image optimization, which many other frameworks leave up to you. But some of the image libraries we depend on have also come under increased scrutiny, and many of this year’s vulnerabilities have come from bugs in these libraries, rather than from Next.js itself.

In response to this new environment, we’ve been strengthening our security program to be more proactive, starting with putting systems and incentives in place to fix existing bugs before they can become exploits.

## Finding old bugs before attackers do

Here’s how we’re tackling the backlog of undiscovered bugs from older Next.js code.

### Bug bounty program

As a first line of defense, we run a [bug bounty program](https://hackerone.com/vercel) that pays researchers for novel vulnerabilities they discover. The goal of this program is to make it more economically profitable for someone to report a bug to us in private, rather than exploit it on their own.

And it's working, as many of the advisories you’ve seen over the past few years started out as bounty reports.

### Developing a security bot

While AI has made it easier for attackers to find existing bugs, it's also made it easier for us.

We used [Eve](https://eve.dev/) to develop an internal bot that helps us find vulnerabilities, triage incoming reports, build reproductions, affirm severity, and analyze whether fixes are comprehensive. This bot has helped our team move faster and handle a much higher load of inbound reports than ever before.

### Trail of Bits engagement

We also engaged the independent security firm Trail of Bits to conduct a manual security audit of Next.js.

Their team found issues that our other sources had missed, making the audit another important piece of our effort to secure the existing codebase.

---

With so many fixes landing from these processes, we needed to form a [new security release program](https://nextjs.org/blog/next-security-release-program) to help Next.js users apply patches on a predictable schedule. Releases now come out roughly once a month and are [announced in advance](/blog/security), so you can plan your upgrades, and hosting providers can put protections in place before details go public.

We're confident that as we burn down this latent inventory, we'll start seeing a change in the trend of advisories per year.

But what about avoiding bugs in new code?

## Preventing security bugs in new code

Like all teams at Vercel, we’ve been using AI to ship new features in Next.js faster than ever. Here are some steps we're taking to make sure these features don't add new bugs to the framework.

### Adversarial review bot

First, we partnered with the Vercel Agent team on their new [Security Review](https://vercel.com/blog/vercel-security-review) feature to make sure it would work well for Next.js. Vercel Agent now runs on every pull request to Next.js and tries to hack it using our own custom security guidelines.

<SecurityReviewComment />

No matter how small the PR is, or which part of the framework it touches, the agent looks at the change the way an attacker would, and tries to exploit it. It has already caught issues in PRs that had passed code review, had green CI, and were about to land, preventing new vulnerabilities from being released.

Combined with our work on the existing backlog, this means we should start to see the number of vulnerabilities shrink over time.

### Hardening service boundaries

We’re also using the vulnerability data we’ve collected so far to rearchitect parts of the framework that are especially susceptible to security risks.

While Next.js started out as a simple self-hosted tool that ran in Node.js, over the past ten years it has become a comprehensive full-stack framework that can work with any modern cloud provider and the primitives they offer, like proxy routing layers, CDNs, and various JavaScript runtimes.

Disagreements between these layers can be the source of a bypass, so we’ve been formalizing these seams with [Adapters](https://nextjs.org/docs/app/getting-started/deploying#adapters), a well-defined contract that tells hosting providers exactly how Next.js apps should be served.

As Adapters continue to mature and see more adoption, this category of bug should disappear entirely.

### Replacing vulnerable dependencies

We’ve also started taking a closer look at the dependencies we ship.

Out of all the vulnerabilities we’ve patched this year, many of the most serious issues weren’t even in the Next.js codebase itself. We get a lot of value out of third-party dependencies, but they’re not always designed with our precise requirements or threat model in mind.

Features like image optimization rely on libraries with broad capability and compatibility goals. These code paths are likely to touch untrusted user input, but they are also hard to scrutinize due to their size. Mismatches in requirements and threat models can leave us with weaker security guarantees than we want for everyone using Next.js.

In the case of image optimization, the community has already built alternative memory-safe codecs. Some of these are [in use in web browsers](https://blog.image-rs.org/2026/06/18/png-adoption.html), which face similar security challenges. By using AI to rapidly prototype integrations and iterate on sandboxing layers, [we’ve been able to adopt these modern codecs much faster than we otherwise could have](https://github.com/vercel-labs/next-safe-image-optimization). We look forward to sharing more of our progress in this area soon.

---

All of this makes Next.js more secure over time, but that only matters if you’re actually running a secure version in your own production apps.

So here’s how we’re making it easier for you to stay up-to-date.

## Keeping your apps secure

More security releases means more upgrades, so we've built some tools to help.

Starting in Next.js 16.4, `next dev` and `next build` tell you when the version you're running is affected by a known vulnerability. In development, the Next.js DevTools also shows a Vulnerability Insight, with a prompt you can copy straight into your coding agent.

<Image
  srcLight="/static/blog/how-were-using-ai-to-make-nextjs-more-secure/security-insight-light.png"
  srcDark="/static/blog/how-were-using-ai-to-make-nextjs-more-secure/security-insight-dark.png"
  width={1534}
  height={748}
  alt="Next.js DevTools Security Insight recommends upgrading to a safe version and provides a prompt to copy into a coding agent."
  caption="Next.js now shows an alert in dev if you're running an insecure version."
  figureProps={{
    className:
      'py-12 [&_figcaption]:mt-4 [&_figcaption]:text-center [&_figcaption]:text-copy-14 [&_figcaption]:not-italic [&_figcaption]:text-gray-900',
  }}
/>

If you'd rather hand off the whole upgrade, you can run:

```bash
npx next@canary upgrade --agent
```

This checks your version against our security advisories and picks the latest safe release. It stays within the oldest major version that has a fix, so you don't have to take on a major upgrade just to get a patch. Then, it hands the upgrade to your coding agent, along with matching migration guides, so the agent can apply the changes and verify that your app still works.

Learn more about [upgrading your app with a coding agent](/docs/app/guides/upgrading/agent-upgrade).

## Looking ahead

AI has certainly created new security challenges for open-source projects like Next.js, but it’s also created new opportunities. The recent uptick in vulnerabilities reflects bugs in older code that had gone undetected for years, and today, those bugs have been fixed.

As we continue aggressively investigating every new report, hardening our PR review process with fine-tuned security agents, and making it as easy as possible for you to keep your apps up-to-date with the latest security release, we’re more optimistic about the future of security in Next.js than we’ve ever been.

If you find a vulnerability in Next.js, please report it through our bug bounty program. Any questions about our security process can go to security@vercel.com.
