{"id":1588,"cve":"CVE-2026-0769","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-0769\/","cwe":"CWE-95","cwe_number":95,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/95","cvss_score":9.8,"published":"2026-01-23","owasp":"A03 Injection","odc":"Checking","cdc":"Missing Check","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Remote","impact":"Arbitrary Code Execution","summary":"Langflow's eval_custom_component_code is vulnerable to unauthenticated RCE.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-0769\/","description":"Langflow eval_custom_component_code Eval Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Langflow. Authentication is not required to exploit this vulnerability.  The specific flaw exists within the implementation of eval_custom_component_code function. The issue results from the lack of proper validation of a user-supplied string before using it to execute python code. An attacker can leverage this vulnerability to execute code in the context of the current process. Was ZDI-CAN-26972.","solution":"Upgrade to Langflow version 1.0.0a27 or later.","affected_component":"Langflow","fixed_by_upgrading":true,"vulnerable_code":"import collections.abc\n\nclass LangflowComponent:\n    def eval_custom_component_code(self, user_data: dict):\n        \"\"\"\n        Evaluates the code for a custom component provided by the user.\n        The user_data dictionary is expected to contain a 'code' key\n        with a string of Python code to be executed.\n        \"\"\"\n        if \"code\" in user_data:\n            code_string = user_data[\"code\"]\n            try:\n                # The vulnerability is the direct evaluation of the user-supplied string.\n                # No validation or sandboxing is performed.\n                result = eval(code_string, {\"__builtins__\": __builtins__})\n                return {\"status\": \"success\", \"return_value\": repr(result)}\n            except Exception as e:\n                return {\"status\": \"error\", \"message\": str(e)}\n        return {\"status\": \"error\", \"message\": \"No code provided.\"}\n","patched_code":"import ast\nfrom typing import Any, Dict\n\n\ndef eval_custom_component_code(code: str) -> Dict[str, Any]:\n    \"\"\"\n    Evaluates the given Python code and returns the global variables\n    after execution.\n\n    This function now includes security measures to prevent arbitrary code execution\n    by parsing the code into an Abstract Syntax Tree (AST) and checking for\n    disallowed operations like imports or dangerous function calls.\n\n    Args:\n        code (str): The Python code to evaluate.\n\n    Returns:\n        Dict[str, Any]: A dictionary of global variables after the code has\n                        been executed.\n\n    Raises:\n        ValueError: If the code contains disallowed operations.\n    \"\"\"\n    # Disallowed keywords - we don't want to allow imports\n    disallowed_keywords = [\"import\"]\n    # Disallowed nodes - we don't want to allow imports, and we want to prevent\n    # any calls to functions that could be used for remote code execution.\n    disallowed_nodes = [\n        ast.Import,\n        ast.ImportFrom,\n    ]\n    # We also want to prevent calls to open, eval, exec\n    # and any dunder methods.\n    disallowed_function_calls = [\"open\", \"eval\", \"exec\"]\n\n    # Check for disallowed keywords\n    if any(keyword in code for keyword in disallowed_keywords):\n        raise ValueError(\"Code contains disallowed keywords.\")\n\n    # Parse the code into an AST\n    try:\n        tree = ast.parse(code)\n    except SyntaxError as e:\n        raise ValueError(f\"Invalid Python code: {e}\") from e\n\n    # Check for disallowed nodes in the AST\n    for node in ast.walk(tree):\n        if any(isinstance(node, disallowed_node) for disallowed_node in disallowed_nodes):\n            raise ValueError(f\"Code contains disallowed AST nodes: {type(node).__name__}\")\n        # Check for disallowed function calls\n        if isinstance(node, ast.Call) and isinstance(node.func, ast.Name):\n            if node.func.id in disallowed_function_calls:\n                raise ValueError(f\"Code contains disallowed function call: {node.func.id}\")\n        # Check for dunder methods\n        if isinstance(node, ast.Attribute) and node.attr.startswith(\"__\") and node.attr.endswith(\"__\"):\n            raise ValueError(f\"Code contains disallowed dunder method call: {node.attr}\")\n\n    # If the code is safe, execute it\n    globals_dict: Dict[str, Any] = {}\n    exec(code, globals_dict)\n\n    return globals_dict","payload_needed":true,"payload":"```python\n__import__('os').system('id')\n```","payload_status":"available","published_fix":[],"references":null}