First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 71129
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Tom Knight <tomk@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: GrayShade <GrayShade@rdslink.ro>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
joe_overflow_fix.patch Silly patch for buffer overflow patch Dan Margolis (RETIRED) 2004-11-14 09:05 0000 393 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 71129 depends on: Show dependency tree
Bug 71129 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-11-14 01:51 0000
'joe' suffers from an exploitable stack-based buffer overflow in parsing the
path to the current user's home directory.. Note that this is not critical,
because joe does not run with elevated privileges by default.

Reproducible: Always
Steps to Reproduce:
ulimit -c unlimited; HOME=`perl -e 'print "a"x1030; print "abcd"'` joe; echo
q|gdb joe core
Actual Results:  
note that the actual "buffer size" may vary from distribution to 
distribution.. 1034 is on my actual gentoo system with joe-3.0 compiled with -
O3 and gcc 3.3.2.. if it does not work, try with 1056 or more


I found this bug about three years ago and it seems that it's still unfixed.. 
Could someone (joe maintainer?) take a look at it?

The actual vulnerable function is procrc (rc.c):

        s = (unsigned char *)getenv("HOME");
main.c:
/* ... */
        if (s) {
                s = vsncpy(NULL, 0, sz(s));
                s = vsncpy(sv(s), sc("/."));
                s = vsncpy(sv(s), sv(run));
                s = vsncpy(sv(s), sc("rc"));
                c = procrc(cap, s); 
/* ... */

int procrc(CAP *cap, unsigned char *name)
{
/* ... */
        unsigned char buf[1024];        /* Input buffer */ 
/* ... */
        strcpy(buf, name);
/* ... */
}

------- Comment #1 From Dan Margolis (RETIRED) 2004-11-14 08:49:32 0000 -------
Confirmed (propolice will prevent this, however). 

------- Comment #2 From Dan Margolis (RETIRED) 2004-11-14 09:05:34 0000 -------
Created an attachment (id=43935) [edit]
Silly patch for buffer overflow 

------- Comment #3 From Dan Margolis (RETIRED) 2004-11-14 09:07:30 0000 -------
This is extremely unlikely to be a security vuln. But I added a stupid patch
anyway. What else do I do on a lazy Sunday morning?

------- Comment #4 From Dan Margolis (RETIRED) 2004-11-14 09:45:41 0000 -------
OK, I was going to reassign, but I had a collision with Jaervosz. In either
case, definitely ``no'' on a GLSA for this, and personally, I wouldn't even
consider it a security fix. But it's no big deal either eway. 

------- Comment #5 From Sune Kloppenborg Jeppesen 2004-11-14 09:53:16 0000 -------
I agree with Dan reassigning to tomk.

------- Comment #6 From GrayShade 2004-11-15 07:41:59 0000 -------
shouldn't it have been

    strncpy(buf, name, sizeof(buf));

instead of

    strncpy(buf, name, sizeof(buf) - 1);

?

------- Comment #7 From Tom Knight 2004-11-22 05:33:18 0000 -------
Just to be on the safe side lets make it:

strcpy(buf, name, sizeof(buf) - 1);
buf[sizeof(buf)-1] = '\0';

Fixed, in CVS.

First Last Prev Next    No search results available      Search page      Enter new bug