How I Found A Windows RCE
On Windows, the PowerShell alias for curl actually invoked Invoke-WebRequest, which parsed and executed JavaScript returned by a visited page. An attacker hosting a malicious page could get script to run and, via legacy ActiveX objects, launch a program such as the calculator on the victim's machine.
medium.com
Published on medium.com
So it’s true, the title you just read from this article is correct and I indeed, along with a lot of other researchers, have found a terrifying RCE on Windows 11 latest version! But before I get into this story check out my educational YouTube channel where you get up to date videos about my findings and how to become…
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 PowerShell curl alias mapped to Invoke-WebRequest, whose HTML parsing used a legacy engine that executed script and allowed ActiveX objects to launch programs.
Impact
An attacker could run code on a victim's Windows machine when the victim used the PowerShell curl alias to fetch a malicious page; the text says the issue was fixed shortly after reporting.
What the attacker needed
Windows PowerShell; victim runs curl against attacker page
The fix
It was fixed by Microsoft after disclosure, though the author calls the fix questionable.
How it was found
- Host a page on localhost that returns a script tag.
- Run the curl command in PowerShell against that address.
- Observe the script executing in a pop-up window.
- Later, host a page whose script tries ActiveX objects to run a program.
- Run curl against the attacker page and see the calculator open.
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 you type curl in PowerShell on Windows, you are not really running the curl tool; you are running a built-in PowerShell command that fetches web pages. That command was rendering the fetched page like a browser and running any JavaScript in it. Because the page could then ask Windows to start a program, simply fetching a hostile page could run code on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.