当前位置:网站首页>Cobalt Strike特征修改
Cobalt Strike特征修改
2022-07-06 06:24:00 【zxl2605】
在红蓝对抗以及hvv等等情况下,我们都会用到 Cobalt Strike,那么它也是安全公司重点关注的对象,跟msf类似,但CS操作相对比MSF使用简单,同时也有一个强大的插件库。那么,这么红的工具,特征方面安全软件特征库里肯定是有的,所以我们就要需要修改其特征。
------本文主要探索CS的本身特征,不包含木马免杀,后续会在写免杀系类文章,也算一种学习的记录,欢迎各位师傅指导。
一、CS默认端口
CS开启的默认端口是50050,蓝队在分析的时候,看到ip开放50050,一般都ban了,很明显是CS的端口,所以,我们需要修改50050端口。
在服务端文件teamserver内修改,
vi teamserver
将代码最下面的50050改为其他端口,即可

二、CS指纹https特征证书修改
默认我们不配置CS证书时,使用的是CS自带的证书,先不说为什么要修改,先看看默认证书内容
使用keytool.exe【电脑如果有java环境,是自带的】打开,
keytool -list -v -keystore cobaltstrike.store
需要输入口令,默认情况是123456,如果不是123456,则可以尝试打开teamserver文件,查看

可以尝试一下,不知道,密码也没关系,后面我们需要自己生成。

这个是原始的 cobaltstrike.store文件,全部是CS特征,直接定位到了,查杀。
此时就需要我们自己生成证书了。
keytool -keystore cobaltstrike.store -storepass 123456 -keypass 123456 -genkey -keyalg RSA -alias SuanSuan -dname "CN=Suan Suan, OU=Suan, O=Suan, L=LongZu, S=OO, C=OO"
解释一下什么各参数的意思:
CN=(名字与姓氏), OU=(组织单位名称), O=(组织名称), L=(城市或区域名称), ST=(州或省份名称), C=(单位的两字母国家代码)
其中cobaltstrike.store为新生成的keystore文件,-alias 指定别名,-storepass pass 和 -keypass pass 指定密钥,-keyalg RSA 指定主体公共密钥算法,-dname 指定所有者信
根据上面的信息,我们可以自己生成一个特有的证书,防止之前的证书特征,被查杀。
生成新的证书之后将原来证书删除,放到CS根目录,并且我们需要启用证书:
keytool -importkeystore -srckeystore cobaltstrike.store -destkeystore cobaltstrike.store -deststoretype pkcs12
cobaltstrike.store为生成证书的名字。
再使用keytool查看一下,
keytool -list -v -keystore cobaltstrike.store
此时证书已经是刚刚我们设置的证书信息了
此时证书还没有完全起效,详情见下面c2配置。
三、CS的http服务流量特征修改
我们先生成一个http服务的木马文件,使用wireshark抓包查看详情


这个数据包是CS没http的数据包,从数据包请求和返回就很奇怪,参数太少了,而且U-A头也是IE浏览器的,应该也很少也有使用IE吧,所以我们还是需要修改一下。
使用Malleable C2 Profile自定义CS通信流量特征,
参考项目:https://github.com/xx0hcd/Malleable-C2-Profiles
根据模板文件配置profile,
###global options###
set sleeptime "37500"; #单位ms
set jitter "35"; #睡眠抖动时间,百分比0-99
set useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.69";#U-A头自定义
###SSl Options###
#这里如果有证书可以直接使用自己生成的证书,将这里的注释去除,将下面生成证书的代码注释,没有则利用下面代码生成。
#https-certificate {
#set keystore "cs内.store文件位置";
#set password ".store证书文件密钥";
#}
https-certificate {
set C "US"; #字母国家代码
set CN "Suan Suan"; #名字与姓氏
set L "WU"; #城市名称
set O "Suan Suan"; #组织名称
set OU "Suan Suan"; #组织单位名称
set ST "WU"; #州或省名称
set validity "365"; #证书生效时间
}
###CODE-SIGNER BLOCK###
code-signer{
#用于签名 Windows Executable and Windows Executable(S),确保Payload一致性
set keystore "cobaltstrike.store"; #证书文件名称
set password "123456"; #证书内密码
set alias "baidu.com"; #证书别名
}
###HTTP-GET Block###
http-get {
set uri "/video /knowledge /douga /cinephile"; # 自定义多个url请求路径,以空格相隔
#配置请求参数
client {
header "referer" "https://www.baidu.com/";
header "Host" "https://youtube.com/";
header "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
header "Accept-Language" "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6";
header "Connection" "close";
metadata {
netbiosu; # netbios(大写)编码
append "BV1kF411J7zG?spm_id_from=333.5.0.0"; # 追加参数内容尾缀
parameter "file"; # 将内容放在新增的url参数中
prepend "v="; # 追加参数内容前缀
header "Cookie"; # 添加到HTTP Cookie头中
}
}
#响应内容
server {
header "Content-Type" "text/html; charset=utf-8";
header "content-encoding" "gzip";
header "set-cookie" "innersign=1; path=/; domain=.youtube.com/";
output {
base64;
print;
}
}
}
###HTTP-Post Block###
http-post {
set uri "/knowledge= /food="; # 不能与http-get的url请求路径完全相同
client {
header "Host" "https://youtube.com/";
header "Accept" "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
header "Accept-Language" "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6";
header "Connection" "close";
id {
netbios;
append "spm_id_from=333.5.0.0";
uri-append; # 追加到url末尾
}
output {
base64;
print;
}
}
server {
output {
base64;
print;
}
}
}
上面配置文件【根据上面说明编写,上面文件有很多不合理的地方】有http及https的配置,https是启用上面的证书,自定义证书特征,http则是使传输的数据包更真实,增加蓝队溯源难度。
使用如下命令启用profile配置文件
./teamserver 192.168.1.109 suan c2.profile
就是在CS正常启动下将profile文件加载后面。
此时我们来看一下木马文件http服务的数据包

这个更改后的数据包,我们根据实际情况自己修改profile文件,使数据包更加真实。
那么还有https吧,我们来访问一下https服务


此时我们的证书也就出来了,如果在 profile文件内没有配置https的话,证书信息也不会显示,各类信息为空。
四、域前置
该技术相对较好,即配置cdn服务,防止溯源到ip,并且不会找到真是ip,由于还未成年,无法备案域名,所以过时间补充。
声明:本文所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途,否则后果自行承担!!!
边栏推荐
- Customize the gateway filter factory on the specified route
- 职场进阶指南:大厂人必看书籍推荐
- Data type of MySQL
- [C language] qsort function
- leetcode 24. Exchange the nodes in the linked list in pairs
- Apple has open source, but what about it?
- [postman] the monitors monitoring API can run periodically
- 如何将flv文件转为mp4文件?一个简单的解决办法
- Black cat takes you to learn UFS protocol Chapter 4: detailed explanation of UFS protocol stack
- 专业论文翻译,英文摘要如何写比较好
猜你喜欢

Modify the list page on the basis of jeecg boot code generation (combined with customized components)

Mise en œuvre d’une fonction complexe d’ajout, de suppression et de modification basée sur jeecg - boot

記一個基於JEECG-BOOT的比較複雜的增删改功能的實現

Remember the implementation of a relatively complex addition, deletion and modification function based on jeecg-boot

Win10 cannot operate (delete, cut) files

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

MySQL is sorted alphabetically

Digital triangle model acwing 1015 Picking flowers

win10无法操作(删除、剪切)文件

Selenium source code read through · 9 | desiredcapabilities class analysis
随机推荐
[no app push general test plan
基于JEECG-BOOT的list页面的地址栏参数传递
联合索引的左匹配原则
Black cat takes you to learn UFS Protocol Part 8: UFS initialization (boot operation)
国产游戏国际化离不开专业的翻译公司
[wechat applet] build a development tool environment
Difference between backtracking and recursion
私人云盘部署
Simulation volume leetcode [general] 1061 Arrange the smallest equivalent strings in dictionary order
D - How Many Answers Are Wrong
Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
E - 食物链
Delete the variables added to watch1 in keil MDK
Full link voltage measurement: building three models
LeetCode 731. My schedule II
模拟卷Leetcode【普通】1414. 和为 K 的最少斐波那契数字数目
Simulation volume leetcode [general] 1447 Simplest fraction
Lecture 8: 1602 LCD (Guo Tianxiang)
B - The Suspects
Still worrying about how to write web automation test cases? Senior test engineers teach you selenium test case writing hand in hand