Skip to content

Conversation

@zeroSteiner
Copy link
Contributor

@zeroSteiner zeroSteiner commented Nov 10, 2025

Adds tests for socket channels in Meterpreter and SSH sessions.

Verification

  • Watch the tests run for all of the Meterpreter sessions
  • Watch the tests pass with exception
  • Run the test module on an SSH session, see almost all the tests fail

Demo: Python Meterpreter on Linux

msf post(test/socket_channels) > rerun
[*] Reloading module...
[*] Running against session -1
[*] Session type is meterpreter and platform is linux
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[+] [TCP-Client] Receives data from the peer
[+] [TCP-Client] Sends data to the peer
[+] [TCP-Client] Propagates close events to the peer
[+] [TCP-Client] Propagates close events from the peer
[*] Running TCP server channel tests...
[+] [TCP-Server] Accepts a connection
[+] [TCP-Server] Has the correct peer information
[+] [TCP-Server] Receives data from the peer
[+] [TCP-Server] Sends data to the peer
[+] [TCP-Server] Propagates close events to the server
[+] [TCP-Server] Propagates close events to the peer
[+] [TCP-Server] Propagates close events from the peer
[*] Running UDP channel tests...
[-] FAILED: [UDP] Has the correct peer information
[+] [UDP] Receives data from the peer
[+] [UDP] Sends data to the peer
[-] Passed: 14; Failed: 1; Skipped: 0
[*] Post module execution completed
msf post(test/socket_channels) >

Demo: SSH on Linux

This is full of fail and the underlying issue (possibly issues?) should be addressed, but this PR was already scope creep'ed out of the work in #20677. UDP should be skipped because UDP channels aren't defined in the SSH spec, but TCP client and server channels should work.

msf auxiliary(scanner/ssh/ssh_login) > rerun
[*] Reloading module...
[*] 192.168.159.128:22 - Starting bruteforce
[+] 192.168.159.128:22 - Success: 'test:Password1!' 'uid=1001(test) gid=1002(test) groups=1002(test) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 Linux fedora-vm 6.17.6-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 29 18:58:05 UTC 2025 x86_64 GNU/Linux '
[*] Session ID 16 (?? -> ??) processing AutoRunScript 'post/test/socket_channels'
[*] Running against session 16
[*] Session type is shell and platform is linux
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[-] SSH Command Stream encountered an error: undefined method `shutdown' for nil (Server Version: SSH-2.0-OpenSSH_9.9)
[*] 192.168.159.128 - SSH session 16 closed.  Reason: Died
[-] FAILED: [TCP-Client] Receives data from the peer
[-] [[TCP-Client] Sends data to the peer] FAILED: [TCP-Client] Sends data to the peer
[-] [[TCP-Client] Sends data to the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:33679) timed out.
[-] [[TCP-Client] Propagates close events to the peer] FAILED: [TCP-Client] Propagates close events to the peer
[-] [[TCP-Client] Propagates close events to the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:36931) timed out.
[-] [[TCP-Client] Propagates close events from the peer] FAILED: [TCP-Client] Propagates close events from the peer
[-] [[TCP-Client] Propagates close events from the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:46359) timed out.
[*] Running TCP server channel tests...
[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection
[-] [[TCP-Server] Accepts a connection] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information
[-] [[TCP-Server] Has the correct peer information] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer
[-] [[TCP-Server] Receives data from the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer
[-] [[TCP-Server] Sends data to the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server
[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer
[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer
[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::ConnectionError: A socket error occurred.
[!] UDP channels are not supported by SSH sessions.
[-] Passed: 1; Failed: 11; Skipped: 0
[*] SSH session 16 opened (192.168.159.128:38279 -> 192.168.159.128:22) at 2025-11-10 15:50:35 -0500
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ssh/ssh_login) >

@zeroSteiner zeroSteiner marked this pull request as draft November 10, 2025 21:05
@zeroSteiner
Copy link
Contributor Author

Converted to a draft so I can watch the tests run and ensure everything is running and passing in the way I'd expect.

@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch from 1f18b7e to 95fa10e Compare November 10, 2025 22:02
@zeroSteiner zeroSteiner changed the title Feat/mod/socket channel tests Add socket channel tests Nov 10, 2025
@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch from 9a1b15e to a7b5aef Compare November 12, 2025 19:12
@jheysel-r7 jheysel-r7 self-assigned this Nov 12, 2025
@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch 8 times, most recently from 5c1bc74 to 96f8a47 Compare November 13, 2025 22:46
Copy link
Contributor

@jheysel-r7 jheysel-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these changes @zeroSteiner! Changes were as expected:

Testing

PHP Meterpreter on Linux

msf payload(php/meterpreter/reverse_tcp) > WARNING: Local file /home/msfuser/git/metasploit-framework/data/meterpreter/meterpreter.php is being used

msf post(test/socket_channels) > run
[*] Running against session 2
[*] Session type is meterpreter and platform is linux
[*] Running UDP channel tests...
[-] Meterpreter session 4 is not valid and will be closed
WARNING: Local file /home/msfuser/git/metasploit-framework/data/meterpreter/meterpreter.php is being used
[*] Sending stage (41224 bytes) to 172.16.199.138
[*] 172.16.199.138 - Meterpreter session 4 closed.
[-] [[UDP] Has the correct peer information] FAILED: [UDP] Has the correct peer information
[-] [[UDP] Has the correct peer information] Exception: Interrupt:
[-] [[UDP] Receives data from the peer] FAILED: [UDP] Receives data from the peer
[-] [[UDP] Receives data from the peer] Exception: Interrupt:
[+] [UDP] Sends data to the peer
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[+] [TCP-Client] Receives data from the peer
[+] [TCP-Client] Sends data to the peer
[+] [TCP-Client] Propagates close events to the peer
[+] [TCP-Client] Propagates close events from the peer
[*] Running TCP server channel tests...
[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection
[-] [[TCP-Server] Accepts a connection] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information
[-] [[TCP-Server] Has the correct peer information] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer
[-] [[TCP-Server] Receives data from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer
[-] [[TCP-Server] Sends data to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server
[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer
[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer
[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::Post::Meterpreter::RequestError: core_channel_open: Operation failed: 1
[-] Passed: 6; Failed: 9; Skipped: 0
[*] Post module execution completed

Java Meterpreter on Linux

msf post(test/socket_channels) > run
[*] Running against session -1
[*] Session type is meterpreter and platform is linux
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[+] [TCP-Client] Receives data from the peer
[+] [TCP-Client] Sends data to the peer
[+] [TCP-Client] Propagates close events to the peer
[+] [TCP-Client] Propagates close events from the peer
[*] Running UDP channel tests...
[-] FAILED: [UDP] Has the correct peer information
[+] [UDP] Receives data from the peer
[+] [UDP] Sends data to the peer
[*] Running TCP server channel tests...
[+] [TCP-Server] Accepts a connection
[+] [TCP-Server] Has the correct peer information
[+] [TCP-Server] Receives data from the peer
[+] [TCP-Server] Sends data to the peer
[+] [TCP-Server] Propagates close events to the server
[+] [TCP-Server] Propagates close events to the peer
[+] [TCP-Server] Propagates close events from the peer
[-] Passed: 14; Failed: 1; Skipped: 0
[*] Post module execution completed

Linux Meterpreter

msf post(test/socket_channels) > run
[*] Running against session -1
[*] Session type is meterpreter and platform is linux
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[+] [TCP-Client] Receives data from the peer
[+] [TCP-Client] Sends data to the peer
[+] [TCP-Client] Propagates close events to the peer
[+] [TCP-Client] Propagates close events from the peer
[*] Running UDP channel tests...
[-] FAILED: [UDP] Has the correct peer information
[+] [UDP] Receives data from the peer
[+] [UDP] Sends data to the peer
[*] Running TCP server channel tests...
[+] [TCP-Server] Accepts a connection
[+] [TCP-Server] Has the correct peer information
[+] [TCP-Server] Receives data from the peer
[+] [TCP-Server] Sends data to the peer
[+] [TCP-Server] Propagates close events to the server
[+] [TCP-Server] Propagates close events to the peer
[+] [TCP-Server] Propagates close events from the peer
[-] Passed: 14; Failed: 1; Skipped: 0
[*] Post module execution completed

Python Meterpreter on Linux

msf post(test/socket_channels) > run
[*] Running against session -1
[*] Session type is meterpreter and platform is linux
[*] Running TCP client channel tests...
[+] [TCP-Client] Has the correct peer information
[+] [TCP-Client] Receives data from the peer
[+] [TCP-Client] Sends data to the peer
[+] [TCP-Client] Propagates close events to the peer
[+] [TCP-Client] Propagates close events from the peer
[*] Running UDP channel tests...
[-] FAILED: [UDP] Has the correct peer information
[+] [UDP] Receives data from the peer
[+] [UDP] Sends data to the peer
[*] Running TCP server channel tests...
[+] [TCP-Server] Accepts a connection
[+] [TCP-Server] Has the correct peer information
[+] [TCP-Server] Receives data from the peer
[+] [TCP-Server] Sends data to the peer
[+] [TCP-Server] Propagates close events to the server
[+] [TCP-Server] Propagates close events to the peer
[+] [TCP-Server] Propagates close events from the peer
[-] Passed: 14; Failed: 1; Skipped: 0
[*] Post module execution completed

SSH Session Failing on Linux:

 msf post(test/socket_channels) > run
[*] Running against session -1
[*] Session type is shell and platform is linux
[*] Running TCP client channel tests...
[-] FAILED: [TCP-Client] Allows binding to port 0
[-] SSH Command Stream encountered an error: undefined method `shutdown' for nil (Server Version: SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14)
[+] [TCP-Client] Has the correct peer information
[*] 172.16.199.130 - SSH session 1 closed.  Reason: Died
[-] [[TCP-Client] Receives data from the peer] FAILED: [TCP-Client] Receives data from the peer
[-] [[TCP-Client] Receives data from the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:46523) timed out.
[-] [[TCP-Client] Sends data to the peer] FAILED: [TCP-Client] Sends data to the peer
[-] [[TCP-Client] Sends data to the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:40485) timed out.
[-] [[TCP-Client] Propagates close events to the peer] FAILED: [TCP-Client] Propagates close events to the peer
[-] [[TCP-Client] Propagates close events to the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:44695) timed out.
[-] [[TCP-Client] Propagates close events from the peer] FAILED: [TCP-Client] Propagates close events from the peer
[-] [[TCP-Client] Propagates close events from the peer] Exception: Rex::ConnectionTimeout: The connection with (127.0.0.1:44561) timed out.
[*] Running TCP server channel tests...
[-] [[TCP-Server] Allows binding to port 0] FAILED: [TCP-Server] Allows binding to port 0
[-] [[TCP-Server] Allows binding to port 0] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Accepts a connection] FAILED: [TCP-Server] Accepts a connection
[-] [[TCP-Server] Accepts a connection] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Has the correct peer information] FAILED: [TCP-Server] Has the correct peer information
[-] [[TCP-Server] Has the correct peer information] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Receives data from the peer] FAILED: [TCP-Server] Receives data from the peer
[-] [[TCP-Server] Receives data from the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Sends data to the peer] FAILED: [TCP-Server] Sends data to the peer
[-] [[TCP-Server] Sends data to the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events to the server] FAILED: [TCP-Server] Propagates close events to the server
[-] [[TCP-Server] Propagates close events to the server] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events to the peer] FAILED: [TCP-Server] Propagates close events to the peer
[-] [[TCP-Server] Propagates close events to the peer] Exception: Rex::ConnectionError: A socket error occurred.
[-] [[TCP-Server] Propagates close events from the peer] FAILED: [TCP-Server] Propagates close events from the peer
[-] [[TCP-Server] Propagates close events from the peer] Exception: Rex::ConnectionError: A socket error occurred.
[!] UDP channels are not supported by SSH sessions.
[-] Passed: 1; Failed: 13; Skipped: 0
[*] Post module execution completed

@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch from 96f8a47 to 1a9c101 Compare November 14, 2025 13:45
@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch 2 times, most recently from 3740931 to 2d646a9 Compare November 14, 2025 21:06
@zeroSteiner
Copy link
Contributor Author

zeroSteiner commented Nov 14, 2025

I'm reconsidering the severity of the [-] FAILED: [UDP] Has the correct peer information issue. I originally thought it'd break when a UDP socket was pivoting over a Meterpreter session because the Rex::Socket::Udp#recvfrom method has a different return type than the Ruby UDPSocket#recvfrom method. Note that UDPSocket inherits from IPSocket, hence the link.

While it's kinda confusing that Rex::Socket is different in this regard, as long as the author ensures that their sockets are always either raw Ruby UDPSocket instances or Rex::Socket::Udp instances, there shouldn't be any bugs. With that in mind, I think either I should update the test and moving forward we'll keep the Rex API causing it to pass, or the Rex API should be updated to be consistent with Rex::Socket::Udp.

A quick search seems to show the use in framework is mixed. The following output shows multiple uses both where two values are expected to be returned (Ruby socket) and three values are expected to be returned (Rex::Socket).

#recvfrom grep
lib/msf/core/auxiliary/udp_scanner.rb:176:          res = sock.recvfrom(65535, timeout)
lib/msf/core/exploit/remote/mssql.rb:82:    resp, _saddr, _sport = ping_sock.recvfrom(65535, timeout)
lib/msf/core/exploit/remote/wdbrpc_client.rb:42:    res,src = udp_sock.recvfrom(65535, 5)
lib/msf/core/exploit/remote/wdbrpc_client.rb:87:    res,src = udp_sock.recvfrom(65535, 5)
lib/msf/core/exploit/remote/wdbrpc_client.rb:118:      res,src = udp_sock.recvfrom(65535, 0.5)
lib/msf/core/exploit/remote/wdbrpc_client.rb:145:    res,src = udp_sock.recvfrom(65535, 5.0)
lib/msf/core/exploit/remote/wdbrpc_client.rb:160:    res,src = udp_sock.recvfrom(65535, 5.0)
lib/msf/core/exploit/remote/wdbrpc_client.rb:176:      res,src = udp_sock.recvfrom(65535, 0.5)
lib/msf/core/exploit/remote/wdbrpc_client.rb:190:        self.udp_sock.recvfrom(65535, 5)
lib/msf/core/handler/reverse_udp.rb:162:          inbound, peerhost, peerport = self.listener_sock.recvfrom
lib/msf/core/payload/osx/x64/reverse_tcp_x64.rb:95:    ; recvfrom(sockfd, addr, 0x1000)
lib/rex/post/meterpreter/channels/datagram.rb:36:    def recvfrom_nonblock(length, flags = 0)
lib/rex/post/meterpreter/channels/datagram.rb:69:      # back in recvfrom_nonblock.
lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_ws2_32.rb:554:    dll.add_function('recvfrom', 'DWORD',[
lib/rex/proto/dhcp/server.rb:175:        buf,host,port = self.sock.recvfrom(65535)
lib/rex/proto/iax2/client.rb:65:        pkt, src = self.sock.recvfrom(65535)
lib/rex/proto/natpmp/packet.rb:21:    while (r = udp_sock.recvfrom(12, timeout) and r[1])
lib/rex/proto/natpmp/packet.rb:46:    while (r = udp_sock.recvfrom(16, timeout) and r[1])
lib/rex/proto/tftp/client.rb:87:    res = self.server_sock.recvfrom(65535)
lib/rex/proto/tftp/client.rb:115:    res = self.client_sock.recvfrom(65535)
lib/rex/proto/tftp/client.rb:193:      res = self.server_sock.recvfrom(65535)
lib/rex/proto/tftp/client.rb:316:        res = self.server_sock.recvfrom(65535)
lib/rex/proto/tftp/server.rb:243:        buf,host,port = self.sock.recvfrom(65535)
lib/rex/proto/adb/message.rb:70:    header = socket.recvfrom(6 * WORD_WIDTH)[0]
lib/rex/proto/adb/message.rb:75:    payload = socket.recvfrom(payload_len)[0]
lib/rex/proto/dns/resolver.rb:282:              temp,from = socket.recvfrom(left)
lib/rex/proto/dns/resolver.rb:345:        ans = socket.recvfrom(@config[:packet_size])
lib/rex/proto/dns/server.rb:221:        buf,host,port = self.udp_sock.recvfrom(65535)
lib/rex/proto/ldap/server.rb:378:            buf, host, port = udp_sock.recvfrom(65535)
lib/metasploit/framework/login_scanner/snmp.rb:208:            res = sock.recvfrom(max_size, timeout)
lib/metasploit/framework/login_scanner/snmp.rb:213:              # Put into an array to mimic recvfrom
lib/net/dns/packet.rb:141:      #   ans = udp_socket.recvfrom(1500)
lib/net/dns/packet.rb:145:      # of the sender. If data is passed as is from a Socket#recvfrom call,
lib/net/dns/resolver.rb:1221:                  temp,from = socket.recvfrom(left)
lib/net/dns/resolver.rb:1260:              ans = socket.recvfrom(@config[:packet_size])
lib/snmp/agent.rb:31:                data, remote_info = @socket.recvfrom(@max_packet)
lib/snmp/manager.rb:544:    def recvfrom(max_bytes)
lib/snmp/manager.rb:545:        data, host_info = @socket.recvfrom(max_bytes)
lib/snmp/manager.rb:670:            data, source_ip, source_port = @transport.recvfrom(@max_bytes)
modules/auxiliary/scanner/chargen/chargen_probe.rb:56:        r = udp_sock.recvfrom(65535, 0.1)
modules/auxiliary/scanner/discovery/udp_probe.rb:89:        r = udp_sock.recvfrom(65535, 0.1) and r[1]
modules/auxiliary/scanner/ipmi/ipmi_dumphashes.rb:340:    r = udp_sock.recvfrom(65535, timeo)
modules/auxiliary/scanner/misc/rosewill_rxs3211_passwords.rb:55:      res = udp_sock.recvfrom(65535, 0.5) and res[1]
modules/auxiliary/scanner/natpmp/natpmp_portscan.rb:51:        while (r = udp_sock.recvfrom(16, 1.0) and r[1])
modules/auxiliary/scanner/ntp/timeroast.rb:67:      raw, = udp_sock.recvfrom(68, timeout) # 68 is always the number of bytes expected
modules/auxiliary/scanner/scada/bacnet_l3.rb:157:      data, host, port = lsocket.recvfrom(65535, datastore['TIMEOUT'])
modules/auxiliary/scanner/scada/bacnet_l3.rb:158:      data2, host2, port2 = ssocket.recvfrom(65535, datastore['TIMEOUT'])
modules/auxiliary/scanner/scada/bacnet_l3.rb:295:        data, host, port = ssocket.recvfrom(65535, datastore['TIMEOUT'])
modules/auxiliary/scanner/scada/koyo_login.rb:167:    while (r = @udp_sock.recvfrom(65535, 0.1) and recvpacks < 2)
modules/auxiliary/scanner/sip/enumerator.rb:80:            while (r = udp_sock.recvfrom(65535, 0.01) and r[1])
modules/auxiliary/scanner/sip/enumerator.rb:89:      while (r = udp_sock.recvfrom(65535, 3) and r[1])
modules/auxiliary/scanner/sip/sipdroid_ext_enum.rb:92:          msg = udp_sock.recvfrom(1024, 4)
modules/auxiliary/scanner/telnet/lantronix_telnet_password.rb:57:      res = rem_sock.recvfrom(65535, 0.5) and res[1]
modules/auxiliary/scanner/tftp/ipswitch_whatsupgold_tftp.rb:75:    while (r = udp_sock.recvfrom(65535, 0.1) and r[1])
modules/auxiliary/scanner/tftp/netdecision_tftp.rb:74:    while (r = udp_sock.recvfrom(65535, 0.1) and r[1])
modules/auxiliary/scanner/vxworks/wdbrpc_bootline.rb:61:          while (r = udp_sock.recvfrom(65535, 0.01) and r[1])
modules/auxiliary/scanner/vxworks/wdbrpc_bootline.rb:72:      while (r = udp_sock.recvfrom(65535, del) and r[1])
modules/auxiliary/scanner/vxworks/wdbrpc_version.rb:59:          while (r = udp_sock.recvfrom(65535, 0.01) and r[1])
modules/auxiliary/scanner/vxworks/wdbrpc_version.rb:70:      while (r = udp_sock.recvfrom(65535, del) and r[1])
modules/auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum.rb:71:    while (r = udp_sock.recvfrom(65535, 0.1)) && (iter < 20)
modules/auxiliary/dos/scada/allen_bradley_pccc.rb:139:    res = udp_sock.recvfrom(90)
modules/auxiliary/dos/scada/beckhoff_twincat.rb:70:02a0f96c 00414b92 WSOCK32!recvfrom+0x39
modules/auxiliary/dos/upnp/miniupnpd_dos.rb:50:    data = udp_sock.recvfrom
modules/auxiliary/dos/windows/games/kaillera.rb:43:    res = udp_sock.recvfrom(15)
modules/auxiliary/dos/windows/games/kaillera.rb:63:    res = udp_sock.recvfrom(15)
modules/auxiliary/fuzzers/dns/dns_fuzzer.rb:126:      res, = udp_sock.recvfrom(65535)
modules/auxiliary/fuzzers/dns/dns_fuzzer.rb:286:    res, = udp_sock.recvfrom(65535, 1) if method == 'UDP'
modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb:192:    reply = udp_sock.recvfrom(65535, datastore['WAIT'] / 1000.0)
modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb:195:      reply = udp_sock.recvfrom(65535, datastore['WAIT'] / 1000.0)
modules/auxiliary/server/capture/sip.rb:151:      res = @sock.recvfrom
modules/auxiliary/server/dns/spoofhelper.rb:61:      packet, addr = @sock.recvfrom(65535)
modules/auxiliary/server/fakedns.rb:90:        packet, addr = @sock.recvfrom(65535)
modules/auxiliary/server/netbios_spoof_nat.rb:82:        packet, addr = @sock.recvfrom(65535)
modules/auxiliary/spoof/dns/bailiwicked_domain.rb:103:      res, = srv_sock.recvfrom(65535, 1.0)
modules/auxiliary/spoof/dns/bailiwicked_domain.rb:185:      res, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_domain.rb:212:        answer, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_domain.rb:370:        answer, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_domain.rb:422:      res, = sock.recvfrom(65535, 0.01)
modules/auxiliary/spoof/dns/bailiwicked_host.rb:99:      res, = srv_sock.recvfrom(65535, 1.0)
modules/auxiliary/spoof/dns/bailiwicked_host.rb:184:      res, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_host.rb:211:        answer, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_host.rb:369:        answer, = srv_sock.recvfrom
modules/auxiliary/spoof/dns/bailiwicked_host.rb:421:      res, = sock.recvfrom(65535, 0.01)
modules/auxiliary/spoof/dns/compare_results.rb:81:      base_res, = base_sock.recvfrom(65535, 3.0)
modules/auxiliary/spoof/dns/compare_results.rb:82:      targ_res, = targ_sock.recvfrom(65535, 3.0)
modules/auxiliary/spoof/llmnr/llmnr_response.rb:58:    # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
modules/auxiliary/spoof/llmnr/llmnr_response.rb:169:        packet, host, port = sock.recvfrom(65535)
modules/auxiliary/spoof/nbns/nbns_response.rb:55:    # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
modules/auxiliary/spoof/nbns/nbns_response.rb:136:        packet, host, port = sock.recvfrom(65535)
modules/auxiliary/spoof/mdns/mdns_response.rb:57:    # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
modules/auxiliary/spoof/mdns/mdns_response.rb:190:        packet, host, port = sock.recvfrom(65535)
modules/auxiliary/voip/sip_deregister.rb:86:    while ((r = udp_sock.recvfrom(65535, 3))) && r[1]
modules/payloads/stages/linux/x64/meterpreter.rb:55:      mov rax, 45                 ; recvfrom
modules/payloads/stages/osx/x64/meterpreter.rb:60:      mov eax, 0x200001d          ; recvfrom
modules/payloads/stages/osx/x64/meterpreter.rb:79:      mov eax, 0x200001d          ; recvfrom
modules/exploits/linux/games/ut2004_secure.rb:86:    res = udp_sock.recvfrom(8192)
modules/exploits/linux/misc/cve_2020_13160_anydesk.rb:105:      response, host, = server_sock.recvfrom(8192, timeout)
modules/exploits/linux/misc/igel_command_injection.rb:90:    res = udp_sock.recvfrom(65535, 0.5)
modules/exploits/multi/upnp/libupnp_ssdp_overflow.rb:421:      res, _, _ = udp_sock.recvfrom(65535, 1.0)
modules/exploits/multi/wyse/hagent_untrusted_hsdata.rb:165:          req = session.recvfrom(2000)[0]
modules/exploits/windows/brightstor/discovery_udp.rb:129:    udp_sock.recvfrom(8192)
modules/exploits/windows/games/ut2004_secure.rb:82:    res = udp_sock.recvfrom(8192)
modules/exploits/windows/license/calicclnt_getconfig.rb:111:            req = session.recvfrom(2000)[0]
modules/exploits/windows/license/sentinel_lm7_udp.rb:66:    res = udp_sock.recvfrom(8192)
modules/exploits/windows/license/sentinel_lm7_udp.rb:92:    udp_sock.recvfrom(8192)
modules/exploits/windows/misc/crosschex_device_bof.rb:73:    res, host, port = udp_sock.recvfrom(PACKET_LEN, datastore['TIMEOUT'].to_i > 0 ? datastore['TIMEOUT'].to_i : nil)
modules/post/windows/manage/forward_pageant.rb:89:          while (socket_request_data = s.recvfrom(8192)) # 8192 = AGENT_MAX
modules/post/windows/recon/outbound_ports.rb:154:        r = client.railgun.ws2_32.recvfrom(h_icmp, "\x00" * 100, 100, 0, from, 16)
grep: data/exploits/CVE-2016-4655/exploit: binary file matches
data/exploits/cve-2010-3904/rds-fail.c:85:	recvfrom(sock, (void *)address, sizeof(void *), 0,
grep: data/exploits/cve-2010-3904/rds-fail.x64: binary file matches
grep: data/exploits/cve-2010-3904/rds-fail.x86: binary file matches
data/headers/windows/Winsock2.h:317:WINAPI int recvfrom __attribute__((dllimport))(SOCKET, char*, int, int, struct sockaddr*, int*);
data/f5-mcp-objects.txt:2884:0x0b42 network_failover_stat_sender_recvfrom_err
data/f5-mcp-objects.txt:2893:0x0b4b network_failover_stat_recver_recvfrom_err
test/modules/post/test/socket_channels.rb:251:      # this one is expected to fail because #recvfrom just returns a string address which is inconsistent
test/modules/post/test/socket_channels.rb:256:      _, addrinfo = client.recvfrom(data.length)
test/modules/post/test/socket_channels.rb:270:      received, _ = client.recvfrom(data.length)
test/modules/post/test/socket_channels.rb:281:      received, _ = server_client.recvfrom(data.length)

@zeroSteiner zeroSteiner force-pushed the feat/mod/socket-channel-tests branch from 2d646a9 to f2a05ad Compare November 14, 2025 21:18
@zeroSteiner zeroSteiner marked this pull request as ready for review November 14, 2025 21:58
@jheysel-r7 jheysel-r7 merged commit 8e642d4 into rapid7:master Nov 17, 2025
56 of 61 checks passed
@jheysel-r7 jheysel-r7 added the rn-enhancement release notes enhancement label Nov 17, 2025
@jheysel-r7
Copy link
Contributor

jheysel-r7 commented Nov 17, 2025

Release Notes

Adds tests for socket channels in Meterpreter and SSH sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rn-enhancement release notes enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants