Exploiting Windows 10 in a Local Network with WPAD/PAC and JScript
The report describes how Windows' WPAD/PAC feature automatically fetches and executes a JavaScript configuration file from the local network, and how the authors found memory-corruption bugs in the legacy JScript engine (jscript.dll) that processes it. An attacker on the local network, or in a privileged internet position, could supply a malicious PAC file and exploit these bugs to compromise the machine.
googleprojectzero.blogspot.com
Published on googleprojectzero.blogspot.com
Many widely-deployed technologies, viewed through 20/20 hindsight, seem like an odd or unnecessarily risky idea. Engineering decisions in IT are often made with imperfect information and under time pressure, and some oddities of the IT stack can best be explained with “it seemed like a good idea at the time”.
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 legacy JScript engine used to evaluate PAC files contains memory-safety bugs such as use-after-free, heap overflow, uninitialised variable and out-of-bounds read, and WPAD fetches and executes PAC files from untrusted network sources.
Impact
An attacker on the local network, or in a privileged internet position able to spoof DNS replies, could achieve complete compromise of the victim's Windows machine; the report notes that Chrome sandboxes PAC evaluation and other operating systems do not enable WPAD by default, limiting the attack to Windows.
What the attacker needed
Attacker on the same local network; or privileged position to spoof DNS; victim uses Windows with WPAD enabled
The fix
Microsoft fixed all the reported JScript vulnerabilities, but the report also implies WPAD should be disabled or restricted to trusted servers.
How it was found
- Impersonate the DHCP server on the local network, for example by ARP spoofing or racing the legitimate DHCP server.
- Reply to the DHCP request with option 252 containing a URL to a malicious PAC file.
- The victim machine fetches the PAC file and executes its contents as JavaScript in jscript.dll.
- Trigger one of the memory-corruption bugs in the PAC file to leak heap memory and then overflow a buffer, leading to code execution.
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.
WPAD is a Windows feature that lets a computer ask the local network where to find a small JavaScript file that tells it which proxy to use. The report shows that an attacker who can answer that question (for example by pretending to be the DHCP server) can send a malicious file, and because the old JavaScript engine that runs it has memory bugs, the attacker can take over the computer.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.