GO编写的shellcode Packer,免杀国内常见杀软

admin 2024年5月21日20:28:00评论15 views字数 7798阅读25分59秒阅读模式

文章正文

简介

darkPulse是一个用go编写的shellcode Packer,用于生成各种各样的shellcode loader,目前可过火绒,360,360核晶。

目前只实现了c语言的模板。

特点

  • • 使用sgn编码,使用了EgeBalci/sgn: Shikata ga nai (仕方がない) encoder ported into go with several improvements (github.com)提供的二进制文件。
  • • 支持aes/xor加密,uuid/words混淆,支持间接syscall和unhook两种模式下的callback,fiber,earlybird三种加载方式。
  • • 间接sysacll使用了SysWhispers3的项目,链接:klezVirus/SysWhispers3: SysWhispers on Steroids - AV/EDR evasion via direct system calls. (github.com)
  • • unhook使用了自定义跳转函数的unhook方法 - root@Ev1LAsH ~ (killer.wtf)文中所讲述的方法,文中提到的github仓库https://github.com/trickster0/LdrLoadDll-Unhooking 只实现了64位下的demo,我在 fdx-xdf/LdrLoadDll-Unhooking-x86-x64 (github.com) 完善了32位和64位通用的一段代码。

使用方法

首先要配好gcc的环境,命令行运行gcc -v有反应即可

为了规避内存扫描会休眠10s左右,所以并不能一下就上线

在实战中推荐使用-sandbox参数,针对不同机器情况大概会休眠40s

示例1:

