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

NTLMRelayX Multirelay fixes and behavioral changes #1741

Merged
merged 10 commits into from
May 6, 2024

Conversation

alexisbalbachan
Copy link
Contributor

@alexisbalbachan alexisbalbachan commented May 3, 2024

This changeset addresses the issues reported in #1694

A new flag was introduced to ntlmrelayx --keep-relaying which instructs the relay to keep cycling over its targets indefinitely.
This means that whether or not a relay attempt was successful against its target, said target won't ever be discarded and future connections will be relayed to it.
Keep in mind that in multirelay mode, when relaying fails against a target, no further targets will be processed until the relay receives new connection.

An example with 3 targets (always successful, multirelay enabled):

  • Incoming connection 1: Target1 (success) -> Target2 (success) -> Target3(success) -> No more targets
  • Incoming connection 2:
    • (Without --keep-relaying flag): No more targets
    • (With --keep-relaying flag): Target1 (success) -> Target2 (success) -> Target3(success) -> No more targets
  • Incoming connection 3: Same as above

3 Targets and (the second always fails, multirelay enbled):

  • Incoming connection 1: Target1 (success) -> Target2 (fail) -> Stop
  • Incoming connection 2: Target3(success) -> No more targets
  • Incoming connection 3:
    • (Without --keep-relaying flag): No more targets
    • (With --keep-relaying flag): Target1 (success) -> Target2 (fail) -> Stop

* [MULTIRELAY][Default Behavior] The relay will cycle over its target list only once, this matches the behavior of the single relay mode
* [MULTIRELAY] Added a flag to cycle over the target list any time a new connection is established, essentially relaying against each target in the list for every incoming connection
* [MULTIRELAY] HTTP server will stop consuming targets after the first failed attempt, this matches the behavior of SMB server
* Fixed issue in HTTP server when an unhandled exception occurs while trying to establish a connection with the target. Now it is recorded as a failed attempt.
…rget is now (internally) marked as "failed"

* Bugfix: initclient-> unhandled return status of client.initconnection, now properly raises an exception when that call fails
* Bugfix: enable-retries now works with smbserver
* [MULTIRELAY][Default Behavior] The relay will cycle over its target list only once, this matches the behavior of the single relay mode
* [MULTIRELAY] Added a flag to cycle over the target list any time a new connection is established, essentially relaying against each target in the list for every incoming connection
* [MULTIRELAY] HTTP server will stop consuming targets after the first failed attempt, this matches the behavior of SMB server
* Fixed issue in HTTP server when an unhandled exception occurs while trying to establish a connection with the target. Now it is recorded as a failed attempt.
…rget is now (internally) marked as "failed"

* Bugfix: initclient-> unhandled return status of client.initconnection, now properly raises an exception when that call fails
* Bugfix: enable-retries now works with smbserver
* Set default value of keep-relaying flag to False
# Conflicts:
#	examples/ntlmrelayx.py
#	impacket/examples/ntlmrelayx/servers/httprelayserver.py
#	impacket/examples/ntlmrelayx/servers/smbrelayserver.py
#	impacket/examples/ntlmrelayx/utils/config.py
@anadrianmanrique anadrianmanrique linked an issue May 6, 2024 that may be closed by this pull request
@anadrianmanrique anadrianmanrique self-assigned this May 6, 2024
@anadrianmanrique anadrianmanrique added bug Unexpected problem or unintended behavior high High priority item labels May 6, 2024
@anadrianmanrique anadrianmanrique merged commit 8856def into fortra:master May 6, 2024
9 checks passed
@anadrianmanrique
Copy link
Contributor

Excellent job! merging now
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior high High priority item
Projects
None yet
2 participants