Finalshell 3.9.2.2 逆向破解

查看 157|回复 10
作者:Ax王者   
前言
去年破解过3.0.10版本,相较现在的版本,混淆加密仍然是Allatori旧版,不知作者是因为调试的需要还是其他的原因仍然保留着源文件名称。
但这一个版本的验证系统大改,主要的改动内容是功能性改动(比如离线激活),安全性改动很少,所以花了一点时间来分析它。
反混淆
由于使用的是 Allatori 混淆器,所以直接使用公开反混淆器threadtear对其进行反混淆。

在最终反混淆的结果发现,只有少数字符串被加密,大部分字符串都是明文。
找到关键类
通过对字符串的搜索,无法找到类似于 “激活” 这样的字眼,目前有两种猜测,一是它的本地化所致,二是有其他对字符串的保护。
但通过命令行运行程序之后发现,它会打印类似于状态指示的一些信息。

在点击登录或者离线激活时,也会打印这样的状态指示信息。
通过对状态指示信息字符串的搜索,就可以成功找到这样的关键类了。

可以发现,这里作者使用了自己的加解密函数对字符串进行加密,所以我们在前面无法搜到相关的重要字符串。
解密字符串
通过对字符串的追踪,最终可以发现是一个基于DES的加解密。
最终对解密方法的实现是这样的:
    /**
     * a method to decrypt final shell encrypted string.
     */
    private static String decrypt(String str) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, InvalidKeyException {
        if (str == null || str.isEmpty()) {
            return "";
        }
        byte[] rawData = Base64.getDecoder().decode(str);
        byte[] arr = new byte[8];
        System.arraycopy(rawData, 0, arr, 0, arr.length);
        byte[] data = new byte[rawData.length - arr.length];
        System.arraycopy(rawData, arr.length, data, 0, data.length);
        return new String(decryptDES(data, generateRandomKey(arr)), StandardCharsets.UTF_8);
    }
    private static byte[] decryptDES(byte[] data, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
        DESKeySpec desKeySpec       = new DESKeySpec(key);
        SecretKey  secretKey = SecretKeyFactory.getInstance("DES").generateSecret(desKeySpec);
        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(2, secretKey, new SecureRandom());
        return cipher.doFinal(data);
    }
    private static byte[] generateRandomKey(byte[] head) {
        long ks = 3680984568597093857L / (long)(new Random((long)head[5])).nextInt(127);
        Random random = new Random(ks);
        int t = head[0];
        for(int i = 0; i
关键接口
通过对字符串的解密,可以初步对流程进行分析。

可以发现,最终的几个关键的变量都被传入了一个接口实现之中,我们进入这个接口。

结合前面ControlClient.class的分析,接口的唯一方法的参数基本可以确定。
由此,我们只需要自行构造接口实现的参数之后调用实现即可。
在线激活与离线激活
ControlClient.class 中,可以发现有两个函数十分相似,但第二个函数缺少了几个参数构造行为(HTTP参数),所以基本可以断定是离线激活的实现。
但最终其实都调用了那一个接口的实现,所以我们只需要先分析第一个在线激活,然后将同样的代码复制到第二个函数中即可。
Patch!

直接对实现进行调用,破解完成。

离线激活算法
    public static void generateKey(){
        String proKey = transform(61305 + hardwareId + 8552);
        String pfKey = transform(2356 + hardwareId + 13593);
    }
    public static String transform(String str) throws NoSuchAlgorithmException {
        return Main.hashMD5(str).substring(8, 24);
    }
    public static String hashMD5(String str) throws NoSuchAlgorithmException {
        MessageDigest digest = MessageDigest.getInstance("MD5");
        byte[] hashed = digest.digest(str.getBytes());
        StringBuilder sb = new StringBuilder();
        for (byte b : hashed) {
            int len = b & 0xFF;
            if (len
引用
反混淆器 threadtear
反汇编器 recaf
部分字符串解密算法
DL
https://www.aliyundrive.com/s/3eVnJHDGyuz

字符串, 离线

masterkoko   

[Java] 纯文本查看 复制代码import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Scanner;
/**
* User: TechCity
* Date: 2021-10-04
* Description:
*/
public class FinalShell {
    public static void main(String[] args) throws NoSuchAlgorithmException, IOException {
        System.out.print("请输入FinalShell的离线机器码:");
        Scanner reader = new Scanner(System.in);
        String machineCode = reader.nextLine();
        generateKey(machineCode);
    }
    public static void generateKey(String hardwareId) throws NoSuchAlgorithmException {
        String proKey = transform(61305 + hardwareId + 8552);
        String pfKey = transform(2356 + hardwareId + 13593);
        System.out.println("请将此行复制到离线激活中:"+proKey);
        System.out.println(pfKey);
    }
    public static String transform(String str) throws NoSuchAlgorithmException {
        String md5 = hashMD5(str);
        return hashMD5(str).substring(8, 24);
    }
    public static String hashMD5(String str) throws NoSuchAlgorithmException {
        MessageDigest digest = MessageDigest.getInstance("MD5");
        byte[] hashed = digest.digest(str.getBytes());
        StringBuilder sb = new StringBuilder();
        for (byte b : hashed) {
            int len = b & 0xFF;
            if (len
接楼主的花,献个佛,用java实现了一个完整版。
masterkoko   


Tiok 发表于 2021-10-11 10:13
大佬这个怎么用?

java编译一下直接运行即可。
[Bash shell] 纯文本查看 复制代码javac FinalShell.java
java FinalShell
那年夏天52   

帖子不错,但是我觉得这个软件不好使
rhol   

买过高级版,但是现在还是用回bitwise了。finalshell粘贴大段代码时格式会有问题,而且ncurse菜单显示混乱。
溪吱   

感谢分享
Mainos   


那年夏天52 发表于 2021-10-3 23:26
帖子不错,但是我觉得这个软件不好使

+1,入正版也不好使
wangwanghz   

感谢楼主分享,以前用过这个
alivio_israu   

看來还是有必要学学编程啊!!
yyb414   

感谢分享!
您需要登录后才可以回帖 登录 | 立即注册

返回顶部