Skip to content

fix(ntlmrelayx): stop treating absolute-form WinRM requests as proxy requests - #2382

Open
ihadimh wants to merge 1 commit into
fortra:masterfrom
ihadimh:fix/winrm-407
Open

ihadimh wants to merge 1 commit into
fortra:masterfrom
ihadimh:fix/winrm-407

Conversation

@ihadimh

@ihadimh ihadimh commented Nov 17, 2026

Copy link
Copy Markdown

Refs #2379

Summary

winrmrelayserver.py and winrmsrelayserver.py decide whether a client is using them as a proxy by checking whether self.path starts with http. Windows WinRM clients send an absolute-form request target (POST http://host:5985/wsman HTTP/1.1) even on direct connections, so every relayed request was classified as a proxy request: the server looked for Proxy-Authorization, found none, and answered 407 Proxy Authentication Required. The client drops the connection instead of retrying, so the relay silently fails and ntlmrelayx logs nothing useful.

This treats WinRM connections as direct in both WinRM relay servers. The HTTP relay server keeps the existing heuristic.

Reproduction

Start the WinRM relay server on a loopback port and send a request with an absolute-form target:

POST http://127.0.0.1:<port>/wsman HTTP/1.1

Before this change:

HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM

After this change:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Negotiate

Tests

New tests/misc/test_winrm_relay_server.py starts the relay server on a loopback port and covers both request-target forms. The absolute-form case fails on the current code with HTTP/1.1 407 Proxy Authentication Required and passes with this change (2 passed).

Trade-off

WinRM proxy mode is no longer auto-detected. An absolute-form request target is indistinguishable from proxy traffic at this layer, and direct connections are the common case. If implicit WinRM proxy support still matters, an explicit option would be the safer way to restore it.

Patch prepared with AI assistance.

…requests

WinRM clients send an absolute-form request target even on a direct
connection, so winrmrelayserver/winrmsrelayserver classified every request
as proxy traffic, answered 407 and the client dropped the connection.
Treat WinRM requests as direct.

Refs fortra#2379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant