Skip to content
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

Add proxy authentication support to the Python Meterpreter #13978

Merged
merged 2 commits into from
Sep 4, 2020

Conversation

zeroSteiner
Copy link
Contributor

@zeroSteiner zeroSteiner commented Aug 10, 2020

This adds support to the Python Meterpreter for using HTTP Proxies that require authentication by honoring the HttpProxyUser and HttpProxyPass options (at least one of the two must be set to a non-empty string). This also deregisters the HttpProxyType option because HTTP is the only one that is supported.

I also updated the meterpreter stage description to note that it's compatible with versions 2.5-2.7 and 3.1+ to imply that it does in fact work with Python 3.7, 3.8 etc.

This addresses rapid7/metasploit-payloads#386 and requires the changes in rapid7/metasploit-payloads#427.

Verification

I used proxy.py as my proxy for testing and I highly recommend for the following reasons:

  • Installation was a simple command, just had to run pip install proxy.py
  • It runs in the foreground with logging by default making it easy to see that it's being used
  • It supports authentication with the optional --basic-auth flag
  • Install proxy.py using pip install proxy.py
  • Run proxy.py on all interfaces with a username of "user" and a password of "pass" proxy --hostname 0.0.0.0 --basic-auth user:pass
  • Start msfconsole
  • use payload/python/meterpreter/reverse_https
  • Set the LHOST and LPORT options per usual
  • Set the HttpProxyHost and HttpProxyPort options to whatever system is running your proxy instance
  • Set the HttpProxyUser and HttpProxyPass options to "user" and "pass" respectively
  • Start the handler with to_handler
  • Generate and run the stage
  • Get a functioning session and see that the proxy is being used

@agalway-r7 agalway-r7 self-assigned this Sep 1, 2020
@agalway-r7 agalway-r7 merged commit 242656b into rapid7:master Sep 4, 2020
@agalway-r7
Copy link
Contributor

Release Notes

Adds proxy support to the python meterpreter and removes the HttpProxyType flag as it's no longer needed.

@zeroSteiner zeroSteiner deleted the feat/met/py-proxy-auth branch February 23, 2021 17:11
@@ -15,6 +15,7 @@ def initialize(info = {})
Msf::Opt::http_header_options +
Msf::Opt::http_proxy_options
)
deregister_options('HttpProxyType')
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this meant to also impact python/meterpreter_reverse_http? 👀

That payload seems to include this base mixin:

but it also re-registers the same options again later:

register_advanced_options(
Msf::Opt::http_header_options +
Msf::Opt::http_proxy_options
)

Which makes the option appear again:

msf6 payload(python/meterpreter_reverse_http) > advanced
   ... etc ...
   HttpProxyType                HTTP                                                         yes       The type of HTTP proxy (Accepted: HTTP, SOCKS)

Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of a drive-by-comment, I'll likely look at this with fresh eyes tomorrow and see what I've missed 😄

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

Successfully merging this pull request may close these issues.

4 participants