🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
13 messages
13 total messages Started by Miquel van Smoorenburg Thu, 24 Jul 1997 00:00
ANNOUNCE: INN 1.5.1 buffer overflow patch
#19635
Author: Miquel van Smoorenburg
Date: Thu, 24 Jul 1997 00:00
19 lines
1324 bytes
Okay, I sat down for a couple of hours and looked at all the
strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
patch is available (for free) at

	http://miquels.www.cistron.nl/inn/

NOTE that I'm not quite sure this fixes all holes, as noone has posted a
description of all vulnerabilities (but I suspect noone has one). Another
thing is that yes we are running with this patch but only since 10 minutes :)
However it seemed important enough to me to announce this NOW.

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19590
Author: Julio Sanchez
Date: Thu, 24 Jul 1997 00:00
34 lines
1893 bytes
miquels@cistron.nl (Miquel van Smoorenburg) writes:

> 
> Okay, I sat down for a couple of hours and looked at all the
> strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
> patch is available (for free) at
> 
> 	http://miquels.www.cistron.nl/inn/

I have placed the following Linux Redhat packages for downloading:

-rw-r--r--   1 jjsf     jjsf        27969 Jul 24 20:28 inews-1.5.1-31.i386.rpm
-rw-r--r--   1 jjsf     jjsf       733222 Jul 24 20:28 inn-1.5.1-31.i386.rpm
-rw-r--r--   1 jjsf     jjsf       987717 Jul 24 20:20 inn-1.5.1-31.src.rpm
-rw-r--r--   1 jjsf     jjsf        45972 Jul 24 20:28 inn-devel-1.5.1-31.i386.rpm

on ftp://ftp.esegi.es/pub/linux/redhat/ signed with my PGP key that
you can find in all fine keyservers.

This packages include Miquel's patches and I have been running for 30
minutes with nearly identical packages (I have local changes).

I am trying to upload them now to ftp.redhat.com.

Julio

-- 
Julio Sanchez, SGI Soluciones Globales Internet
Tel: (91) 804 28 37 Fax: (91) 804 14 05  WWW: http://www.esegi.es
jsanchez@esegi.es jsanchez@gmv.es
 PGP Key fingerprint =  E5 29 93 6F 41 4E 00 E2  90 11 A1 8C 72 D0 DE 71 

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19593
Author: Jeff Garzik
Date: Thu, 24 Jul 1997 00:00
19 lines
1228 bytes
Miquel van Smoorenburg wrote:
> Okay, I sat down for a couple of hours and looked at all the
> strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
> patch is available (for free) at


This also claims to "fix" a setuid bug in inndstart.  You should note
that the proper permissions on inndstart enforce news user and group
access ONLY, making the fix unnecessary.

This is an FYI for people who go into irrational panic mode whenever
someone releases a security advisory or patch.... :)
-- 
Jeff Garzik					   Quality news feeds
News Administrator		       INN Technical info, Consulting
Spinne, Inc.				http://www.spinne.com/usenet/

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19598
Author: Jeff Garzik
Date: Thu, 24 Jul 1997 00:00
30 lines
1473 bytes
(cc'd to author)

Miquel van Smoorenburg wrote:
>        In the case where the length of src is less than  that  of
>        n, the remainder of dest will be padded with nulls.
> 
> So I think that
> 
>         strncpy(p, "running", sizeof(buff) - strlen(buff) - 1)
> 
> does indeed put a \0 at the end of the string and the
> 
>         buff[sizeof(buff) - 1] = '\0';
> 
> is superfluous.


Read your manpage....  strncpy will never insert a terminating null past
the size arg.  Doing so would defeat the purpose of strncpy().  Doing a 

	buff[sizeof(buff) - 1] = '\0';

after EACH and EVERY strncpy() is quite necessary.
-- 
Jeff Garzik					   Quality news feeds
News Administrator		       INN Technical info, Consulting
Spinne, Inc.				http://www.spinne.com/usenet/

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19600
Author: Forrest J. Cavalier III
Date: Thu, 24 Jul 1997 00:00
65 lines
2950 bytes

In article <5r81l9$27j$1@holodeck.cistron.nl>, miquels@cistron.nl wrote...
>
>Okay, I sat down for a couple of hours and looked at all the
>strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
>patch is available (for free) at
>
>        http://miquels.www.cistron.nl/inn/
>
>NOTE that I'm not quite sure this fixes all holes, as noone has posted a
>description of all vulnerabilities (but I suspect noone has one). Another
>thing is that yes we are running with this patch but only since 10 minutes :)
>However it seemed important enough to me to announce this NOW.

It probably does not fix all the holes, even if it only takes several
hours to find and fix the vulnerabilities.  (A big if: there are a
lot of them.)

I'm several hours into sorting out the diffs between 1.5.1 and 1.6b2.
   innd/art.c is finished.

The differences are characterized as follows:
   1. String Limit defect fixes
   2. Other defect fixes
   3. Comment changes which do not change executable code.
   4. Unnecessary String limit defect fixes
   5. Feature Enhancements  (XREF slaving, lowmark, etc.)
   6. String Limit defect fixes which are in themselves defective.

As an example of category number 6, there is code in innd/cc.c CCmode()

#ifndef INN1P6SD
	p += strlen(strcpy(p, "running"));
#else /* INN1P6SD */
	p += strlen(strncpy(p, "running", sizeof(buff) - strlen(buff) - 1));
	buff[sizeof(buff) - 1] = '\0';
#endif /* INN1P6SD */

This is a basic mistake: You can't strlen a strncpy result.  The null
terminating assignment happens too late.  (This is actually in a place
where p is KNOWN to be large enough, so this new bug is latent or
untriggerable.)

Still, this indicates to me that not enough time was spent approving
the new changes.

I creating separate patch sets for 1.5.1 which include
groupings of the above.  Initially these will be available only for
a subscription fee.  Eventually, they will be freely available.

These patch sets will permit fixing of holes in 1.5.1, as well as
inspecting for new holes.

I expect them to be ready sometime next week, although if you want
to help, e-mail me.

Forrest Cavalier, Mib Software, INN customization and consulting

BTW, the appropriate change would have been:
	buff[sizeof(buff) - 1] = '\0';
	p += strlen(strncpy(p, "running", sizeof(buff) - strlen(buff) - 2));


Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19607
Author: Miquel van Smoorenburg
Date: Thu, 24 Jul 1997 00:00
64 lines
3043 bytes
In article <5r8944$7d3$1@news1.epix.net>,
Forrest J. Cavalier III <mibsoft@epix.net> wrote:
>
>In article <5r81l9$27j$1@holodeck.cistron.nl>, miquels@cistron.nl wrote...
>   6. String Limit defect fixes which are in themselves defective.
>
>As an example of category number 6, there is code in innd/cc.c CCmode()
>
>#ifndef INN1P6SD
>	p += strlen(strcpy(p, "running"));
>#else /* INN1P6SD */
>	p += strlen(strncpy(p, "running", sizeof(buff) - strlen(buff) - 1));
>	buff[sizeof(buff) - 1] = '\0';
>#endif /* INN1P6SD */
>
>This is a basic mistake: You can't strlen a strncpy result.  The null
>terminating assignment happens too late.  (This is actually in a place
>where p is KNOWN to be large enough, so this new bug is latent or
>untriggerable.)

However, most recent strncpy()s DO add a \0 to the end of the string if
there's space left (SVID 3, POSIX, BSD 4.3, ISO 9899). From my manpage:

       In the case where the length of src is less than  that  of
       n, the remainder of dest will be padded with nulls.

So I think that

	strncpy(p, "running", sizeof(buff) - strlen(buff) - 1)

does indeed put a \0 at the end of the string and the

	buff[sizeof(buff) - 1] = '\0';

is superfluous.

>Still, this indicates to me that not enough time was spent approving
>the new changes.

Who says that all holes have been fixed in 1.6beta. It's useless to
diff 1.5.1 and 1.6.b2 and backport the security fixes. You have to
independently review 1.5.1, and fix it. At a later date the code needs
to be put in 1.6b2 and the result as a whole needs to be checked again.

I plugged all obvious holes in my patch, but note that I did not fix ALL
sprintf()s and strcpy()s. The only ones that need to be fixed are those
that depend on variable input or better, user input. I wish C had something
like perl tainting (and limitless strings :))

