nextjs-cache-poisoning

Detect and exploit Next.js cache poisoning via header manipulation and stale cache entries.

11|1|Updated May 4, 2026
One-click install
npx skills add https://github.com/dreadnode/capabilities --skill nextjs-cache-poisoning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-cache-poisoning
Source: https://github.com/dreadnode/capabilities/tree/main/capabilities/web-security/skills/nextjs-cache-poisoning
Command: npx skills add https://github.com/dreadnode/capabilities --skill nextjs-cache-poisoning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of identifying and validating internal cache poisoning vulnerabilities in Next.js applications that arise from misconfigured stale cache settings and insufficient header validation, which can allow attackers to inject malicious content served to multiple users via shared caches.

Core Features & Use Cases

  • Vulnerability Detection: Identifies viable Next.js cache poisoning targets by checking for x-nextjs-cache headers and s-maxage/stale-while-revalidate cache directives.
  • Exploitation Execution: Injects test content via x-now-route-matches header manipulation to poison both SSR page responses and JSON data endpoints under /_next/data/.
  • Impact Validation: Confirms cross-user cache impact by verifying poisoned content is served to other users, not just the attacker's session, and provides steps to maintain poisoned entries during the stale-while-revalidate window.
  • Use Case: Red teamers assessing Next.js applications can use this Skill to test whether misconfigured shared cache settings allow persistent, cross-user content injection without direct application vulnerabilities.

Quick Start

Use the nextjs-cache-poisoning skill to test a target Next.js application for cache poisoning vulnerabilities by identifying routes with viable cache settings, injecting test content via header manipulation, and confirming the poisoned response is served to other users.

Frequently Asked Questions about nextjs-cache-poisoning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Next.js applications for cache poisoning vulnerabilities?

Detect Next.js cache poisoning by checking for x-nextjs-cache headers and s-maxage directives, then injecting test content via x-now-route-matches header manipulation. This validates if poisoned SSR routes and JSON data endpoints persist for other users.

What is Next.js internal cache poisoning via stale cache entries?

Next.js internal cache poisoning exploits misconfigured stale-while-revalidate cache directives to inject malicious content into shared caches. This poisoned content is subsequently served to other users accessing the same SSR routes.

Can I poison JSON data endpoints in Next.js using header manipulation?

Yes, you can poison Next.js JSON data endpoints by manipulating the x-now-route-matches header to inject test content into /_next/data/ routes. This confirms cross-user cache impact for JSON endpoints alongside SSR page responses.

How do I validate cross-user impact for Next.js cache poisoning?

Validate cross-user Next.js cache poisoning by confirming the injected content is served to other users beyond the attacker's session. Maintaining poisoned entries during the stale-while-revalidate window proves persistent cross-user impact.

What cache indicators indicate a Next.js app is vulnerable to cache poisoning?

Next.js cache poisoning indicators include x-nextjs-cache headers and s-maxage or stale-while-revalidate directives. Applications with these shared cache configurations are vulnerable to cross-user content injection.

Does Next.js cache poisoning work for red teaming shared cache configurations?

Yes, Next.js cache poisoning applies to red teaming scenarios targeting shared cache configurations using s-maxage directives. It detects persistent cross-user content injection without exploiting direct application vulnerabilities.