衷心感谢 gabe_k 在 C# 中提供了初始 PoC,并实际发现了这个 CVE。这是用 Python 对他的代码进行的重制,复用了他的 stage 文件。
要查看原始 PoC,请访问他的页面:https://github.com/gabe-k/themebleed
一个使用 Python 针对 CVE-2023-38146 “ThemeBleed” 的概念验证。
该程序使用 Impackets SMB 服务器 并重写了 smb2Create 函数,因此需要 Impackets 的功能。
Usage:
Replace {IP-ADDRESS} in the exploit.theme file
python3 ThemeBleedServer.py - Run the SMB server
Use the .theme file on a vulnerable windows 11 machine
As in Gabe's Exploit you need to create a new stage 3 file that is a dll that exports VerifyThemeVersion, the current file only opens Calc.
Themebleed 从一个 .THEME 文件开始,该文件从互联网请求一个 msstyles 文件。
如果文件使用了 “999” 版本号,它将调用 ReviseVersionIfNecessary 函数,该函数不安全地加载一个 .dll 文件,从而允许攻击者加载未经检查的库文件。
我编写这个是因为我无法在 Linux 下编译 C# 代码,可能是我自己对它如何工作不了解,但我懂 Python 编程。
Lines 44-53 in ThemeBleedServer.py/overrideSmb2Create - This is where the path change happens
Lines 191-End in ThemeBleedServer.py - Server Creation
Line 13 in exploit.theme - For IP change.