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.
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 😉
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
- Coerce a privileged user to authenticate against an attacker-controlled server.
- Initiate an NTLM authentication from the attacker's client to a target server service.
- Intercept the context from the server's NTLM challenge to the attacker's client.
- Retrieve the context from the attacker's server's NTLM challenge to the privileged client.
- Swap the two contexts so each client receives the other's challenge.
- 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.