Cobalt Strike: C/S架构的商业渗透软件,适合多人进行团队协作,可模拟APT做模拟对抗,进行内网渗透。
本文讲解3.12版本,该版本支持了Unicode编码。
Cobalt Strike整体功能了解参考MITRE ATT&CK™
bind/reverse
都由Team Server管理。logs
文件夹credentials
cat teamserver
可看到该文件是一个简单的bash脚本(可根据自己要求修改) 调用Metasploit RPC服务msfrpcd
并启动服务器cobaltstrike.jar
CS的自带的某些功能可能已过时,但其扩展性是非常强大,利用好CS的扩展性十分有用!
./c2lint my.profile
scriptName.cna
- harleyQu1nn/AggressorScripts执行sudo ./teamserver
看到如下说明:
[*] Generating X509 certificate and keystore (for SSL)
[*] ./teamserver <host> <password> [/path/to/c2.profile] [YYYY-MM-DD]
<host> is the (default) IP address of this Cobalt Strike team server
<password> is the shared password to connect to this server
[/path/to/c2.profile] is your Malleable C2 profile
[YYYY-MM-DD] is a kill date for Beacon payloads run from this server
./teamserver <host> <password> [/path/to/c2.profile] [YYYY-MM-DD]
host
本服务器外网IP/域名password
Client GUI连接时需要输入的密码Malleable C2 communication profile
指定C2通信配置文件 该功能体现了CS的强大扩展性kill date
指定所有payload的终止日期# 启动Team Server
# team server 必须以 root 权限运行 以便于监听端口号为0–1023的listener
# 默认使用50050端口 监听来自团队成员CS Client的连接请求
# 例
sudo ./teamserver this.CShost.com pAsSXXXw0rd
启动CS Client GUI./Cobalt Strike
团队成员A首次登录,需要输入连接信息(会自动保存为一个team server profile
下次可直接登录),登录到团队服务器Team Server。
可通过Cobalt Strike - > Preferences - > Team Servers
维护本地的登录信息配置文件的列表team server profiles
。
注:使用
Aggressor Script
可以修改或扩展Cobalt Strike 3.* 的客户端功能和界面
当你没有手动加载过任何Aggressor Script
时,登录后的Client GUI默认界面如下图:
View
和Attack
toolbar - 工具栏为经常使用的功能提供了一键入口(toolbar中所有功能都可以在顶部菜单找到 所以可设置不显示toolbar)
sessions和targerts - 管理被控的目标网络的会话和主机 (概览图中红色部分)共有3种不同的显示视图
View
Tabs - 查看相关结果 (概览图中绿色部分)三种视图
如下图,CS 3.12版 有8种Listener
windows/beacon_tcp/bind_tcp
connect IP
命令控制等待连接的TCP Beaconunlink
命令断开TCP Beacon会话beacon - CS自带的Listeners
foreign - 配合外部Listeners,使其他远控软件能够控制CS中的victim主机
reverse - 表示victim中招后主动先发出请求,与Team Server上的对应的Listener监听的指定端口建立连接
Cobalt Strike -> Script Manager
加载脚本
scriptName.cna
如加载ProcessColor.cna
后,可见修改了ps回显结果:
payload staging - 指将payload用多个stage实现投递
stageless payload artifact - 可理解为包含了payload的"全功能"被控端程序
evil.hta
文件/msg neo 123
则发给成员neo一条消息 内容为123Clone site
功能克隆网站后可在此看到web访问日志及在网站中的按键记录。Host File
功能在Team Server的某端口提供Web以供下载某文件,可在此看到web访问日志。3.*
版本只支持AggressorScriptsCS 3.12 可导出6种报告
Activity report - 活动报告:红队活动timeline
Hosts report - 主机报告:每个主机的Hosts, services, credentials, sessions
Indicators of Compromise - IoC报告:类似于威胁情报报告中的附录IoC信息,
内容包括:Malleable C2 profile配置文件的流量分析、C2域名和ip、你上传的所有文件的MD5 hashes
Sessions report - 会话报告:红队活动的完整信息。它捕获每个session,该session的communication path(通信路径),在该session期间放置在目标上的MD5 hashes,并提供红队活动的日志。
Social engineering report - 社会工程学报告:包括鱼叉钓鱼邮件及点击记录
Tactics, Techniques, and Procedures - 战术技术及相关程序报告:
报告内容是您的Cobalt Strike行动对应的 MITRE ATT&CK™Matrix,可看到对每种战术的检测策略和缓解策略。
如下图,报告可导出为MS Word或PDF文档(勾选即可对其中的Email和password打码):
顶级菜单Reporting下最后的两个选项:
activity.tsv
campaigns.tsv
sentemails.tsv
targets.tsv
applications.tsv
credentials.tsv
services.tsv
tokens.tsv
c2info.tsv
events.tsv
sessions.tsv
webhits.tsv
当有victim主机以任何方式运行了生成的被控端,出现在主机列表,选中要操作的目标主机,右键interact
进入交互命令界面,在此使用Beacon Commands对victim主机执行各种操作。
Beacon Commands是最全的,包含了图形化的控制功能。
beacon> help
Beacon Commands
===============
Command Description
------- -----------
browserpivot Setup a browser pivot session
bypassuac Spawn a session in a high integrity process
cancel Cancel a download that's in-progress
cd Change directory
checkin Call home and post data
clear Clear beacon queue
covertvpn Deploy Covert VPN client
cp Copy a file
dcsync Extract a password hash from a DC
desktop View and interact with target's desktop
dllinject Inject a Reflective DLL into a process
dllload Load DLL into a process with LoadLibrary()
download Download a file
downloads Lists file downloads in progress
drives List drives on target
elevate Try to elevate privileges
execute Execute a program on target (no output)
execute-assembly Execute a local .NET program in-memory on target
exit Terminate the beacon session
getprivs Enable system privileges on current token
getsystem Attempt to get SYSTEM
getuid Get User ID
hashdump Dump password hashes
help Help menu
inject Spawn a session in a specific process
jobkill Kill a long-running post-exploitation task
jobs List long-running post-exploitation tasks
kerberos_ccache_use Apply kerberos ticket from cache to this session
kerberos_ticket_purge Purge kerberos tickets from this session
kerberos_ticket_use Apply kerberos ticket to this session
keylogger Inject a keystroke logger into a process
kill Kill a process
link Connect to a Beacon peer over SMB
logonpasswords Dump credentials and hashes with mimikatz
ls List files
make_token Create a token to pass credentials
mimikatz Runs a mimikatz command
mkdir Make a directory
mode dns Use DNS A as data channel (DNS beacon only)
mode dns-txt Use DNS TXT as data channel (DNS beacon only)
mode dns6 Use DNS AAAA as data channel (DNS beacon only)
mode http Use HTTP as data channel
mode smb Use SMB peer-to-peer communication
mv Move a file
net Network and host enumeration tool
note Assign a note to this Beacon
portscan Scan a network for open services
powerpick Execute a command via Unmanaged PowerShell
powershell Execute a command via powershell.exe
powershell-import Import a powershell script
ppid Set parent PID for spawned post-ex jobs
ps Show process list
psexec Use a service to spawn a session on a host
psexec_psh Use PowerShell to spawn a session on a host
psinject Execute PowerShell command in specific process
pth Pass-the-hash using Mimikatz
pwd Print current directory
reg Query the registry
rev2self Revert to original token
rm Remove a file or folder
rportfwd Setup a reverse port forward
run Execute a program on target (returns output)
runas Execute a program as another user
runasadmin Execute a program in a high-integrity context
runu Execute a program under another PID
screenshot Take a screenshot
setenv Set an environment variable
shell Execute a command via cmd.exe
shinject Inject shellcode into a process
shspawn Spawn process and inject shellcode into it
sleep Set beacon sleep time
socks Start SOCKS4a server to relay traffic
socks stop Stop SOCKS4a server
spawn Spawn a session
spawnas Spawn a session as another user
spawnto Set executable to spawn processes into
spawnu Spawn a session under another PID
ssh Use SSH to spawn an SSH session on a host
ssh-key Use SSH to spawn an SSH session on a host
steal_token Steal access token from a process
timestomp Apply timestamps from one file to another
unlink Disconnect from parent Beacon
upload Upload a file
wdigest Dump plaintext credentials with mimikatz
winrm Use WinRM to spawn a session on a host
wmi Use WMI to spawn a session on a host
如执行cmd命令shell ifconfig
更多命令说明请看附件。
保证操作安全OPSEC - 了解Beacon Commands实现原理
screenshot只能截取x86进程的窗口截图(x64无效)
等等
等等
Cobalt Strike是一款扩展性强、功能强大的渗透软件,值得研究。