Executive Summary
A low-privileged user with a shell in Session 0 can trigger a DCOM activation that causes a privileged interactive user to authenticate to an attacker-controlled RPC server, and this NTLM authentication can be relayed to other services such as LDAP or SMB to escalate privileges to Domain Admin. Microsoft classified the vulnerability as 'Won't Fix'.
Published on labs.sentinelone.com
NTLM relaying [1] is a well known technique that has long been abused by attackers. Despite the continuous “fixes” from 2001 onwards, it is still possible in a MITM scenario, for certain protocols where signing is not enabled, to intercept the NTLM messages and to “relay” the authentication to a target resource in…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This research looks at NTLM relaying in a cross-protocol scenario on Windows, specifically relaying an authentication that originates from an RPC/DCOM client to a different server protocol such as LDAP, SMB or HTTP. The trigger is the DCOM activation service, which can be made to unmarshal an IStorage object and, through particular CLSIDs, produce an NTLM authentication from the user who is interactively logged on to the machine. The authors describe this as a way to escalate from a low privileged account (or a service account) to Domain Admin without any victim interaction.
The work builds on earlier research into "DCOM DCE/RPC Local NTLM Reflection", where a SYSTEM token is negotiated locally and impersonated, leading to an elevation from a SERVICE account to SYSTEM. In that earlier research a "fake" Oxid Resolver was implemented to instruct the DCOM client to connect to an RPC server under the attacker's control. Two NTLM authentications were observed during that process:
- Oxid Resolution (
IObjectExporter::ResolveOxid2call) - IRemUnknown Interface (
IRemUnknown2::RemReleasecall)
The question this post answers is whether those authentications can be relayed to a different resource on a remote machine (LDAP, SMB, HTTP) instead of being stolen, which would avoid needing impersonation privileges.
Microsoft classified the issue as an important privilege escalation but marked it "Won't Fix".
Setup
The scenario requires two parties on the same machine:
- A compromised account with a shell in Session 0. This could be:
- A low privileged user who can connect to the machine via
WinRM-PSSessionorssh - A low privileged user who has been granted "Logon as a batch job" rights so that he can create and then run scheduled tasks with the property "Run the task whether the user is logged in or not" from an interactive session on this machine (local or via RDP)
- A service account even running under a Hardened Virtual Account (e.g. without impersonation privileges)
- A low privileged user who can connect to the machine via
- A highly privileged user logged on to the same machine (local or via RDP)
The key ingredient is a set of CLSIDs belonging to application identifiers (AppId) that run under the context of the "Interactive User". When instantiated in session 0, they impersonate the logged on user in the first session. If more than one user is interactively connected, the authentication obtained is that of the user with the lowest session id.
The CLSIDs found on a Windows Server 2019 were:
BrowserBroker Class{0002DF02-0000-0000-C000-000000000046}AuthBrokerUI{0ea79562-d4f6-47ba-b7f2-1e9b06ba16a4}Easconsent.dll{5167B42F-C111-47A1-ACC4-8EABE61B0B54}Authentication UI CredUI Out of Proc Helper for Non-AppContainer Clients{924DC564-16A6-42EB-929A-9A61FA7DA06F}UserInfoDialog{934b410c-43e4-415e-9935-fbc081ba93a9}CLSID_LockScreenContentionFlyout{BA441419-0B3F-4FB6-A903-D16CC14CCA44}Picker Host{c58ca859-80bc-48df-8f06-ffa94a405bff}IsolatedMessageDialogFactory{f65817c8-dd85-4136-89f0-b9d12939f2c4}SPPUIObjectInteractive Class{F87B28F1-DA9A-4F35-8EC0-800EFCF26B83}CastServerInteractiveUser{f8842f8e-dafe-4b37-9d38-4e0714a61149}
The tooling used in the proof of concept is impacket and ntlmrelayx, plus a custom C++ POC called RemotePotato0.
Finding it
The first question was which of the two observed authentications to use. The IObjectExporter::ResolveOxid2 call seemed unpromising because the NTLM "Sign flag" was set, and the authors were not sure whether the upper layer protocols would consider it.

The IRemUnknown2::RemRelease authentication met expectations: the flag was not set.

With the authentication chosen, the next step was to trigger and intercept it. The trigger comes from James Forshaw's research, which abused the DCOM activation service by unmarshalling an IStorage object and reflecting the NTLM back to a local RPC TCP endpoint to achieve local privilege escalation. That specific vulnerability was patched, but the DCOM activation service remained a working trigger for RPC authentications, and it is the trigger behind all the "*potato" exploits. Those exploits normally steal a token from a privileged service; here the interest is in CLSIDs that impersonate the user connected to the first session outside Session 0.
Exploitation
Step 1: confirm cross-protocol relaying works
Before building the full chain, the authors wrote a cpp POC that performs a MITM between an RPC authentication and relay over an HTTP server that requires authentication. It worked: they were able to browse protected files on the webserver on behalf of the user who authenticated to the RPC server.

Step 2: assemble the full chain
The final exploitation path is:
- An attacker has a shell in Session 0 on the "victim" machine with a low privileged account.
- On this machine a privileged user, like a Domain Admin, is logged on interactively.
- The attacker triggers the DCOM activation service by unmarshalling an
IStorageobject, callingCoGetInstanceFromIstoragewith one of the CLSIDs that impersonate the user logged on interactively and setting the IP of the attacker machine for Oxid resolution requests. - The attacker implements a MITM by just listening on port
135on his machine, which receives theIObjectExporter::ResolveOxid2authenticated call and forwards it to the "fake"Oxid resolver. Even though this call is authenticated, the NTLM "Sign flag" is set, so it is skipped. - The fake
Oxid resolverreturns a string binding for an RPC endpoint under the attacker's control. - The victim machine/user makes an authenticated
IRemUnknown2::RemReleasecall contacting the RPC server, without the Sign flag set. - Authentication is relayed to a privileged resource such as LDAP, SMB, HTTP or other.
At this point there were two implementation paths:
- Implement in
ntlmrelayxa "minimalistic" RPC server with theimpacketlibs. - Encapsulate and forward the authentication in a protocol already implemented and supported in
ntlmrelayx, e.g. HTTP.
The second path was chosen: the whole logic of the MITM and HTTP encapsulator was implemented in a POC (RemotePotato0), and everything was forwarded to ntlmrelayx, targeting the LDAP server running on the Domain Controller to add a new domain admin (or elevate user privileges).

Step 3: control the Sign flag through the poisoned Oxid response
To understand why the Sign flag was not set in IRemUnknown2 calls, the authors tested the poisoned response returned by the fake Oxid Resolver. One of the fields returned by the Oxid resolver is the security bindings, which tell the client which security provider is to be used with the authentication (AuthnSvc). MSRPC (Microsoft implementation of DCE/RPC protocol) supports a variety of "Security Providers", including NTLM.

If the provider is set to NTLM (RPC_C_AUTHN_WINNT), it won't enforce signing; if set to SPNEGO (RPC_C_AUTHN_GSS_NEGOTIATE), it will. The poisoned response code sets the provider as follows:
(*ppdsaOxidBindings)->aStringArray[securityOffset]=RPC_C_AUTHN_WINNT;
The authentication level also matters: for these attacks it should be RPC_AUTHN_LEVEL_CONNECT (0x2), because that defines an authentication mechanism without enforcing encryption/signing. The authors call this kind of RPC authentication "weak" and potentially vulnerable to relay attacks. In ResolveOxid2 the behaviour is controlled by setting the desired authentication level in the pAuthnHint parameter, which returns the minimum accepted authentication level of the object exporter:
error_status_t ResolveOxid2
(
handle_t hRpc,
OXID* pOxid,
unsigned short cRequestedProtseqs,
unsigned short arRequestedProtseqs[],
DUALSTRINGARRAY** ppdsaOxidBindings,
IPID* pipidRemUnknown,
DWORD* pAuthnHint,
COMVERSION* pComVersion
)
{
*pAuthnHint = RPC_C_AUTHN_LEVEL_CONNECT;
The client then makes a call to the IRemUnkown2 interface at least with this level of authentication.

If a higher value is set for the authentication level in the pAuthnHint parameter, for example RPC_C_AUTHN_LEVEL_PKT (0x4), the Sign flag is set again.
Step 4: SMB relaying and the Identify flag
A relaying test with the SMB protocol on servers where signing was not enabled also worked. The only trouble came from one particular CLSID, {c58ca859-80bc-48df-8f06-ffa94a405bff}, which failed with "BAD IMPERSONATION LEVEL".

In that case the NTLM "Identify" flag was set in the IRemUnknown2 call (meaning the server should not impersonate the client), and it was taken into consideration by the SMBv2 protocol.

The authors then altered the flag during the MITM: they unset it in the forwarded NTLM type 1 message:

and reset it in the NTLM type 2 response message:

A quick test demonstrated that it worked.

Step 5: the November 2020 patches and MIC
Some days later, Microsoft released the November 2020 security patches and the technique stopped working. SMB handshakes always ended with a generic "INVALID PARAMETER", triggered by an invalid NTLM authentication.

Testing showed the root cause was the Message Integrity Check (MIC). It appeared to be always checked, even when the NTLM Sign flag was not set, so altering the NTLM messages led to a signature mismatch.
Step 6: the released POC
The RemotePotato0 POC was released at https://github.com/antoniococo/RemotePotato0, with a demonstration video.
Root cause
The design issue is that an RPC client authentication can be relayed to other server protocols without victim interaction. The Sign flag is not enforced on IRemUnknown2 calls when the security provider in the Oxid resolver's security bindings is NTLM (RPC_C_AUTHN_WINNT), and the authentication level can be kept at RPC_AUTHN_LEVEL_CONNECT (0x2), which does not enforce encryption or signing. Both values are returned by the attacker-controlled fake Oxid Resolver, so the attacker influences whether signing is required. Setting the provider to SPNEGO, or raising the authentication level in pAuthnHint to RPC_C_AUTHN_LEVEL_PKT (0x4), would set the Sign flag again.
After the November 2020 patches, the MIC is checked even when the Sign flag is not set, which is why tampering with the NTLM messages (unsetting the Identify flag in the type 1 message and resetting it in the type 2 response) no longer works: the altered messages fail the integrity check.
Microsoft's position, as reported, was that "Servers must defend themselves against NTLM relay attacks". The authors note that setting the sign flag in the NTLM provider as well as SPNEGO would have inhibited the exploit.
Impact
A low privileged account with a shell in Session 0, or a service account even under a Hardened Virtual Account without impersonation privileges, can trigger an authentication from a highly privileged user logged on interactively to the same machine and relay it to LDAP, SMB, HTTP or another privileged resource. In the demonstrated path, relaying to the LDAP server on the Domain Controller allowed adding a new domain admin or elevating user privileges. No victim interaction is required. The executive summary states that every Windows system is vulnerable to this particular NTLM relay attack, and Microsoft marked it "Won't Fix".
Fix
No official patch was released. The recommended hardening is:
- For HTTP(S): remove all non-TLS-protected HTTP bindings (prefer SSL everywhere, particularly where NTLM is used) and configure Channel Binding Tokens validation by setting the
tokenCheckingattribute to a minimum of Allow (if not Require). - For LDAP: set the Domain controller: LDAP server signing requirements Group Policy to Require signature for non-LDAPS LDAP connections.
- Also set the Domain controller: LDAP server channel binding token requirements Group Policy to a minimum of When Supported (if not Always).
- For SMB: configure SMB Signing by setting the Group Policy Digitally sign server communication (always).
A YARA rule was released to detect RemotePotato0:
rule [redacted] {
meta:
author = "SentinelOne"
description = "Detects RemotePotato0 binary"
reference = "https://labs.sentinelone.com/relaying-potatoes-dce-rpc-ntlm-relay-eop"
strings:
$import1 = "CoGetInstanceFromIStorage"
$istorage_clsid = "{00000306-0000-0000-c000-000000000046}" nocase wide ascii
$meow_header = { 4d 45 4f 57 }
$clsid1 = "{11111111-2222-3333-4444-555555555555}" nocase wide ascii
$clsid2 = "{5167B42F-C111-47A1-ACC4-8EABE61B0B54}" nocase wide ascii
condition:
(uint16(0) == 0x5A4D) and $import1 and $istorage_clsid and $meow_header and 1 of ($clsid*)
}
Variants to test
- Try the other CLSIDs from the list on a target where a privileged user is logged on interactively, and check whether the resulting
IRemUnknown2authentication carries the Sign flag. A positive result is an authentication without the flag that can be relayed. - Set the security provider in the poisoned Oxid response to SPNEGO (
RPC_C_AUTHN_GSS_NEGOTIATE) instead of NTLM and observe whether the Sign flag appears, confirming the provider controls signing. - Set
pAuthnHinttoRPC_C_AUTHN_LEVEL_PKT (0x4)and check whether the Sign flag is set again, confirming the authentication level controls it. - Relay to SMB on a server without signing enabled and watch for "BAD IMPERSONATION LEVEL" with CLSIDs that set the Identify flag; a positive result is a successful relay after the flag is altered, on unpatched systems.
- On systems with the November 2020 patches, attempt the same flag alteration and check whether the handshake fails with "INVALID PARAMETER", which indicates MIC enforcement.
- Relay to HTTP and LDAP targets that lack the mitigations above; a positive result is authenticated access on behalf of the privileged user, such as browsing protected files or modifying directory objects.
What happened, in plain words
Imagine a large office building where every employee has a badge. The badge proves who you are, and the building's doors, filing cabinets and server rooms all trust it. Now imagine a visitor who has a temporary badge for the lobby only. If that visitor could somehow borrow a senior manager's badge for a few seconds, walk to the server room, and use it before anyone noticed, they would have escalated from "visitor" to "manager" without ever stealing the badge or tricking the manager.
That is roughly what this research describes, on Windows computers. Windows has a built-in way for programs to prove who they are to other programs, called NTLM. It works a bit like a secret handshake: instead of sending your password, your computer sends a series of messages that prove it knows the password. The problem is that those messages can, in some situations, be picked up by someone sitting in the middle of the conversation and passed on ("relayed") to a different service, which will then believe the original user is talking to it. This is called an NTLM relay attack.
The authors found a way to make a highly privileged user (for example a Domain Admin, the Windows equivalent of a company's head of IT) produce such an authentication message without that user doing anything at all. A low privileged user who already has a foothold on the same machine can trigger it. The message is then relayed to another service, such as the directory server that controls who is an administrator, and used to grant the attacker more power. Microsoft reviewed the issue, agreed it was an important privilege escalation, and decided not to fix it, marking it "Won't Fix".
The rest of this article walks through how the authors got there, step by step, explaining each piece as it comes up.
Introduction
NTLM relaying is an old and well known technique. It has been abused by attackers since at least 2001, and despite repeated fixes it still works in some situations. The basic idea: when a program on Windows authenticates to another program, the authentication messages travel over the network. If an attacker can position themselves between the two (a "man in the middle", or MITM), and if the protocol in use does not require the messages to be signed (cryptographically stamped so tampering is detectable), the attacker can take those messages and forward them to a different server. That server sees a valid authentication and lets the attacker in, as the original user.
Normally, an NTLM relay needs the victim to do something: click a link, open a file, visit a share. The attacker has to trick the victim into authenticating to a resource the attacker controls. The research here is interesting because it removes that requirement.
The authors had previously worked on something called "DCOM DCE/RPC Local NTLM Reflection". DCOM is Microsoft's system for one program to ask another program (a "COM object") to run, even on a different machine. DCE/RPC is the underlying protocol those programs use to talk to each other. In their earlier work, the authors built a fake "Oxid Resolver" (explained below) to make the DCOM client connect to an RPC server they controlled. During that work they noticed two NTLM authentications happening:
- Oxid Resolution (
IObjectExporter::ResolveOxid2call) - IRemUnknown Interface (
IRemUnknown2::RemReleasecall)
These are two moments in the DCOM conversation where the client proves who it is. The question this post answers: can those authentications be relayed to a different resource on a remote machine, such as LDAP (the protocol directory servers use), SMB (the protocol for file shares) or HTTP (web), instead of being stolen? Stealing a token normally requires special privileges on the machine (impersonation privileges). Relaying avoids that requirement entirely.
Microsoft classified the issue as an important privilege escalation but marked it "Won't Fix".
The NTLM Auth Messages
The first practical question was which of the two authentications to use. The authors looked at the NTLM messages in each and checked a particular flag: the "Sign flag". When this flag is set, the messages are supposed to be signed, meaning any tampering is detectable, which would break a relay. When it is not set, the messages can be forwarded as they are.
The first authentication, IObjectExporter::ResolveOxid2, looked unpromising because the Sign flag was set. The authors were not sure whether the protocols layered on top would honour that flag or ignore it.

The second authentication, IRemUnknown2::RemRelease, met their expectations: the Sign flag was not set.

So the choice was made: use the IRemUnknown2::RemRelease authentication. The next step was to trigger it and intercept it.
The RPC Trigger
The trigger comes from earlier research by James Forshaw. He found a way to abuse the DCOM activation service (the part of Windows that starts COM objects on request) by making it process an IStorage object (a structured piece of data that describes where to find something, a bit like a parcel with an address label). By crafting that object carefully, he could make the service reflect the NTLM authentication back to a local RPC endpoint over TCP, achieving a local privilege escalation. That specific vulnerability was patched, but the DCOM activation service remained a working trigger for RPC authentications. It is, in fact, the trigger behind all the "*potato" exploits (JuicyPotato, RoguePotato and relatives), which normally steal a token from a privileged service.
Here the interest is different. Some CLSIDs (identifiers for COM classes, written as long strings of hex digits in curly braces) belong to applications that run under the context of the "Interactive User". When such a CLSID is instantiated in Session 0 (the background session where services run, separate from the session a logged-in human uses), it impersonates the user who is logged on to the first session. In plain terms: ask Windows to start one of these particular components from a background service, and Windows will make it act as the human sitting at the keyboard.
If more than one user is interactively connected, the authentication obtained is that of the user with the lowest session id.
The scenario the authors describe requires two parties on the same machine:
- A compromised account with a shell in Session 0. This could be:
- A low privileged user who can connect to the machine via
WinRM-PSSessionorssh - A low privileged user who has been granted "Logon as a batch job" rights so that he can create and then run scheduled tasks with the property "Run the task whether the user is logged in or not" from an interactive session on this machine (local or via RDP)
- A service account even running under a Hardened Virtual Account (e.g. without impersonation privileges)
- A low privileged user who can connect to the machine via
- A highly privileged user logged on to the same machine (local or via RDP)
The CLSIDs found on a Windows Server 2019 were:
BrowserBroker Class{0002DF02-0000-0000-C000-000000000046}AuthBrokerUI{0ea79562-d4f6-47ba-b7f2-1e9b06ba16a4}Easconsent.dll{5167B42F-C111-47A1-ACC4-8EABE61B0B54}Authentication UI CredUI Out of Proc Helper for Non-AppContainer Clients{924DC564-16A6-42EB-929A-9A61FA7DA06F}UserInfoDialog{934b410c-43e4-415e-9935-fbc081ba93a9}CLSID_LockScreenContentionFlyout{BA441419-0B3F-4FB6-A903-D16CC14CCA44}Picker Host{c58ca859-80bc-48df-8f06-ffa94a405bff}IsolatedMessageDialogFactory{f65817c8-dd85-4136-89f0-b9d12939f2c4}SPPUIObjectInteractive Class{F87B28F1-DA9A-4F35-8EC0-800EFCF26B83}CastServerInteractiveUser{f8842f8e-dafe-4b37-9d38-4e0714a61149}
The tooling used in the proof of concept is impacket (a collection of Python libraries for working with Windows network protocols) and ntlmrelayx (a tool from that collection that receives NTLM authentications and forwards them to a target), plus a custom C++ POC called RemotePotato0.
Finding an Exploitation Path
Step 1: confirm cross-protocol relaying works
Before building the full chain, the authors wanted to know whether an RPC authentication could be relayed to a completely different protocol. They wrote a cpp POC that performs a MITM between an RPC authentication and a relay over an HTTP server that requires authentication. It worked: they were able to browse protected files on the webserver on behalf of the user who authenticated to the RPC server.

In other words, the RPC client proved who it was to the attacker's fake server, and the attacker immediately reused that proof against a web server, which accepted it and showed the protected files.
Step 2: assemble the full chain
The final exploitation path is:
- An attacker has a shell in Session 0 on the "victim" machine with a low privileged account.
- On this machine a privileged user, like a Domain Admin, is logged on interactively.
- The attacker triggers the DCOM activation service by unmarshalling an
IStorageobject, callingCoGetInstanceFromIstoragewith one of the CLSIDs that impersonate the user logged on interactively and setting the IP of the attacker machine for Oxid resolution requests. - The attacker implements a MITM by just listening on port
135on his machine, which receives theIObjectExporter::ResolveOxid2authenticated call and forwards it to the "fake"Oxid resolver. Even though this call is authenticated, the NTLM "Sign flag" is set, so it is skipped. - The fake
Oxid resolverreturns a string binding for an RPC endpoint under the attacker's control. - The victim machine/user makes an authenticated
IRemUnknown2::RemReleasecall contacting the RPC server, without the Sign flag set. - Authentication is relayed to a privileged resource such as LDAP, SMB, HTTP or other.
At this point there were two implementation paths:
- Implement in
ntlmrelayxa "minimalistic" RPC server with theimpacketlibs. - Encapsulate and forward the authentication in a protocol already implemented and supported in
ntlmrelayx, e.g. HTTP.
The second path was chosen: the whole logic of the MITM and HTTP encapsulator was implemented in a POC (RemotePotato0), and everything was forwarded to ntlmrelayx, targeting the LDAP server running on the Domain Controller to add a new domain admin (or elevate user privileges).

Step 3: control the Sign flag through the poisoned Oxid response
Now that the attack worked, the authors wanted to understand why the Sign flag was not set in IRemUnknown2 calls. They tested the poisoned response returned by the fake Oxid Resolver. One of the fields returned by the Oxid resolver is the security bindings, which tell the client which security provider is to be used with the authentication (AuthnSvc). MSRPC (Microsoft's implementation of the DCE/RPC protocol) supports a variety of "Security Providers", including NTLM.

If the provider is set to NTLM (RPC_C_AUTHN_WINNT), it won't enforce signing; if set to SPNEGO (RPC_C_AUTHN_GSS_NEGOTIATE), it will. The poisoned response code sets the provider as follows:
(*ppdsaOxidBindings)->aStringArray[securityOffset]=RPC_C_AUTHN_WINNT;
Line by line: (*ppdsaOxidBindings) follows a pointer to the structure that holds the bindings the client will use; ->aStringArray[securityOffset] picks the entry at the position reserved for the security provider; and =RPC_C_AUTHN_WINNT sets that entry to the NTLM provider. In plain words: "tell the client to use NTLM, not SPNEGO, when it authenticates to me". Because the attacker controls this response, the attacker controls whether signing is required.
The authentication level also matters: for these attacks it should be RPC_AUTHN_LEVEL_CONNECT (0x2), because that defines an authentication mechanism without enforcing encryption or signing. The authors call this kind of RPC authentication "weak" and potentially vulnerable to relay attacks. In ResolveOxid2 the behaviour is controlled by setting the desired authentication level in the pAuthnHint parameter, which returns the minimum accepted authentication level of the object exporter:
error_status_t ResolveOxid2
(
handle_t hRpc,
OXID* pOxid,
unsigned short cRequestedProtseqs,
unsigned short arRequestedProtseqs[],
DUALSTRINGARRAY** ppdsaOxidBindings,
IPID* pipidRemUnknown,
DWORD* pAuthnHint,
COMVERSION* pComVersion
)
{
*pAuthnHint = RPC_C_AUTHN_LEVEL_CONNECT;
Line by line: error_status_t ResolveOxid2 declares the function that answers the client's question about where to find the object; the parameter list describes what the client sends (an RPC handle, an OXID identifier, the protocols it wants) and what the server returns (the bindings, the identifier of the remote unknown object, the authentication hint, the COM version); *pAuthnHint = RPC_C_AUTHN_LEVEL_CONNECT; writes the value RPC_C_AUTHN_LEVEL_CONNECT into the memory the client pointed at, which tells the client "connect-level authentication is enough". Connect-level means the client proves who it is once, at connection time, without signing or encrypting the traffic afterwards.
The client then makes a call to the IRemUnkown2 interface at least with this level of authentication.

If a higher value is set for the authentication level in the pAuthnHint parameter, for example RPC_C_AUTHN_LEVEL_PKT (0x4), the Sign flag is set again. So the attacker's fake resolver has two levers: the security provider and the authentication level. Both are returned by the attacker, and both decide whether the resulting authentication can be relayed.
Step 4: SMB relaying and the Identify flag
A relaying test with the SMB protocol on servers where signing was not enabled also worked. The only trouble came from one particular CLSID, {c58ca859-80bc-48df-8f06-ffa94a405bff}, which failed with "BAD IMPERSONATION LEVEL".

In that case the NTLM "Identify" flag was set in the IRemUnknown2 call. The Identify flag means the server should not impersonate the client: it may learn who the client is, but it may not act as them. The SMBv2 protocol took that flag into consideration.

The authors then altered the flag during the MITM: they unset it in the forwarded NTLM type 1 message:

and reset it in the NTLM type 2 response message:

In plain words: NTLM has three message types. Type 1 is the client saying "I want to authenticate"; type 2 is the server replying with a challenge; type 3 is the client answering the challenge. The authors unset the Identify flag in the forwarded NTLM type 1 message and reset it in the NTLM type 2 response message.
A quick test demonstrated that it worked.

Step 5: the November 2020 patches and MIC
Some days later, Microsoft released the November 2020 security patches and the technique stopped working. SMB handshakes always ended with a generic "INVALID PARAMETER", triggered by an invalid NTLM authentication.

Testing showed the root cause was the Message Integrity Check (MIC). The MIC is a checksum over the NTLM authentication messages, so altering them makes it fail. It appeared to be always checked, even when the NTLM Sign flag was not set, so altering the NTLM messages led to a signature mismatch. After the patches, the SMB handshakes failed with "INVALID PARAMETER".
Step 6: the released POC
The RemotePotato0 POC was released at https://github.com/antoniococo/RemotePotato0, with a demonstration video.
Root cause
The design issue is that an RPC client authentication can be relayed to other server protocols without victim interaction. The Sign flag is not enforced on IRemUnknown2 calls when the security provider in the Oxid resolver's security bindings is NTLM (RPC_C_AUTHN_WINNT), and the authentication level can be kept at RPC_AUTHN_LEVEL_CONNECT (0x2), which does not enforce encryption or signing. Both values are returned by the attacker-controlled fake Oxid Resolver, so the attacker influences whether signing is required. Setting the provider to SPNEGO, or raising the authentication level in pAuthnHint to RPC_C_AUTHN_LEVEL_PKT (0x4), would set the Sign flag again.
After the November 2020 patches, the MIC is checked even when the Sign flag is not set, which is why tampering with the NTLM messages (unsetting the Identify flag in the type 1 message and resetting it in the type 2 response) no longer works: the altered messages fail the integrity check.
Microsoft's position, as reported, was that "Servers must defend themselves against NTLM relay attacks". The authors note that setting the sign flag in the NTLM provider as well as SPNEGO would have inhibited the exploit.
Impact
A low privileged account with a shell in Session 0, or a service account even under a Hardened Virtual Account without impersonation privileges, can trigger an authentication from a highly privileged user logged on interactively to the same machine and relay it to LDAP, SMB, HTTP or another privileged resource. In the demonstrated path, relaying to the LDAP server on the Domain Controller allowed adding a new domain admin or elevating user privileges. No victim interaction is required. The executive summary states that every Windows system is vulnerable to this particular NTLM relay attack, and Microsoft marked it "Won't Fix".
Fix
No official patch was released. The recommended hardening is:
- For HTTP(S): remove all non-TLS-protected HTTP bindings (prefer SSL everywhere, particularly where NTLM is used) and configure Channel Binding Tokens validation by setting the
tokenCheckingattribute to a minimum of Allow (if not Require). - For LDAP: set the Domain controller: LDAP server signing requirements Group Policy to Require signature for non-LDAPS LDAP connections.
- Also set the Domain controller: LDAP server channel binding token requirements Group Policy to a minimum of When Supported (if not Always).
- For SMB: configure SMB Signing by setting the Group Policy Digitally sign server communication (always).
A YARA rule was released to detect RemotePotato0. YARA is a tool for describing patterns in files so that security software can spot known malicious programs.
rule [redacted] {
meta:
author = "SentinelOne"
description = "Detects RemotePotato0 binary"
reference = "https://labs.sentinelone.com/relaying-potatoes-dce-rpc-ntlm-relay-eop"
strings:
$import1 = "CoGetInstanceFromIStorage"
$istorage_clsid = "{00000306-0000-0000-c000-000000000046}" nocase wide ascii
$meow_header = { 4d 45 4f 57 }
$clsid1 = "{11111111-2222-3333-4444-555555555555}" nocase wide ascii
$clsid2 = "{5167B42F-C111-47A1-ACC4-8EABE61B0B54}" nocase wide ascii
condition:
(uint16(0) == 0x5A4D) and $import1 and $istorage_clsid and $meow_header and 1 of ($clsid*)
}
Line by line: rule [redacted] { starts a rule named after the tool; the meta: block holds descriptive information (author, description, reference URL); the strings: block lists the byte patterns to look for: $import1 is the text CoGetInstanceFromIStorage (a function the tool imports), $istorage_clsid is a specific CLSID string, $meow_header is the four bytes 4d 45 4f 57 (which spell "MEOW"), and $clsid1 and $clsid2 are two more CLSID strings; nocase wide ascii means match regardless of letter case and in both single-byte and two-byte (wide) encodings. The condition: line says the file must start with the bytes 0x5A4D (the "MZ" header that marks a Windows executable), contain the import, the IStorage CLSID and the MEOW header, and contain at least one of the two CLSID strings. In plain words: a Windows program that imports that function, carries those identifiers and starts with those bytes is very likely the RemotePotato0 tool.
Variants to test
- Try the other CLSIDs from the list on a target where a privileged user is logged on interactively, and check whether the resulting
IRemUnknown2authentication carries the Sign flag. A positive result is an authentication without the flag that can be relayed. - Set the security provider in the poisoned Oxid response to SPNEGO (
RPC_C_AUTHN_GSS_NEGOTIATE) instead of NTLM and observe whether the Sign flag appears, confirming the provider controls signing. - Set
pAuthnHinttoRPC_C_AUTHN_LEVEL_PKT (0x4)and check whether the Sign flag is set again, confirming the authentication level controls it. - Relay to SMB on a server without signing enabled and watch for "BAD IMPERSONATION LEVEL" with CLSIDs that set the Identify flag; a positive result is a successful relay after the flag is altered, on unpatched systems.
- On systems with the November 2020 patches, attempt the same flag alteration and check whether the handshake fails with "INVALID PARAMETER", which indicates MIC enforcement.
- Relay to HTTP and LDAP targets that lack the mitigations above; a positive result is authenticated access on behalf of the privileged user, such as browsing protected files or modifying directory objects.
Disclosure timeline
11/30/2020: submitted to MSRC case 62293. 12/29/2020: Microsoft confirmed the vulnerability as Important - Elevation of Privilege. 1/7/2021: the authors informed Microsoft that full details would be published 90 days after the first notification. 1/7/2021: Microsoft asked to keep the issue confidential until 13 April 2021 (135 days after the first notification) and said a fix was scheduled for that day. 2/10/2021: the authors agreed. March to April 2021: multiple notifications asking whether the fix would be released on the agreed date. 4/6/2021: Microsoft said a security fix would not be released on 13 April, with no commitment to an exact date. 4/13/2021: Microsoft said that, after an extensive review, they determined that "Servers must defend themselves against NTLM relay attacks". 4/26/2021: the issue was disclosed.
Glossary
- NTLM: a Windows authentication protocol where a client proves it knows a password without sending the password itself, using a challenge and response exchange.
- NTLM relay: an attack where an attacker in the middle forwards a victim's authentication messages to a different server, which accepts them as the victim's.
- MITM (man in the middle): an attacker positioned between two parties who can read and forward their traffic.
- Sign flag: a flag in NTLM messages indicating that the messages are cryptographically signed so tampering can be detected.
- Identify flag: a flag in NTLM messages meaning the server may learn who the client is but may not act on the client's behalf.
- MIC (Message Integrity Check): a checksum over the whole NTLM exchange that fails if any message was altered.
- DCOM: Microsoft's system that lets one program ask another program (a COM object) to run, possibly on another machine.
- COM object: a reusable software component that other programs can request and use.
- CLSID: a long identifier in curly braces that names a particular COM class.
- AppId: an identifier for an application that hosts COM objects, which can specify the account the objects run under.
- RPC / DCE/RPC / MSRPC: a protocol for one program to call functions in another program across a network; MSRPC is Microsoft's implementation.
- Oxid Resolver: the DCOM component that tells a client where to find a remote object; a fake one can be used to redirect the client to an attacker's server.
- IObjectExporter::ResolveOxid2: the RPC call a DCOM client makes to the Oxid Resolver to ask where an object lives.
- IRemUnknown2::RemRelease: an RPC call a DCOM client makes to a remote object, which also carries an NTLM authentication.
- IStorage: a structured data object describing where to find something, used here to trigger the DCOM activation service.
- CoGetInstanceFromIStorage: the Windows function that starts a COM object from an
IStoragedescription. - Session 0: the background session where Windows services run, separate from the session a logged-in human uses.
- Interactive User: the human logged on to the machine's first session; some COM classes impersonate this user when started from Session 0.
- Impersonation: a program temporarily acting with another user's identity and permissions.
- Token: an internal Windows object representing a user's identity and privileges.
- Privilege escalation: gaining more permissions than you were given, for example from a normal user to an administrator.
- Domain Admin: a highly privileged group in a Windows Active Directory domain.
- Active Directory / Domain Controller: Microsoft's directory service for users and computers, and the server that runs it.
- LDAP: the protocol used to query and modify directory services such as Active Directory.
- SMB: the protocol Windows uses for file and printer sharing.
- HTTP / HTTPS: the protocol browsers use to talk to web servers; HTTPS is HTTP wrapped in TLS encryption.
- TLS / SSL: encryption that protects network traffic.
- Channel Binding Token: a value that ties an authentication to the specific encrypted connection it happened on, so it cannot be reused elsewhere.
- SPNEGO: a negotiation protocol that lets two sides pick an authentication method; in this context the SPNEGO provider enforces signing.
- Security provider / AuthnSvc: the component that performs authentication, such as NTLM or SPNEGO.
- Authentication level: how much protection an RPC authentication gets;
RPC_AUTHN_LEVEL_CONNECTauthenticates once at connection time without signing,RPC_AUTHN_LEVEL_PKTprotects each packet. - pAuthnHint: the field in the Oxid Resolver's reply that tells the client the minimum authentication level to use.
- Poisoned response: a reply from the attacker's fake server containing values chosen by the attacker.
- Port 135: the port the attacker listens on to receive the authenticated
IObjectExporter::ResolveOxid2call. - String binding: the RPC description of where an endpoint can be reached (protocol, address, port).
- impacket: a collection of Python libraries for working with Windows network protocols.
- ntlmrelayx: a tool that receives NTLM authentications and forwards them to a target service.
- POC (proof of concept): a program that demonstrates an attack works.
- RemotePotato0: the proof-of-concept tool released with this research.
- YARA: a tool for writing pattern rules that identify files, used by security software.
- Group Policy: Windows' central mechanism for pushing settings to machines in a domain.
- Hardened Virtual Account: a service account running without impersonation privileges.
- WinRM-PSSession / ssh: ways to open a remote command shell on a Windows machine.
- RDP: Remote Desktop Protocol, used to log on to a Windows machine remotely with a graphical session.
- "Won't Fix": Microsoft's classification meaning the reported issue will not be patched.