Back to skill

Security audit

Next.js Production Engineering

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent Next.js guidance, but its production authentication example can accidentally leave protected pages unprotected.

Review this skill before installing if you might ask it to add authentication. Do not copy its middleware auth snippet as-is; require verified sessions through Auth.js, a trusted session store, or signed-token validation, and add tests for protected routes. The rest of the package appears to be ordinary Next.js production guidance rather than malicious behavior.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:357
Finding

Authentication Bypass Through Unverified Session Cookie

Content
View full analysis
pathname.startsWith(route))) { // Redirect authenticated users away from auth pages if (token && authRoutes.some(route => pathname.startsWith(route))) { return NextResponse.redirect(new URL('/dashboard', request.url)) } return NextResponse.next() } // Protected routes — require auth if (!token) { const loginUrl = new URL('/login', request.url) loginUrl.searchParams.set('callbackUrl', pathname) return NextResponse.redirect(loginUrl) } return NextResponse.next() } ``` ### Technical Analysis The middleware considers a request authenticated whenever the `session` cookie contains any non-empty value. It does not cryptographically verify the cookie, resolve it against a trusted server-side session store, or validate properties such as expiration, revocation status, issuer, or audience. Cookies are controlled by the requesting client. Unless another trusted layer independently validates the session, an attacker can create an arbitrary `session` cookie and satisfy the middleware’s only authentication condition. This pattern is especially hazardous because it is presented as a production authentication pattern. Applications that copy it may rely on the middleware as their primary access-control boundary. Route-level authorization does not correct the middleware flaw unless every protected page, API handler, and Server Action independently validates the authenticated session. ### Attack Path 1. The ...[truncated 1407 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The middleware example is logically broken because publicRoutes includes '/' and the check uses pathname.startsWith(route), which makes every path match as public. If copied into a real app, protected routes would become accessible without authentication, causing a complete authentication bypass at the routing layer.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 146)May include surrounding context.

tsx
// Static data (cached indefinitely, revalidated on deploy)
const data = await fetch('https://api.example.com/data', {
  cache: 'force-cache'  // Default in App Router
})

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

tsx
// Static data (cached indefinitely, revalidated on deploy)
const data = await fetch('https://api.example.com/data', {
  cache: 'force-cache'  // Default in App Router
})

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 156)May include surrounding context.

tsx
// Static data (cached indefinitely, revalidated on deploy)
const data = await fetch('https://api.example.com/data', {
  cache: 'force-cache'  // Default in App Router
})

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 161)May include surrounding context.

tsx
// Static data (cached indefinitely, revalidated on deploy)
const data = await fetch('https://api.example.com/data', {
  cache: 'force-cache'  // Default in App Router
})

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file defines activation-style commands such as "Optimize performance," "Add authentication," and "Audit my app" that are common requests and are not bounded by explicit invocation context, trigger matching rules, or negative examples. That ambiguity increases the chance the skill could be invoked for general conversation or unrelated engineering tasks rather than only when the user intends this specific skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example config restricts font subsets to latin and sets <html lang="en">, which reflects a fixed language/locale assumption in natural-language-facing application output. Because the document does not present this as optional, user-selected, or region-specific, it conflicts with the policy against forcing a specific language or locale without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.