darkPulse.exe -i calc_shellcode.bin -h
      _            _    _____       _
     | |          | |  |  __      | |
   __| | __ _ _ __| | _| |__) |   _| |___  ___
  / _` |/ _` | '__| |/ /  ___/ | | | / __|/ _ 
 | (_| | (_| | |  |   <| |   | |_| | __   __/
  __,_|__,_|_|  |_|__|    __,_|_|___/___|

                    author fdx_xdf
                    version 1.2
                    2024.05

Usage:
    
  -h <help>: 显示帮助信息
  -i <path>: 原始格式 Shellcode 的路径
  -enc <encryption>: Shellcode加密方式 (默认: aes)
  -lang <language>: 加载器的语言 (默认: c)
  -o <output>: 输出文件 (默认: Program)
  -k <keyLength>: 加密的密钥长度 (默认: 16)
  -obf <obfuscation>: 混淆Shellcode以降低熵值 (默认: uuid)
  -f <framework>: 目标架构32位还是64位
  -sandbox <true/false>: 是否开启反沙箱模式 (默认: true)
  -unhook <true/false>: 是否开启unhook模式 (默认: false,使用间接syscall加载)
  -loading <loadingTechnique>: 请选择加载方式,支持callback, fiber, earlybird (默认: callback)
  -debug  <true/false>: 是否打印shellcode中间加密/混淆过程(默认为 'false',即不打印)

示例2:

darkPulse.exe -i calc_shellcode.bin -f 32 -sandbox -unhook
      _            _    _____       _
     | |          | |  |  __      | |
   __| | __ _ _ __| | _| |__) |   _| |___  ___
  / _` |/ _` | '__| |/ /  ___/ | | | / __|/ _ 
 | (_| | (_| | |  |   <| |   | |_| | __   __/
  __,_|__,_|_|  |_|__|    __,_|_|___/___|

                    author fdx_xdf
                    version 1.2
                    2024.05
[+] 开始为您打包exe

[+] 正在使用 sgn 工具进行编码

[+] 进行sgn编码后的shellcode: 0xe8, 0xe7, 0x00, 0x00, 0x00, 0xeb, 0x04, 0xf7, 0xc8, 0xb9, 0xd8, 0x00, 0x00, 0x00, 0x74, 0x28, 0x35, 0x53, 0xcf, 0x00, 0x00, 0x00, 0x16, 0x22, 0x6c, 0x73, 0x4c, 0xd0, 0x90, 0xbb, 0x18, 0x06, 0xc5, 0x9d, 0xc8, 0x9c, 0x24, 0x28, 0x6e, 0xc8, 0x1b, 0xc4, 0x02, 0x02, 0xfe, 0x16, 0x94, 0x94, 0x94, 0x54, 0x22, 0x23, 0xa4, 0x15, 0x15, 0x6d, 0xc6, 0x56, 0x50, 0xdb, 0x71, 0x79, 0xf2, 0x98, 0x8a, 0xfd, 0x4f, 0x57, 0x16, 0x1d, 0x17, 0x31, 0xfe, 0xf9, 0x25, 0xd9, 0x40, 0x38, 0x22, 0xce, 0xec, 0x91, 0x5c, 0x51, 0x4e, 0x45, 0x47, 0x31, 0x5b, 0x0a, 0x7d, 0x0f, 0x1f, 0x00, 0x32, 0x08, 0x7b, 0x37, 0xd6, 0x28, 0xcb, 0x83, 0x60, 0x31, 0x5e, 0x25, 0x7c, 0x5a, 0x5b, 0x76, 0xfd, 0x84, 0x5a, 0x45, 0x7f, 0x20, 0x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 0xbb, 0x18, 0xeb, 0x04, 0x71, 0x5f, 0x24, 0x89, 0x81, 0x6b, 0x1a, 0x04, 0x41, 0x8f, 0xb1, 0xeb, 0x04, 0x15, 0x91, 0x47, 0xfa, 0x81, 0x6b, 0x1e, 0x9c, 0x24, 0x28, 0x8c, 0xeb, 0x04, 0x9b, 0x0f, 0x5b, 0x0a, 0x81, 0x73, 0x22, 0x38, 0x1f, 0xf5, 0xf8, 0xff, 0xe3

[+] Generated AES key: 0x36, 0x37, 0x54, 0x4c, 0x37, 0x4d, 0x78, 0x53, 0x69, 0x52, 0x53, 0x59, 0x32, 0x47, 0x49, 0x67

[+] Generated IV (16-byte): 0x52, 0x42, 0x62, 0x4c, 0x6e, 0x69, 0x4f, 0x5a, 0x44, 0x44, 0x43, 0x4d, 0x6d, 0x6e, 0x58, 0x
63

[+] Using AES-128-CBC encryption

[+] 进行加密后的shellcode:0x11, 0xef, 0xfd, 0x48, 0x48, 0x69, 0x4f, 0x7e, 0xa7, 0x8d, 0x7d, 0x9a, 0x3c, 0xaf, 0x0b, 0x2f, 0xfc, 0xc7, 0x1f, 0xaa, 0xaf, 0x8d, 0x3b, 0x2f, 0x55, 0x55, 0x0e, 0xa1, 0x95, 0x62, 0x85, 0xc3, 0xc1, 0xa5, 0x67, 0x82, 0x65, 0x38, 0x90, 0x39, 0x20, 0x67, 0x86, 0x6a, 0x5c, 0x18, 0x53, 0x1b, 0xa1, 0x87, 0x1e, 0x9e, 0x70, 0xb1, 0x2e, 0x38, 0x67, 0x0d, 0xe7, 0x2f, 0x3e, 0x3f, 0x49, 0x17, 0xaf, 0x2d, 0x98, 0xcd, 0x68, 0x7d, 0x84, 0x49, 0x35, 0x4d, 0xa5, 0xc5, 0xe3, 0x89, 0xa7, 0x5f, 0x86, 0x6a, 0x72, 0xfa, 0x95, 0x27, 0x60, 0xe7, 0x6f, 0x3a, 0x62, 0x7e, 0x07, 0x1f, 0xc8, 0x11, 0x89, 0xc0, 0x34, 0xb4, 0x0f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, 0xbf, 0x29, 0x8a, 0x79, 0x99, 0x96, 0x8e, 0xd7, 0xbc, 0x77, 0x36, 0xa5, 0xe6, 0x39, 0x3f, 0x32, 0x70, 0x5e, 0x75, 0x9b, 0xd7, 0xb9, 0x24, 0xa9, 0x24, 0x78, 0x80, 0x70, 0x9f, 0x80, 0x2a, 0x43, 0x0f, 0x04, 0xea, 0xd0, 0xba, 0x22, 0x2c, 0x4e, 0x20, 0x64, 0x65, 0x8a, 0x15, 0xc7, 0x28, 0x32, 0x4e, 0xa3, 0x8c, 0x16, 0xf7, 0x3d, 0xee, 0x79, 0x8b, 0x75, 0x4b, 0xdc, 0x3a, 0x27, 0xb6, 0xfc, 0x41, 0x9b, 0x40

[+] Generated UUIDs:"48fdef11-6948-7e4f-a78d-7d9a3caf0b2f",
                    "aa1fc7fc-8daf-2f3b-5555-0ea1956285c3",
                    "8267a5c1-3865-3990-2067-866a5c18531b",
                    "9e1e87a1-b170-382e-670d-e72f3e3f4917",
                    "cd982daf-7d68-4984-354d-a5c5e389a75f",
                    "fa726a86-2795-e760-6f3a-627e071fc811",
                    "b434c089-650f-e3e6-8edb-784e2951a2b2",
                    "74e7c8bf-b65c-ec98-25e4-859a08dcafe9",
                    "5ef7a555-6623-68c1-b0d1-58a268764dcd",
                    "1ef05e95-d92f-01ca-e70b-9e0a4c35e183",
                    "a782fc31-20bb-e25d-e0c3-ffbb2ffaeddd",
                    "3f37fd3c-195b-a358-a9f2-0f77415e72b8",
                    "248b6120-1264-9964-731f-e264a40784fe",
                    "89294d26-cdde-915a-4822-4e22208a0503",
                    "8630eab8-6236-ddbf-714d-d20c56358c87",
                    "c1c62639-adef-62f5-2c09-e3abf318b7a8",
                    "f0dbcc2a-38d4-584e-14a6-4b7e9eba3e4f",
                    "b060e8f3-a946-985d-b97d-0a359dbf298a",
                    "8e969979-bcd7-3677-a5e6-393f32705e75",
                    "24b9d79b-24a9-8078-709f-802a430f04ea",
                    "2c22bad0-204e-6564-8a15-c728324ea38c",
                    "ee3df716-8b79-4b75-dc3a-27b6fc419b40",

[+] 正在为您生成模板文件: Program.c

[+] 编译成功: Program.exe

即在当前目录下生成 Program.exe

注意:syscall下的earlybird方式由于某些bug并没有使用间接syscall方式加载,尽量不要使用。

实现效果

5.1日师傅们的测试

GO编写的shellcode Packer,免杀国内常见杀软

微步云沙箱无检出

GO编写的shellcode Packer,免杀国内常见杀软

火绒:无检出

GO编写的shellcode Packer,免杀国内常见杀软

360(开启核晶):无检出(使用syscall和unhook两种方式生成的exe均成功绕过核晶)

GO编写的shellcode Packer,免杀国内常见杀软

下载工具

https://github.com/fdx-xdf/darkPulse

原文始发于微信公众号(安全之眼SecEye):GO编写的shellcode Packer,免杀国内常见杀软

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年5月21日20:28:00
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   GO编写的shellcode Packer,免杀国内常见杀软https://cn-sec.com/archives/2762675.html

发表评论

匿名网友 填写信息