-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[NTLMRELAYX] Implements WinRM(S) clients/server #1987
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
Conversation
|
@Dfte why you closed this one ? |
|
Omg I did it again T-T |
|
I will do ASAP :)! |
|
Done @anadrianmanrique :)! |
|
@Dfte I was able to test successfully http->winrms and smb->winrms. However, this scenario seems to trigger some issues: ntlmrelayx output also, I wasn't able to relay either http or smb1 => winrm |
|
Ah so you cannot relay to WinRM actually. The reason is that WinRM packets are encrypted using the password of the user... You can only relay to WinRMS (if CBT is deactivated, or ntlmv1 is activated). Concerning evil-winrm if I remember correctly it relies on Negotiate which means that by design it prefers Kerberos over NTLM thus the error. But anyway, relaying to winrm won't work... |
|
@Dfte thanks for your response.
Thanks |
|
posting for the record https://sensepost.com/blog/2025/is-tls-more-secure-the-winrms-case./ as a reference |
|
You are right, I will remove the winrmclient as it cannot be used anyway. I will keep the winrmserver tho. |
|
@Dfte thanks for the changes. I've been able to successfully relay winrm/winrms using evil-winrm. However, I have a couple of questions:
Lastly, I left a couple of minor suggestion in code review. Aside from that, PR should be ready to be merged. Thanks! |
| self.address_family = socket.AF_INET6 | ||
| # Tracks the number of times authentication was prompted for WPAD per client | ||
| self.wpad_counters = {} | ||
| socketserver.TCPServer.__init__(self,server_address, RequestHandlerClass) |
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.
add socketserver.TCPServer.allow_reuse_address in order to allow rebind to the listening port in TIME_WAIT state
| if self.config.ipv6: | ||
| self.address_family = socket.AF_INET6 | ||
| self.wpad_counters = {} | ||
|
|
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.
add socketserver.TCPServer.allow_reuse_address in order to allow rebind to the listening port in TIME_WAIT state
|
@Dfte any news with this? we are approaching code stabilization phase before 0.13 release, so I wanted to have some visibility on this. Thanks! |
|
Hey mate! I just came back from vacation, will take a look at it monday ! :) |
|
@Dfte Thank you! |
|
Heyo! So I have added the allow_reuse option to both winrm/Srelayserver. Concerning the LDAP relay, yes it is not unsually because pywinrm, for example, asks for signing by default. Hence the error. But that doesn't mean all clients will which is mostly the reason why I wanted to merge these servers (that and ntlmv1). Concerning winrmexec.py, I cannot coerce neither so there is something wrong in its implementation for sure. |
|
Actually I don't have any error at all except this: debug message: So I'd say there is something to look after but considering that both evil-winrm and pywinrm work, I'm not really keen looking after the bug. At least not in that PR. I'll pin this one on the winrmexec.py PR :)! #2033 |
|
PR is ready to merge now. Thanks! |



Hello,
First of all sorry, I kinda screwed with my branches and purged the previous PR. Here is the PR again which adds a new relay capability allowing us to relay SMB/LDAP/HTTP NTLM (v1 or unsecured ones) authentications to the WinRM HTTPS endpoint. This will especially be useful if:
This endpoint is not configured on a default server installation but it is not protected by Channel Binding once configured by a sysadmin which makes it a possible great relay alternative for remote code executino.
Default action creates an interactive TCP shell that can be used via NC (socks is also implemented):
I'm adding @dadevel's comment as well, for anybody wanting to play with this PR, you can setup the WinRMS endpoint that way:
Start relay server.
Trigger authentication.
curl http://localhost -u 'corp\administrator:passw0rd' --ntlmAnd get a shell: