关于ShellcodeTemplate
ShellcodeTemplate是一款易于修改的针对Windows x64/x86的Shellcode模版工具,该工具基于TitanLdr开发,能够帮助广大研究人员将项目代码编译成一个PE可执行程序,并提取.text字段。
Shellcode百科
Shellcode是一段用于利用软件漏洞而执行的代码,实际上是十六进制形式的机器语言,大家知道机器语言是二进制的,CPU只认识二进制,因为要被直接注入到内存中,没办法编译了,所以希望CPU可以执行,那就只能用机器代码了,一般用汇编语言写出程序,在从目标代码中提取出来。
Shellcode可以按照攻击者执行的位置分为本地Shellcode和远程Shellcode。本地运行的Shellcode经常用于利用软件漏洞提升权限,比如在Linux下由普通权限提升至root权限等。而远程Shellcode指的是利用软件漏洞获得特定的Shellcode,再经由C或Python编写远程攻击程序,进而取得对方电脑的root权限。
工具下载
广大研究人员可以使用下列命令将该项目源码克隆至本地:
git clone https://github.com/Cracked5pider/ShellcodeTemplate.git
make // to compile x64 and x86
make x64 // to compile only x64
make x86 // to compile only x86
工具使用样例
Shellocde的入口点如下所示,当然了,我们也可以根据自己的需要来进行修改。
首先,我们需要使用自定义的GetModuleHandle和GetProcAddress来初始化我们要用到的库和函数:
SEC( text, B ) VOID Entry( VOID )
{
INSTANCE Instance = { };
Instance.Modules.Kernel32 = TGetModuleHandle( HASH_KERNEL32 );
Instance.Modules.Ntdll = TGetModuleHandle( HASH_NTDLL );
if ( Instance.Modules.Kernel32 != NULL )
{
// Load needed functions
Instance.Win32.LoadLibraryA = TGetProcAddr( Instance.Modules.Kernel32, 0xb7072fdb );
// Load needed Libraries
Instance.Modules.User*32 = Instance.Win32.LoadLibraryA( GET_SYMBOL( "User*32" ) );
if ( Instance.Modules.User*32 != NULL )
{
Instance.Win32.MessageBoxA = TGetProcAddr( Instance.Modules.User*32, 0xb303ebb4 );
}
}
// ------ Code ------
Instance.Win32.MessageBoxA( NULL, GET_SYMBOL( "Hello World" ), GET_SYMBOL( "MessageBox Title" ), MB_OK );
}
项目地址
https://github.com/Cracked5pider/ShellcodeTemplate
参考资料
https://twitter.com/ilove2pwn_
https://github.com/SecIdiot/TitanLdr
精彩推荐
原文始发于微信公众号(FreeBuf):ShellcodeTemplate:一款针对Windows的Shellcode模版工具
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论