<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    CobaltStrike4.X之去除CheckSum8特征

    VSole2021-11-17 14:09:10

    NO.1 前言

    之前介紹了CobaltStrike4.3的License認證分析,今天介紹一下CobaltStrike4.3去除CheckSum8特征的方法,CheckSum8的特征和具體算法不在此細說,但為了避免被掃描出來還是有必要進行修改的。

    NO.2 代碼修改

    BeaconPayload中修改異或數值為新:

    隨便一個10進制數字即可,后面dll中改成對應的16進制數字。

    NO.3 dll修改

    使用CrackSleeve將dll進行解密:

    https://github.com/ca3tie1/CrackSleeve/

    1、將cobaltstrike.jar和CrackSleeve.java放一起

    2、編譯(javac -encoding UTF-8 -classpath cobaltstrike.jar CrackSleeve.java)

    3、解密文件(java -classpath cobaltstrike.jar;./ CrackSleeve decode) # windows命令行執行

    Alt+T進行關鍵字搜索:2Eh

    先雙擊再空格。直接修改xor的值,先Change byte找到2E修改,再Apply pathes to input file保存。(別忘記保存)

    需要修改的dll:beacon.dll、beacon.x64.dll、dnsb.dll、dnsb.x64.dll、pivot.dll、pivot.x64.dll、extc2.dll、extc2.x64.dll

    再加密dll,工具給的命令在我這輸入CustomizeString報錯了,于是給CustomizeKey寫到代碼里了,改完如下可用:

    import common.*;import dns.SleeveSecurity;import java.io.*;import java.util.Enumeration;import java.util.jar.JarEntry;import java.util.jar.JarFile;
    public class CrackSleeve {    private static byte[] OriginKey = {58, 68, 37, 73, 15, 56, -102, -18, -61, 18, -67, -41, 88, -83, 43, -103};    private static byte[] CustomizeKey;    //private static byte[] CustomizeKey = {58, 68, 37, 73, 15, 56, -102, -18, -61, 18, -67, -41, 88, -83, 43, -103};
        private String DecDir = "Resource/Decode/sleeve";    private String EncDir = "Resource/Encode/sleeve";
        public static void main(String[] args) throws IOException {        if (args.length == 0 || args[0].equals("-h") || args[0].equals("--help")) {            System.out.println("UseAge: CrackSleeve OPTION [key]");            System.out.println("Options:");            System.out.println("\tdecode\t\tDecode sleeve files");            System.out.println("\tencode\t\tEncode sleeve files");            System.out.println("\tkey\t\tCustomize key string for encode sleeve files");            System.exit(0);        }        String option = args[0];        if (option.toLowerCase().equals("encode"))        {            CustomizeKey = new byte[]{58, 68, 37, 73, 15, 56, -102, -18, -61, 18, -67, -41, 88, -83, 43, -103};        }
            CrackSleeve Cracker = new CrackSleeve();        // 使用正版key初始化SleeveSecurity中的key        if (option.equals("decode")){            CrackSleevedResource.Setup(OriginKey);            Cracker.DecodeFile();        }else if (option.equals("encode")){            CrackSleevedResource.Setup(CustomizeKey);            Cracker.EncodeFile();        }    }
        private void DecodeFile() throws IOException {        // 文件保存目錄        File saveDir = new File(this.DecDir);        if (!saveDir.isDirectory())            saveDir.mkdirs();
            // 獲取jar文件中sleeve文件夾下的文件列表        try {            String path = this.getClass().getClassLoader().getResource("sleeve").getPath();            String jarPath = path.substring(5,path.indexOf("!/"));            Enumeration<JarEntry> jarEnum = new JarFile(new File(jarPath)).entries();            while (jarEnum.hasMoreElements())            {                JarEntry Element = jarEnum.nextElement();                String FileName = Element.getName();                if (FileName.indexOf("sleeve")>=0 && !FileName.equals("sleeve/")) {                    System.out.print("[+] Decoding "+FileName+"......");                    byte[] decBytes = CrackSleevedResource.DecodeResource(FileName);                    if (decBytes.length > 0) {                        System.out.println("Done.");                        CommonUtils.writeToFile(new File(saveDir,"../"+FileName),decBytes);                    }                    else                        System.out.println("Fail.");                }            }        } catch (IOException e) {            e.printStackTrace();        }
        }
        private void EncodeFile(){        // 文件保存目錄        File saveDir = new File(this.EncDir);        if (!saveDir.isDirectory())            saveDir.mkdirs();
            // 獲取解密文件列表        File decDir = new File(this.DecDir);        File[] decFiles = decDir.listFiles();        if (decFiles.length == 0) {            System.out.println("[-] There's no file to encode, please decode first.");            System.exit(0);        }
            for (File file : decFiles){            String filename = decDir.getPath()+"/"+file.getName();            System.out.print("[+] Encoding " + file.getName() + "......");            byte[] encBytes = CrackSleevedResource.EncodeResource(filename);            if (encBytes.length > 0) {                System.out.println("Done.");                CommonUtils.writeToFile(new File(saveDir,file.getName()),encBytes);            }            else                System.out.println("Fail.");        }    }}
    class CrackSleevedResource{    private static CrackSleevedResource singleton;
        private SleeveSecurity data = new SleeveSecurity();
        public static void Setup(byte[] paramArrayOfbyte) {        // singleton = new CrackSleevedResource(paramArrayOfbyte);        singleton = new CrackSleevedResource(paramArrayOfbyte);    }
        public static byte[] DecodeResource(String paramString) {        return singleton._DecodeResource(paramString);    }
        public static byte[] EncodeResource(String paramString) {        return singleton._EncodeResource(paramString);    }
        private CrackSleevedResource(byte[] paramArrayOfbyte) {        this.data.registerKey(paramArrayOfbyte);    }
        private byte[] _DecodeResource(String paramString) {        byte[] arrayOfByte1 = CommonUtils.readResource(paramString);        if (arrayOfByte1.length > 0) {            long l = System.currentTimeMillis();            return this.data.decrypt(arrayOfByte1);        }        byte[] arrayOfByte2 = CommonUtils.readResource(paramString);        if (arrayOfByte2.length == 0) {            CommonUtils.print_error("Could not find sleeved resource: " + paramString + " [ERROR]");        } else {            CommonUtils.print_stat("Used internal resource: " + paramString);        }        return arrayOfByte2;    }
        private byte[] _EncodeResource(String paramString){        try {            File fileResource = new File(paramString);            InputStream fileStream = new FileInputStream(fileResource);            if (fileStream != null)            {                byte[] fileBytes = CommonUtils.readAll(fileStream);                if (fileBytes.length > 0)                {                    byte[] fileEncBytes = this.data.encrypt(fileBytes);                    return fileEncBytes;                }            }        } catch (FileNotFoundException e) {            e.printStackTrace();        }        return null;    }}
    

    命令重新加密dll:(解密加密其他版本cs修改為對應的OriginKey、CustomizeKey即可)

    java -classpath cobaltstrike.jar;./ CrackSleeve encode
    

    key的值從16進制到byte型轉換可用代碼:

    import java.util.Arrays;
    public class authTest {    public byte[] intToByteArray(int num){        return new byte[] {                (byte) ((num >> 24) & 0xFF),                (byte) ((num >> 16) & 0xFF),                (byte) ((num >> 8) & 0xFF),                (byte) (num & 0xFF)        };    }    public static byte[] hex2bytes(String s) {        int len = s.length();        byte[] data = new byte[len / 2];        for (int i = 0; i < len; i += 2) {            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16));        }        return data;}
        public static void main(String[] args){        authTest authTest = new authTest();        int header = -889274157;        int num = 29999999;        int watermark = 1;
            byte[] bheader = authTest.intToByteArray(header);        byte[] bnum = authTest.intToByteArray(num);        byte[] bwatermark = authTest.intToByteArray(watermark);//        System.out.print(Arrays.toString(bheader)+'\n');//        System.out.print(Arrays.toString(bnum)+'\n');//        System.out.print(Arrays.toString(bwatermark)+'\n');        System.out.println(Arrays.toString(hex2bytes("3a4425490f389aeec312bdd758ad2b99")));
        }}
    

    最后,把encode目錄下的dll,放到idea項目目錄中重新編譯打包。

    進行測試uri地址雖說仍舊可以請求到,但內容已經無法用nmap腳本解密出來,同理也可躲避掃描:

    除了修改異或值的方式,也可以用Beacon Stager listener 去特征的方式改掉checksum8算法,但是只能固定url訪問了,需要配合profile才能使用。

    string
    本作品采用《CC 協議》,轉載必須注明作者和本文鏈接
    如果你不是 Java8 的釘子戶,你應該早就發現了:String 類的源碼已經由 char[] 優化為了 byte[] 來存儲字符串內容,為什么要這樣做呢? 開門見山地說,從 char[] 到 byte[],最主要的目的是為了節省字符串占用的內存 。內存占用減少帶來的另外一個好處,就是 GC 次數也會減少。
    Adobe已經發布了一個名為Stringlifier的開源工具,該工具允許用戶識別任何純文本中隨機生成的字符串,該工具可用于清理日志。Stringlifier工具是用Python編寫的,它使用機器學習來識別插入普通文本中的隨機字符序列。開源工具可用于出于多種目的分析日志,例如研究意外暴露的憑證。Stringlifier能夠在源代碼或配置文件中查找API密鑰,哈希,隨機生成的字符串,包括密碼,日志。Adobe在Github上發布的描述中寫道。
    介紹Runtime 是一系列采用 C++ 語言編寫的功能方法,它實現了大量 JavaScript 運行期間需要的 native 功能。本文分析 Runtime_StringToArray 方法的源碼和重要數據結構,講解 Runtime_StringToArray 方法的觸發條件。
    介紹Runtime 是一系列采用 C++ 語言編寫的功能方法,它實現了大量 JavaScript 運行期間需要的 native 功能。
    通過common-collection相關gadget,想辦法調用org.mozilla.classfile.DefiningClassLoader這個類去加載字節碼。然后通過T3協議的反序列化漏洞發送給待攻擊weblogic服務器。
    舉個例子:但是對于64位的來說 ROPgadget預設的長度是不夠的。所以,我們可以使用ROPgadget --binary ./b --depth 100來加深他的搜索深度。2利用_libc_csu_init制造ROP常規方法我們前面說的利用ROPgadget來尋找,大多都是找到直接設置某個寄存器的rop,當然也可以使用--ropchain這個參數。
    一般情況下類與類之間是相互獨立的,內部類的意思就是打破這種獨立思想,讓一個類成為另一個類的內部信息,和成員變量、成員方法同等級別。「內部類的好處:」把一個類寫在外面和寫在里面最終達到的結果都一樣,那我們為什么還要使用內部類,豈不是多此一舉嗎?
    當被問及網絡間諜是否成功時,愛德華·斯金格表示,他非常有信心地確信,除了國防學院本身,沒有任何其他危害行為。斯金格接受采訪時透露,本次攻擊看起來不像是一次暴力攻擊,但有代價。國防學院立即意識到它可能已成為敵對國家在灰色地帶式網絡攻擊中的目標的可能性。官方迅速采取了行動,對更廣泛的國防部IT網絡沒有影響。
    java安全-02RMI
    2022-03-25 15:35:13
    基礎知識動態代理反射攻擊方式注冊端攻擊服務端java -cp .\ysoserial-master-8eb5
    MISC中常用python腳本
    2021-09-20 20:26:46
    MISC中常用python腳本總結
    VSole
    網絡安全專家
      亚洲 欧美 自拍 唯美 另类