Cobalt Strike从入门到精通之定制配置文件进行高级攻击

在线视频地址

Cobalt Strike的配置文件讲解

简介

Beacon是Cobalt Strike为高级攻击者建模的Payload。使用Beacon通过HTTP,HTTPS或DNS出口网络。而且Beacon非常灵活,支持异步和交互式通信。异步通信既低又慢。Beacon将通讯本地,下载任务,然后进入睡眠状态。交互式通信实时发生。

cobalt Strike 的Beacon(信标)的一些Http特征信息可以由C2配置文件进行修改和定制化,所以可定制的C2配置文件可以指定服务端如何发送,接受数据的规律和格式,防止被WAF,IDS对流量进行识别导致被发现。

在这里插入图片描述

可以在启动cs服务端的时候,指定一个配置文件进行加载

./teamserver [external IP] [password] [/path/to/my.profile]

配置文件详解

检查配置文件

cobalt Strike提供了一个小程序C2lint,用来检查你编写的配置文件是否是可用的,是否有错误,这个程序会检查你的语法是否正确,并且会生成一个简单的交互过程让你预览,cobalt Strike强烈推荐你在正式使用之前用这个小程序来检查一下。

./c2lint [/path/to/my.profile]

编写配置文件

编写一个配置文件最好的方式就是根据现有的配置文件进行修改,现在提供一个github上面的C2-Profiles例子:

https://github.com/rsmudge/Malleable-C2-Profiles

可以看到配置文件大概长这样:

set global_option "value";

protocol-transaction {
	set local_option "value";

	client {
		# customize client indicators
	}

	server {
		# customize server indicators
	}
}

所有的配置信息都是写在{}大括号里面。

例如:


http-get {
        set uri "/fengxuan";
        client {
                metadata {
                        base64;
                        prepend "user=";
                        header "Cookie";
                }
        }
}

这个配置定义了在HTTP协议中Get请求的传输,第一句set uri, 表示,在当请求/fengxuan这个URL的时候,会执行以下的配置。

那么整段配置是什么意思呢?

就是在请求/fengxuan 这个地址的时候,http header中的 user字段里面的内容会进行base64加密然后再进行传输,从这个地址接受的返回包,http header中的 user字段会进行base64解密。

数据传输的标记语法
StatementActionInverse
append “string”追加"string"参数去除strings参数的字符串
base64Base64 编码Base64 解码
base64url对url进行Base64 编码对url进行Base64 解码
maskXOR mask w/ random keyXOR mask w/ same random key
netbiosNetBIOS 编码NetBIOS 解码
netbiosuNetBIOS 编码(大写)NetBIOS 解码(大写)
prepend “string”添加"string"参数去除strings参数的字符串
对标记语法处理的四种方式
StatementWhat
header “header”把编码过后的参数作用于header中
parameter “key”把编码过后的参数作用于URL参数中
print把编码过后的参数作用于POST方式中的body中
uri-append将编码过后的参数追加到URL中
其他的选项
OptionContextDefault ValueChanges
data_jitter0向http get和http post服务器输出中附加随机长度字符串(取决于data_jitter的值)。
dns_idle0.0.0.0用于采用DNS信标时的ip地址
dns_max_txt252最大的 DNS TXT 返回的长度
dns_sleep0在每个dns请求之前的休眠时间. (毫秒值)
dns_stager_prependPrepend text to payload stage delivered to DNS TXT record stager
dns_stager_subhost.stage.123456.DNS TXT记录阶段使用的子域名。
dns_ttl1DNS的TTL值
headers_remove在客户端请求中去掉的header值
host_stagetrueHost payload for staging over HTTP, HTTPS, or DNS. Required by stagers.
jitter0默认增加的随机值的比例(0-99%)
maxdns255上传数据时最大的DNS主机名
pipenamemsagent_##使用SMB信标时点对点的名称
pipename_stagerstatus_##Name of pipe to use for SMB Beacon’s named pipe stager. Each # is replaced with a random hex value.
sample_nameMy ProfileThe name of this profile (used in the Indicators of Compromise report)
sleeptime60000默认休眠时间(毫秒值)
smb_frame_headerPrepend header to SMB Beacon messages
ssh_bannerCobalt Strike 4.2SSH client banner
ssh_pipenamepostex_ssh_####Name of pipe for SSH sessions. Each # is replaced with a random hex value.
tcp_frame_headerPrepend header to TCP Beacon messages
tcp_port4444TCP Beacon listen port
urihttp-get, http-post[required option]交互时候的URI地址
uri_x86http-stagerx86 payload stage URI
uri_x64http-stagerx64 payload stage URI
useragentInternet Explorer (Random)默认的User-Agent
verbhttp-get, http-postGET, POST传输的请求协议
编写好的配置文件模板
#
# Etumbot Profile
#   http://www.arbornetworks.com/asert/2014/06/illuminating-the-etumbot-apt-backdoor/
#
# Author: @harmj0y
#
set sample_name "Etumbot";

set sleeptime "5000";
set jitter    "0";
set maxdns    "255";
set useragent "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0)";

http-get {

    set uri "/image/";

    client {

        header "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,*/*l;q=0.8";
        header "Referer" "http://www.google.com";
        header "Pragma" "no-cache";
        header "Cache-Control" "no-cache";

        metadata {
            netbios;
            append "-.jpg";
            uri-append;
        }
    }

    server {

        header "Content-Type" "img/jpg";
        header "Server" "Microsoft-IIS/6.0";
        header "X-Powered-By" "ASP.NET";

        output {
            base64;
            print;
        }
    }
}

http-post {
    set uri "/history/";

    client {

        header "Content-Type" "application/octet-stream";
        header "Referer" "http://www.google.com";
        header "Pragma" "no-cache";
        header "Cache-Control" "no-cache";

        id {
            netbiosu;
            append ".asp";
            uri-append;
        }

        output {
            base64;
            print;
        }
    }

    server {

        header "Content-Type" "img/jpg";
        header "Server" "Microsoft-IIS/6.0";
        header "X-Powered-By" "ASP.NET";

        output {
            base64;
            print;
        }
    }
}
c2lint检查

这个过程可以检查并且预览交互过程

在这里插入图片描述
在这里插入图片描述

注意:有些警告,这个警告有时候会影响运行,不过大多数都不会。

实战

启动服务进行攻击

启动服务并且加载我们的配置文件
在这里插入图片描述

获取权限

在这里插入图片描述

WireShark分析流量
分析get流量

在这里插入图片描述

分析post流量

在这里插入图片描述

总结

cobalt strike 的配置文件可以进行高级定制化的攻击,有效防止WAF,和IDS的追查。可以达到长期的维持访问,在APT攻击中还是比较重要的。

如果图文看不懂可以看视频

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值