Update the SOCKS proxy to use the new RelayManager#21048
Update the SOCKS proxy to use the new RelayManager#21048dledda-r7 merged 5 commits intorapid7:masterfrom
Conversation
cbd1f60 to
ee24da5
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the SOCKS5 proxy implementation to use Rex::IO::RelayManager for TCP relaying instead of the local per-socket relay mixin, and updates the rex-core dependency to a git-based version that provides the needed relay manager behavior.
Changes:
- Replace the custom SOCKS5
TcpRelayimplementation withRex::IO::RelayManager-based relays. - Add a
relay_managerto the SOCKS5 server and use it fromServerClient. - Switch
rex-coredependency to a specific git branch/revision in Bundler.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/rex/proto/proxy/socks5/server.rb | Initializes and exposes a RelayManager instance for use by SOCKS5 clients. |
| lib/rex/proto/proxy/socks5/server_client.rb | Removes bespoke relay threading and wires sockets through the shared RelayManager; updates error logging and stop behavior. |
| Gemfile | Pins rex-core to a git branch to pick up RelayManager changes. |
| Gemfile.lock | Locks Bundler to the git-sourced rex-core revision. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
cgranleese-r7
left a comment
There was a problem hiding this comment.
Maybe if we have the cycles add some tests for this would be nice!
a96aa49 to
4a5b5dc
Compare
aa49005 to
2d4df73
Compare
dledda-r7
left a comment
There was a problem hiding this comment.
msf payload(windows/meterpreter_reverse_tcp) > use auxiliary/server/socks_proxy
msf auxiliary(server/socks_proxy) > info
Name: SOCKS Proxy Server
Module: auxiliary/server/socks_proxy
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
sf <stephen_fewer@harmonysecurity.com>
Spencer McIntyre
surefire
Available actions:
Name Description
---- -----------
=> Proxy Run a SOCKS proxy server
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen
on all addresses.
SRVPORT 1080 yes The port to listen on
SRVSSL false no Negotiate SSL/TLS for local server connections
VERSION 5 yes The SOCKS version to use (Accepted: 4a, 5)
When VERSION is 5:
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD no Proxy password for SOCKS5 listener
USERNAME no Proxy username for SOCKS5 listener
Description:
This module provides a SOCKS proxy server that uses the builtin Metasploit routing to relay connections.
View the full module info with the info -d command.
msf auxiliary(server/socks_proxy) > run
[*] Auxiliary module running as background job 0.
msf auxiliary(server/socks_proxy) >
[*] Starting the SOCKS proxy server
msf auxiliary(server/socks_proxy) > jobs
Jobs
====
Id Name Payload Payload opts
-- ---- ------- ------------
0 Auxiliary: server/socks_proxy
msf auxiliary(server/socks_proxy) >
┌──(kali㉿kali)-[~/Documents/github/metasploit-framework]
└─$ curl --proxy socks5://127.0.0.1:1080 https://www.google.com | wc -c
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 79421 0 79421 0 0 195.4k 0 0
79421
┌──(kali㉿kali)-[~/Documents/github/metasploit-framework]
└─$
f5fc7dc to
e88bc5d
Compare
Release NotesThis updates the SOCKS proxy module to use the new fiber-based relay manager internally. The result is a reduction in code and improved performance. |
This updates the SOCKS5 proxy module to use the newish RelayManager added in #20677 . The result is a net reduction in code and some performance improvements.
Requires rapid7/rex-core#45
Verification
List the steps needed to make sure this thing works
msfconsoleuse auxiliary/server/socks_proxySimple Benchmarking
This simple benchmark at least showed that when making repeated GET requests to a local server that is listening, the operation finished in about half the time.