0x00 简介
什么是RedGuard
RedGuard是基于命令与控制(C2)前端流控技术的衍生工具,具有更轻量的设计、高效的流量交互、可靠的兼容性以及使用Go语言开发的强大功能。随着网络攻击手段的不断演变,红蓝队演习的愈加复杂,RedGuard旨在为红队提供更好的C2通道隐藏方案,为C2通道提供流量控制,阻断“恶意”的分析流量,更好的完成整个攻击任务。
RedGuard 是一款 C2 前端流量控制工具,可以规避 Blue Team、AVS、EDR、网络空间搜索引擎的检测。
何时使用 RedGuard?
-
在攻防演习中,调查人员试图进行网络归因分析,利用态势感知平台分析与攻击者相关的 C2 流量
-
基于JA3指纹库识别云沙箱,阻止恶意软件样本分析
-
阻止恶意请求执行重放攻击并实现在线混淆
-
在指定连接服务器的 IP 的情况下通过白名单限制访问请求
-
阻止网络空间测绘技术对C2设施的扫描识别,重定向或拦截扫描探测的流量
-
支持对多台C2服务器进行前端流控,并可实现域名前端、负载均衡连接,达到隐藏效果
-
可通过请求IP反查API接口,根据IP地址归属地进行区域主机连接限制
-
无需改变源代码,解决分阶段 checksum8 规则路径解析的强大特性。
-
通过目标请求的拦截日志分析蓝队可追溯行为,可用于追踪对等连接事件/问题
-
可自定义样本合法交互时间段,实现仅在工作时间段进行流量交互的功能
-
可塑性 C2 配置文件解析器能够严格根据可塑性配置文件验证入站 HTTP/S 请求,并在违反规定时丢弃传出的数据包(支持可塑性配置文件 4.0+)
-
为大量与网络安全供应商相关的设备、蜜罐和云沙箱内置 IPV4 地址黑名单,以自动拦截重定向请求流量
-
SSL证书信息和重定向URL,可通过自定义工具与样本进行交互,避免工具流量被固定签名
-
..........
0x01 安装
你可以直接下载编译好的版本使用,也可以远程下载go包进行独立编译执行。
git clone https://github.com/wikiZ/RedGuard.git
cd RedGuard
# You can also use upx to compress the compiled file size
go build -ldflags "-s -w" -trimpath
# Give the tool executable permission and perform initialization operations
chmod +x ./RedGuard&&./RedGuard
0x02 配置说明
初始化
如下图所示,设置可执行权限并初始化RedGuard。首次运行会在当前用户主目录生成配置文件,实现灵活的功能配置。配置文件名:.RedGuard_CobaltStrike.ini。
配置文件内容:
cert的配置选项主要是针对样本与C2前端基础设施之间的SSL证书加密HTTPS通信的配置信息,proxy主要是配置反向代理流量中的控制选项,具体使用会在下文详细说明。
在RedGuard执行目录下的cert-rsa/目录下会生成SSL证书加密的HTTPS通信,你可以通过修改配置文件来启动和停止该工具的基本功能(证书的序列号是根据时间戳生成的,不用担心跟该功能有关联),如果你想使用自己的证书,只需将它们重命名为ca.crt和ca.key即可。
openssl x509 -in ca.crt -noout -text
每次启动 RedGuard 时都会更新随机 TLS JARM 指纹,以防止其被用于验证 C2 基础设施。
在使用自己证书的情况下,修改配置文件中的HasCert参数,防止true由于JARM混淆随机化导致CipherSuites加密套件与自定义证书不兼容,从而造成正常通信问题。
# Whether to use the certificate you have applied for true/false
HasCert = false
RedGuard 参数
root@VM-4-13-ubuntu:~# ./RedGuard -h
Usage of ./RedGuard:
-DelHeader string
Customize the header to be deleted
-DropAction string
RedGuard interception action (default "redirect")
-EdgeHost string
Set Edge Host Communication Domain (default "*")
-EdgeTarget string
Set Edge Host Proxy Target (default "*")
-FieldFinger string
Set HTTP Header identification field Info
-FieldName string
Set the name of the HTTP Header identification field
-HasCert string
Whether to use the certificate you have applied for (default "true")
-allowIP string
Proxy Requests Allow IP (default "*")
-allowLocation string
Proxy Requests Allow Location (default "*")
-allowTime string
Proxy Requests Allow Time (default "*")
-common string
Cert CommonName (default "*.aliyun.com")
-config string
Set Config Path
-country string
Cert Country (default "CN")
-dns string
Cert DNSName
-host string
Set Proxy HostTarget
-http string
Set Proxy HTTP Port (default ":80")
-https string
Set Proxy HTTPS Port (default ":443")
-ip string
IPLookUP IP
-locality string
Cert Locality (default "HangZhou")
-location string
IPLookUP Location (default "风起")
-malleable string
Set Proxy Requests Filter Malleable File (default "*")
-organization string
Cert Organization (default "Alibaba (China) Technology Co., Ltd.")
-redirect string
Proxy redirect URL (default "https://360.net")
-type string
C2 Server Type (default "CobaltStrike")
-u Enable configuration file modification
PS 可以使用参数命令来修改配置文件,当然我觉得用vim手动修改可能更方便。
https://github.com/wikiZ/RedGuard
原文始发于微信公众号(Ots安全):RedGuard - 优秀的 C2 前端流量控制工具
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论