-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Add SOCKS5H Proxy Support #20147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zeroSteiner
wants to merge
5
commits into
rapid7:master
Choose a base branch
from
zeroSteiner:fix/issue/19641
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add SOCKS5H Proxy Support #20147
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e5fe66b
to
5f3b870
Compare
I'm working through the test failures right now. |
d84dd44
to
940f928
Compare
940f928
to
ce697bc
Compare
bwatters-r7
reviewed
May 8, 2025
@@ -53,3 +53,6 @@ group :test do | |||
gem 'timecop' | |||
end | |||
|
|||
gem 'rex-socket', git: 'https://github.com/zeroSteiner/rex-socket', branch: 'feat/proxy/socks5h' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to remove this before landing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for the SOCKS5H proxy convention which is an unofficial standard whereby the proxy client (Metasploit) does not resolve hostnames to IP address itself but rather sends the hostname to the proxy server for resolution. Metasploit has floundered on it's approach for handling DNS resolution and proxies in the past. Currently when a module is run, the hostname is passed to
Msf::RhostsWalker
which will resolve it itself to ensure that if a hostname maps to multiple IP address, the module is run for each. This PR retains this functionality but allows it to be bypassed when a SOCKS5H or HTTP proxy is in use. Both of these proxy server types can resolve hostnames themselves. This does mean that if a user is targeting a hostname that resolves to multiple IP addresses (e.g.google.com
) that it the module will only run against one target if a DNS-resolving proxy is in use. If no proxy is in use, the module will run against all targets.Requires changes from rapid7/rex-socket#76
Fixes #19641
Verification
podman run --rm --name socks5 -p 1080:1080 serjs/go-socks5-proxy
socks.command == 1
to see connection requests, then see if there's an IP address or hostname)msfconsole
connect
commandconnect -p 'socks5://localhost' github.com 22
connect -p 'socks5h://localhost' github.com 22
auxiliary/scanner/http/http_version
run RHOSTS=github.com Proxies=socks5://localhost
run RHOSTS=github.com Proxies=socks5h://localhost:1080