Skip to content

Commit 16c4f6c

Browse files
Microsoft Telnet Server NTLM Mutual Authentication Configuration Issue
1 parent d963527 commit 16c4f6c

File tree

1 file changed

+151
-23
lines changed

1 file changed

+151
-23
lines changed

MsTelnetServer_NTLM_MutualAuth_ConfigIssue.txt

Lines changed: 151 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,187 @@ Affected Software: Microsoft Telnet Server (Windows 2000 to Windows Server 2008
55
Severity: Low (Non-Exploitable)
66
CVE ID: None Assigned
77
Vendor: Microsoft Corporation
8-
Status: Unpatched, non-exploitable.
8+
Status: Unpatched, non-exploitable.
99

1010
Summary
1111
=======
12-
The Microsoft Telnet Server’s NTLM authentication over MS-TNAP uses SECPKG_CRED_BOTH in AcquireCredentialsHandle and ASC_REQ_MUTUAL_AUTH/ASC_REQ_DELEGATE in AcceptSecurityContext. These settings suggest a potential vulnerability where an attacker could invert authentication, forcing the server to authenticate to the client. Testing with a modified PoC tool (telnet_token.exe, based on updated netio.c and security.c) alongside auditing of the server behaviors has confirmed the issue is not exploitable. The server never initiates authentication with an NTLM Type 1 message, rendering these flags ineffective for exploitation uses by the client. Administrators should disable Telnet due to its plaintext transmission, but no specific action is required for this issue. The server implementation should, however, explicitly specify SECPKG_CRED_INBOUND and not support ASC_REQ_MUTUAL and ASC_REQ_DELEGATE if mutual authentication is not required.
12+
The Microsoft Telnet Server’s NTLM authentication over MS-TNAP uses
13+
SECPKG_CRED_BOTH in AcquireCredentialsHandle and ASC_REQ_MUTUAL_AUTH/ASC_REQ_DELEGATE in
14+
AcceptSecurityContext. These settings suggest a potential vulnerability where an attacker
15+
could invert authentication, forcing the server to authenticate to the client. Testing
16+
with a modified telnet client (telnet_token.exe, based on updated netio.c and security.c)
17+
alongside auditing of the server behaviors has confirmed the issue is not exploitable. The
18+
server never initiates authentication with an NTLM Type 1 message, rendering these flags
19+
ineffective for exploitation uses by the client. Administrators should disable
20+
Telnet due to its plaintext transmission, but no specific action is required for
21+
this issue. The server implementation should, however, explicitly specify
22+
SECPKG_CRED_INBOUND and not support ASC_REQ_MUTUAL and ASC_REQ_DELEGATE if mutual
23+
authentication is not required.
1324

1425
Technical Details
1526
=================
1627
The server’s SSPI implementation includes:
1728

18-
- SECPKG_CRED_BOTH in AcquireCredentialsHandle: Allows the server to act as both authenticator and authenticatee, unexpected for a server role.
19-
- ASC_REQ_MUTUAL_AUTH and ASC_REQ_DELEGATE in AcceptSecurityContext: Supports mutual authentication and credential delegation, potentially enabling an authentication bypass.
29+
- SECPKG_CRED_BOTH in AcquireCredentialsHandle: Allows the server to act as both
30+
authenticator and authenticatee, unexpected for a server role.
31+
- ASC_REQ_MUTUAL_AUTH and ASC_REQ_DELEGATE in AcceptSecurityContext: Supports
32+
mutual authentication and credential delegation, potentially enabling an
33+
authentication bypass.
2034

21-
A practical attack would require the server to send a Type 1 (NEGOTIATE) message, allowing the client to process server credentials via AcceptSecurityContext. We updated security.c in a telnet client and attempted this by using SECPKG_CRED_INBOUND and AcceptSecurityContext to handle a server Type 1 message whilst sending the MS-TNAP direction flags AUTH_SERVER_TO_CLIENT | AUTH_HOW_MUTUAL. The server ignores these flags and it appears Telnet mutual authentication was a feature that Microsoft abandoned during development.
35+
A practical attack would require the server to send a Type 1 (NEGOTIATE) message,
36+
allowing the client to process server credentials via AcceptSecurityContext. We
37+
updated security.c in a telnet client and attempted this by using
38+
SECPKG_CRED_INBOUND and AcceptSecurityContext to handle a server Type 1 message
39+
whilst sending the MS-TNAP direction flags AUTH_SERVER_TO_CLIENT |
40+
AUTH_HOW_MUTUAL. The server ignores these flags and it appears Telnet mutual
41+
authentication was a feature that Microsoft abandoned during development.
2242

2343
PoC Testing
2444
===========
25-
The PoC tool (telnet_token.exe), built using a modified netio.c and security.c to exploit the logic flaws and establish mutual authentication was developed and tested against a Windows Server 2008 R2 Telnet Server. Key findings:
45+
The PoC tool (telnet_token.exe), built using a modified netio.c and security.c to
46+
exploit the logic flaws and establish mutual authentication was developed and
47+
tested against a Windows Server 2008 R2 Telnet Server. Key findings:
2648

27-
- Standard Flow: The client sent a Type 1 message with AUTH_SERVER_TO_CLIENT | AUTH_HOW_MUTUAL. The server responded with a Type 2 (CHALLENGE) message, using AUTH_HOW_ONE_WAY | AUTH_CLIENT_TO_SERVER, ignoring the mutual authentication request. No server authentication data was included.
28-
- Reversed Authentication: Using SECPKG_CRED_INBOUND and AcceptSecurityContext caused a crash with SEC_E_INVALID_TOKEN (0x80090308) when processing the server’s Type 2 message, as it was not a valid input token for AcceptSecurityContext. The server never sent a Type 1 message.
29-
- Type 2 Analysis: The Type 2 message contained standard NTLM fields (challenge, target name, flags: 0xe28a8215) with no server authentication token, adhering to RFC 4559. Our PoC tool will output any server token that maybe sent by a Type 2 message in the event the servers Type 1 requests for mutual authentication are used. However NTLMSSP only includes authentication material and cryptographic data in a type 3 message making this issue non-exploitable.
49+
- Standard Flow: The client sent a Type 1 message with
50+
AUTH_SERVER_TO_CLIENT | AUTH_HOW_MUTUAL. The server responded with a Type 2
51+
(CHALLENGE) message, using AUTH_HOW_ONE_WAY | AUTH_CLIENT_TO_SERVER, ignoring
52+
the mutual authentication request. No server authentication data was included.
53+
- Reversed Authentication: Using SECPKG_CRED_INBOUND and AcceptSecurityContext
54+
caused a crash with SEC_E_INVALID_TOKEN (0x80090308) when processing the
55+
server’s Type 2 message, as it was not a valid input token for
56+
AcceptSecurityContext. The server never sent a Type 1 message.
57+
- Type 2 Analysis: The Type 2 message contained standard NTLM fields (challenge,
58+
target name, flags: 0xe28a8215) with no server authentication token, adhering to
59+
RFC 4559. Our PoC tool will output any server token that maybe sent by a Type 2
60+
message in the event the servers Type 1 requests for mutual authentication are
61+
used. However NTLMSSP only includes authentication material and cryptographic
62+
data in a type 3 message making this issue non-exploitable.
3063

3164
Why It’s Not Exploitable
3265
========================
33-
- Fixed Server Role: The server exclusively only acts as an NTLM authenticator, sending Type 2 messages and never initiating with Type 1. SECPKG_CRED_BOTH is unused even when sending the appropriate flags in the client.
34-
- Protocol Limitation: MS-TNAP ignores AUTH_SERVER_TO_CLIENT and AUTH_HOW_MUTUAL, enforcing client-driven authentication (RFC 2941).
35-
- No Server Credentials: Type 2 messages lack authentication data, and mutual authentication occurs only in the client’s Type 3 response, which the server verifies.
66+
- Fixed Server Role: The server exclusively only acts as an NTLM authenticator,
67+
sending Type 2 messages and never initiating with Type 1. SECPKG_CRED_BOTH is
68+
unused even when sending the appropriate flags in the client.
69+
- Protocol Limitation: MS-TNAP ignores AUTH_SERVER_TO_CLIENT and AUTH_HOW_MUTUAL,
70+
enforcing client-driven authentication (RFC 2941).
71+
- No Server Credentials: Type 2 messages lack authentication data, and mutual
72+
authentication occurs only in the client’s Type 3 response, which the server
73+
verifies.
3674

3775
Impact
3876
======
39-
None. The configuration does not expose credentials, tokens, allow bypass, or weaken NTLM authentication. A separate vulnerability that allows for Guest access restriction bypass through MS-TNAP is described elsewhere in this repo.
77+
None. The configuration does not expose credentials, tokens, allow bypass, or
78+
weaken NTLM authentication. A separate vulnerability that allows for Guest access
79+
restriction bypass through MS-TNAP is described elsewhere in this repo.
4080

4181
Mitigation
4282
==========
4383
- No Patch Needed: The issue is not exploitable.
4484
- Disable Telnet: Use SSH to avoid Telnet’s plaintext transmission.
45-
- Monitor Updates: Re-evaluate if future server changes enable Type 1 message initiation.
85+
- Monitor Updates: Re-evaluate if future server changes enable Type 1 message
86+
initiation.
4687

47-
PoC Tool
48-
========
49-
A telnet_token.exe is encoded in this file (built from updated netio.c and security.c):
88+
Testing
89+
=======
90+
A telnet_token.exe is encoded in this file (built from patched netio.c and
91+
security.c) which can be used to inspect telnet traffic and verify the server
92+
behavior:
5093

51-
- Functionality: Parses NTLM messages, attempts reversed authentication with SECPKG_CRED_INBOUND, and dumps message details.
94+
- Functionality: Parses NTLM messages, attempts reversed authentication with
95+
SECPKG_CRED_INBOUND, and dumps message details.
5296
- Usage: telnet_token.exe <ip> <port>
53-
- Output: Displays hex dumps, flags (e.g., NEGOTIATE_EXTENDED_SESSIONSECURITY), and fields (e.g., target name). Exits with SEC_E_INVALID_TOKEN on reversed authentication attempts.
97+
- Output: Displays hex dumps, flags (e.g., NEGOTIATE_EXTENDED_SESSIONSECURITY), and
98+
fields (e.g., target name). Exits with SEC_E_INVALID_TOKEN on reversed
99+
authentication attempts.
100+
101+
The tool is designed to print any authentication token it receives from the server
102+
in a type 2 response when forcing mutual authentication, however these are only
103+
expected to be sent in type 3 messages, should you find a token with this tool - it
104+
is likely due to a modified NTLMSSP implementation.
105+
106+
e.g.
107+
108+
Received AUTH SEND NTLM request from server
109+
DEBUG: StartNTLMAuth called
110+
DEBUG: Using domain: XPSRCBUILD
111+
DEBUG: Using username: Administrator
112+
Sent NTLM Type 1 Message (Raw Hex Dump):
113+
Total Size: 40 bytes
114+
4e 54 4c 4d 53 53 50 00 01 00 00 00 97 82 08 e2
115+
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
116+
05 01 28 0a 00 00 00 0f
117+
118+
Parsed NTLM Type 1 Message:
119+
NTLM Flags: 0xe2088297
120+
- NEGOTIATE_UNICODE
121+
- NEGOTIATE_OEM
122+
- NEGOTIATE_NTLM
123+
- NEGOTIATE_ALWAYS_SIGN
124+
- NEGOTIATE_EXTENDED_SESSIONSECURITY
125+
- NEGOTIATE_VERSION
126+
- NEGOTIATE_128
127+
- NEGOTIATE_KEY_EXCH
128+
- NEGOTIATE_56
129+
Domain Name: (empty)
130+
Workstation Name: (empty)
131+
Version: 5.1 (Build 2600)
132+
DEBUG: Sending Type 1 message, size=57
133+
NTLM Type 1 (NEGOTIATE) message sent successfully
134+
135+
Received AUTH REPLY NTLM from server, code: 1
136+
Processing NTLM_CHALLENGE (Type 2) message
137+
DEBUG: DoNTLMAuth called, dwSize=188
138+
Received NTLM Type 2 Message (Raw Hex Dump):
139+
Total Size: 178 bytes
140+
4e 54 4c 4d 53 53 50 00 02 00 00 00 12 00 12 00
141+
38 00 00 00 15 82 8a e2 02 c4 3c bf d1 9e 77 58
142+
00 00 00 00 00 00 00 00 68 00 68 00 4a 00 00 00
143+
06 01 b0 1d 00 00 00 0f 57 00 49 00 4e 00 32 00
144+
30 00 30 00 38 00 52 00 32 00 02 00 12 00 57 00
145+
49 00 4e 00 32 00 30 00 30 00 38 00 52 00 32 00
146+
01 00 12 00 57 00 49 00 4e 00 32 00 30 00 30 00
147+
38 00 52 00 32 00 04 00 12 00 57 00 49 00 4e 00
148+
32 00 30 00 30 00 38 00 52 00 32 00 03 00 12 00
149+
57 00 49 00 4e 00 32 00 30 00 30 00 38 00 52 00
150+
32 00 07 00 08 00 7c bf 19 d9 f9 b9 db 01 00 00
151+
00 00
54152

55-
e.g.
153+
Parsed NTLM Type 2 Message:
154+
Challenge: 02 c4 3c bf d1 9e 77 58
155+
NTLM Flags: 0xe28a8215
156+
- NEGOTIATE_UNICODE
157+
- NEGOTIATE_NTLM
158+
- NEGOTIATE_ALWAYS_SIGN
159+
- NEGOTIATE_EXTENDED_SESSIONSECURITY
160+
- NEGOTIATE_TARGET_INFO
161+
- NEGOTIATE_VERSION
162+
- NEGOTIATE_128
163+
- NEGOTIATE_KEY_EXCH
164+
- NEGOTIATE_56
165+
Target Name: WIN2008R2
166+
Target Info (hex): 02 00 12 00 57 00 49 00 4e 00 32 00 30 00 30 00 38 00 52 00 3
167+
2 00 01 00 12 00 57 00 49 00 4e 00 32 00 30 00 30 00 38 00 52 00 32 00 04 00 12
168+
00 57 00 49 00 4e 00 32 00 30 00 30 00 38 00 52 00 ...
169+
Server Authentication Token: (none)
170+
DEBUG: Exiting after Type 2 message
56171

57172

58173
Conclusion
59174
==========
60-
The NTLM configuration issue in the Microsoft Telnet Server stems from the intended support for mutual authentication within the MS-TNAP protocol and the server’s SSPI configuration, specifically the use of SECPKG_CRED_BOTH and ASC_REQ_MUTUAL_AUTH flags. These settings suggest the server could act as an authenticatee, initiating authentication with a Type 1 message, which could allow an attacker to invert the authentication flow. However, this vulnerability is not exploitable due to explicit server-side logic that ignores the AUTH_SERVER_TO_CLIENT and AUTH_HOW_MUTUAL flags in MS-TNAP, enforcing a client-driven authentication model. The server’s implementation lacks the necessary code to handle these flags or send a Type 1 message, effectively abandoning mutual authentication functionality during development. As a result, the server remains strictly an NTLM authenticator, rendering the configuration a non-exploitable oddity. Administrators should disable Telnet for general security due to its inherent weaknesses, but no specific action is required for this issue.
175+
The NTLM configuration issue in the Microsoft Telnet Server stems from the intended
176+
support for mutual authentication within the MS-TNAP protocol and the server’s SSPI
177+
configuration, specifically the use of SECPKG_CRED_BOTH and ASC_REQ_MUTUAL_AUTH
178+
flags. These settings suggest the server could act as an authenticatee, initiating
179+
authentication with a Type 1 message, which could allow an attacker to invert the
180+
authentication flow. However, this vulnerability is not exploitable due to explicit
181+
server-side logic that ignores the AUTH_SERVER_TO_CLIENT and AUTH_HOW_MUTUAL flags
182+
in MS-TNAP, enforcing a client-driven authentication model. The server’s
183+
implementation lacks the necessary code to handle these flags or send a Type 1
184+
message, effectively abandoning mutual authentication functionality during
185+
development. As a result, the server remains strictly an NTLM authenticator,
186+
rendering the configuration a non-exploitable oddity. Administrators should disable
187+
Telnet for general security due to its inherent weaknesses, but no specific action
188+
is required for this issue.
61189

62190
Disclosure Timeline
63191
===================
@@ -70,8 +198,8 @@ Credits
70198
=======
71199
Discovered by Hacker Fantastic (https://hacker.house)
72200

73-
Proof-of-Concept
74-
================
201+
Test Utility
202+
============
75203
begin 777 telnet_token.exe
76204
M35J0``,````$````__\``+@`````````0```````````````````````````
77205
M````````````````````X`````X?N@X`M`G-(;@!3,TA5&AI<R!P<F]G<F%M

0 commit comments

Comments
 (0)