Skip to content
Access control Write-up Advanced

LocalPotato - When Swapping The Context Leads You To SYSTEM

A logic flaw in Windows local NTLM authentication allowed swapping the server context handle in the NTLM challenge, so a low-privileged user could authenticate as a coerced SYSTEM user. This gave arbitrary file write as SYSTEM, which could be turned into code execution and full privilege escalation.

ap Follow

Published on decoder.cloud

Here we are again with our (me and @splintercode) new potato flavor, the LocalPotato! This was a cool finding so we decided to create a dedicated website 😉

Andrea Pierini (@decoder_it), on decoder.cloud

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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the NTLM implementation did not validate that the context handle in the challenge message belonged to the same authentication session, allowing a context swap between a privileged and an unprivileged authentication.

Impact

An attacker could write arbitrary files with SYSTEM privileges and then achieve code execution as SYSTEM, resulting in full privilege escalation; the attack required bypassing SMB anti-reflection and RPC mitigations, which the authors did using a DCOM trigger to set a specific SPN.

What the attacker needed

Low-privileged local or domain user; ability to coerce privileged authentication; SMB server without signing; DCOM/RPC trigger available

How it was found

  1. Coerce a privileged user to authenticate against an attacker-controlled server.
  2. Initiate an NTLM authentication from the attacker's client to a target server service.
  3. Intercept the context from the server's NTLM challenge to the attacker's client.
  4. Retrieve the context from the attacker's server's NTLM challenge to the privileged client.
  5. Swap the two contexts so each client receives the other's challenge.
  6. Forward the empty NTLM authenticate messages in the correct order to complete both authentications.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a program on Windows checks a user's identity locally, it uses a ticket-like 'context' to remember who is who. The researchers found they could swap two such tickets so that the system thought a low-privileged user was actually the powerful SYSTEM account. By doing this, they could write files as SYSTEM and then run code to take over the machine.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.