>BTW, the appropriate change would have been:
>	buff[sizeof(buff) - 1] = '\0';
>	p += strlen(strncpy(p, "running", sizeof(buff) - strlen(buff) - 2));
                                                                      ^^^

That should be -1.

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19610
Author: Miquel van Smoorenburg
Date: Thu, 24 Jul 1997 00:00
34 lines
2078 bytes
In article <x0yb6wffqm.fsf@pcjjsf.gmv.es>,
Julio Sanchez  <jsanchez@esegi.es> wrote:
>miquels@cistron.nl (Miquel van Smoorenburg) writes:
>
>> 
>> Okay, I sat down for a couple of hours and looked at all the
>> strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
>> patch is available (for free) at
>> 
>> 	http://miquels.www.cistron.nl/inn/
>
>I have placed the following Linux Redhat packages for downloading:

Okay for Debian/Linux i386 users, I have made the following packages available:

 faecfb1ffc72b2cba95c25a385649eec 573 news optional inn_1.5.1-3.dsc
 cd57d38516528bb44e6bb04fb608955d 61489 news optional inn_1.5.1-3.diff.gz
 4625cd1cf2e77cdd982893c0895b37fc 606100 news optional inn_1.5.1-3_i386.deb
 570c941a7da6c29c3ba97c64fcf23a96 45220 news optional inn-dev_1.5.1-3_i386.deb
 f11ebb6d7665a024dfeaa999f37f8f50 31986 news optional inewsinn_1.5.1-3_i386.deb

They are in the Incoming directory of master.debian.org, and can also be
ftp'ed from ftp://ftp.cistron.nl/pub/people/miquels/debian/New/
(there's a mirror on ftp://linux.wauug.org/pub/people/miquel-van-smoorenburg/
which will probably have them tomorrow).

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19617
Author: Julio Sanchez
Date: Thu, 24 Jul 1997 00:00
34 lines
1938 bytes
miquels@cistron.nl (Miquel van Smoorenburg) writes:

> 
> Okay, I sat down for a couple of hours and looked at all the
> strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
> patch is available (for free) at
> 
> 	http://miquels.www.cistron.nl/inn/

I have placed the following Linux Redhat packages for downloading:

-rw-r--r--   1 jjsf     jjsf        27969 Jul 24 20:28 inews-1.5.1-31.i386.rpm
-rw-r--r--   1 jjsf     jjsf       733222 Jul 24 20:28 inn-1.5.1-31.i386.rpm
-rw-r--r--   1 jjsf     jjsf       987717 Jul 24 20:20 inn-1.5.1-31.src.rpm
-rw-r--r--   1 jjsf     jjsf        45972 Jul 24 20:28 inn-devel-1.5.1-31.i386.rpm

on ftp://ftp.esegi.es/pub/linux/redhat/ signed with my PGP key that
you can find in all fine keyservers.

These packages include Miquel's patches and I have been running for 30
minutes with nearly identical packages (I have local changes).

I am trying to upload them now to ftp.redhat.com.

Julio

-- 
Julio Sanchez, SGI Soluciones Globales Internet
Tel: (91) 804 28 37 Fax: (91) 804 14 05  WWW: http://www.esegi.es
jsanchez@esegi.es jsanchez@gmv.es
 PGP Key fingerprint =  E5 29 93 6F 41 4E 00 E2  90 11 A1 8C 72 D0 DE 71 

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19632
Author: Curt Welch
Date: Thu, 24 Jul 1997 00:00
16 lines
1041 bytes
mibsoft@epix.net (Forrest J. Cavalier III) wrote:
> BTW, the appropriate change would have been:
> 	buff[sizeof(buff) - 1] = '\0';
> 	p += strlen(strncpy(p, "running", sizeof(buff) - strlen(buff) - 2));

The way I see it, it should be - 1, not - 2.

"- 2" will cause the strncpy to stop 1 char short, leaving
buf[sizeof(buff) - 2] in an undefined state (i.e. adding
a garbage char to the end of the buffer when it overflows.)

