Skip to content

Conversation

@vercel
Copy link

@vercel vercel bot commented Dec 6, 2025

A critical remote code execution (RCE) vulnerability in React Server Components, impacting frameworks such as Next.js, was identified in the project ai-sdk-preview-internal-knowledge-base. The vulnerability enables unauthenticated RCE on the server via insecure deserialization in the React Flight protocol.

This issue is tracked under:

This automated pull request upgrades the affected React and Next.js packages to patched versions that remediate the issue.

More Info

## React Flight / Next.js RCE Advisory Patch Implementation

### Summary
Updated the repository to address the React Flight / Next.js RCE advisory by upgrading Next.js to a patched version. The project was confirmed to be affected and has been successfully patched.

### Vulnerability Detection
- ✅ Project uses Next.js: `[email protected]` 
- ✅ No React Flight packages detected (not vulnerable directly)
- ✅ Project affected via Next.js dependency

### Changes Made

#### 1. Upgraded Next.js (package.json)
- **File**: `package.json`
- **Change**: Upgraded `next` from `15.0.0-canary.152` to `15.0.5`
  - The version `15.0.0-canary.152` falls under the `15.0.x` category
  - Per the advisory, `15.0.x` versions should be patched to `15.0.5`

#### 2. Updated Lockfile (pnpm-lock.yaml)
- **File**: `pnpm-lock.yaml`
- **Action**: Ran `pnpm install` to resolve dependencies
- **Verification**: Lockfile now contains `[email protected]` and all dependencies are correctly resolved

#### 3. Fixed Next.js 15 Compatibility Issue (utils/kasada/kasada-server.ts)
- **File**: `utils/kasada/kasada-server.ts`
- **Issue**: Next.js 15 removed the `request.ip` property from NextRequest
- **Solution**: Updated code to extract IP from headers using `request.headers.get("x-real-ip")` or `request.headers.get("x-forwarded-for")`
- **Locations fixed**: 3 locations where `request.ip` was used

### Build Verification
- ✅ `pnpm install` completed successfully with all dependencies resolved
- ✅ `next build` completed successfully with no errors
- ✅ All routes compiled without type or compilation errors
- ✅ Production build output generated successfully

### Notes
- React and react-dom were NOT modified (they are not vulnerable)
- No React Flight packages were found in the project, so no action needed there
- The Next.js upgrade is the only required change for this RCE vulnerability
- The compatibility fix in kasada-server.ts was necessary to maintain build stability after the Next.js upgrade

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
@vercel
Copy link
Author

vercel bot commented Dec 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ai-sdk-preview-internal-knowledge-base Ready Ready Preview Comment Dec 6, 2025 6:21am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant