# Next.js 服务器操作中的服务器端请求伪造漏洞
## 概述
Next.js 是一个 React 框架,可以提供构建模块来创建 Web 应用程序。在 Next.js Server Actions 中发现了服务器端请求伪造(SSRF)漏洞。如果攻击者修改了 `Host` 头,并且满足以下条件,他们可以发起看似从 Next.js 应用服务器本身发出的请求。
## 影响版本
该漏洞已在 Next.js `14.1.1` 中修复。
## 细节
漏洞存在的条件包括:
1. Next.js 在自托管模式下运行。
2. Next.js 应用程序使用了 Server Actions。
3. Server Action 执行到一个相对路径的重定向,该路径以 `/` 开头。
## 影响
如果上述条件满足,攻击者可通过修改 `Host` 头,发起从 Next.js 应用服务器本身发出的请求,从而导致 SSRF 漏洞。
是否为 Web 类漏洞: 是
判断理由:
| # | POC 描述 | 源链接 | 神龙链接 |
|---|---|---|---|
| 1 | None | https://github.com/Voorivex/CVE-2024-34351 | POC详情 |
| 2 | None | https://github.com/alas1n/eslint-nextjs-cve-2024-34351-detector | POC详情 |
| 3 | PoC for a full exploitation of NextJS SSRF (CVE-2024-34351) | https://github.com/God4n/nextjs-CVE-2024-34351-_exploit | POC详情 |
| 4 | None | https://github.com/avergnaud/Next.js_exploit_CVE-2024-34351 | POC详情 |
| 5 | Next.Js, inferior to version 14.1.1, have its image optimization built-in component prone to SSRF. | https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2024/CVE-2024-34351.yaml | POC详情 |
| 6 | None | https://github.com/granita112/cve-2024-34351-tester | POC详情 |
暂无评论