Curt Welch
http://CurtWelch.Com/

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19644
Author: Miquel van Smoorenburg
Date: Fri, 25 Jul 1997 00:00
34 lines
1826 bytes
In article <33D7E146.95CD5BC@spinne.com>,
Jeff Garzik  <jeff.garzik@spinne.com> wrote:
>(cc'd to author)
>
>Read your manpage....  strncpy will never insert a terminating null past
>the size arg.  Doing so would defeat the purpose of strncpy().  Doing a 
>
>	buff[sizeof(buff) - 1] = '\0';
>
>after EACH and EVERY strncpy() is quite necessary.

You're right. My manual page says:

       In the case where the length of src is less than  that  of
       n, the remainder of dest will be padded with nulls.

Ofcourse, strlen(src) >= n is just the case we want to prevent.

I've fixed my patch to use

#define STRCPY(dst, src) \
	(dst[sizeof(dst) - 1] = 0, strncpy(dst, src, sizeof(dst) - 1))

The first part sets the last byte to \0, the strncpy copies one byte less
then the dst length so the last \0 does not get overwritten.

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19646
Author: Miquel van Smoorenburg
Date: Fri, 25 Jul 1997 00:00
32 lines
1912 bytes
In article <5r9o69$q72$1@flea.best.net>, Matt Dillon <dillon@best.net> wrote:
>:In article <5r9m1a$6oe$1@holodeck.cistron.nl>,
>:Miquel van Smoorenburg <miquels@cistron.nl> wrote:
>:>
>:>I've fixed my patch to use
>:>
>:>#define STRCPY(dst, src) \
>:>	(dst[sizeof(dst) - 1] = 0, strncpy(dst, src, sizeof(dst) - 1))
>:>
>:>The first part sets the last byte to \0, the strncpy copies one byte less
>:>then the dst length so the last \0 does not get overwritten.
>:>
>    This is an extremely dangerous macro.
>
>						-Matt

I welcome constructive critisism, that is needed to get INN into gear. The
patch I made may not be the final solution, so all input and help is
appreciated. So please explain what you mean...

I did not say that one should blindly replace all strcpy's with STRCPY,
ofcourse. Perhaps I should have chosen another name. `dst' HAS to be
a statically or stack allocated string, and not a pointer.

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19662
Author: Matt Dillon
Date: Fri, 25 Jul 1997 00:00
25 lines
1395 bytes
:In article <5r9m1a$6oe$1@holodeck.cistron.nl>,
:Miquel van Smoorenburg <miquels@cistron.nl> wrote:
:>
:>I've fixed my patch to use
:>
:>#define STRCPY(dst, src) \
:>	(dst[sizeof(dst) - 1] = 0, strncpy(dst, src, sizeof(dst) - 1))
:>
:>The first part sets the last byte to \0, the strncpy copies one byte less
:>then the dst length so the last \0 does not get overwritten.
:>
:>Mike.
:>-- 
:>| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
:>| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
:>|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

    This is an extremely dangerous macro.

						-Matt



Re: ANNOUNCE: INN 1.5.1 buffer overflow patch
#19675
Author: Miquel van Smoorenburg
Date: Fri, 25 Jul 1997 00:00
31 lines
2006 bytes
In article <33D7E045.6881854C@spinne.com>,
Jeff Garzik  <jeff.garzik@spinne.com> wrote:
>Miquel van Smoorenburg wrote:
>> Okay, I sat down for a couple of hours and looked at all the
>> strcpy/strcat/sprintf calls in inn-1.5.1. If fixed them all, and a
>> patch is available (for free) at
>
>
>This also claims to "fix" a setuid bug in inndstart.  You should note
>that the proper permissions on inndstart enforce news user and group
>access ONLY, making the fix unnecessary.
>
>This is an FYI for people who go into irrational panic mode whenever
>someone releases a security advisory or patch.... :)

Excuse me, but on MY system innd is installed in /usr/sbin as root:root,
and inndstart is installed in /usr/sbin as root:news. This means that
even if someone grabs the news group-id due to a bug in INN or another
program, they can NOT get root access. With the bug in inndstart, they
can. Paranoid? Maybe. But I did hack around in my teens, and this is one
of the standard things you look for when hacking a machine (setuid
root helper program for non-root subsystems).

Mike.
-- 
| Miquel van Smoorenburg |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl     |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|     PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02       |

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads