First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 78530
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Sune Kloppenborg Jeppesen <jaervosz@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 78530 depends on: Show dependency tree
Bug 78530 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: 2005-01-18 09:22 0000
An overflow exists in the socket_getline() function. This function
reads a string from the socket into a given array and is used by
the nntp_get_response function.

The problem code is:

        while (TRUE) {
                retval = read(sockfd, pi, 1);
                if(retval < 0)
                        ui_socket_error(errno);
                read_count += retval;
                pi++;
                if (buffer[i] == '\n')
                        break;
                i++;
        }

The pi array is the buffer and data is read into it until a '\n'
is received.  So to overflow the buffer one has to provide a long
string without newline characters.

Testing the overflow:
---------------------

Create a server:
perl -e 'print "A" x 1024;print "BBBBCCCCDDDDEEEE"'|  nc -v -l -p 119

Connect to it:
newspost  -s test -i localhost -f me@me.nl -n news.news  /etc/hosts

Break the connection by ^C'ing the netcat and you will see that
newspost segfaults immediately.

Fix for the problem:
--------------------

A rather simple fix would be to apply the patch below. It does the
job because all buffers handed to the socket_getline function are
STRING_BUFSIZE big.

--- base/socket.c.orig  Tue Jan 18 11:08:02 2005
+++ base/socket.c       Tue Jan 18 11:10:08 2005
@@ -126,7 +126,7 @@

        i = 0;
        pi = buffer;
-       while (TRUE) {
+       while (read_count < STRING_BUFSIZE - 1) {
                retval = read(sockfd, pi, 1);
                if(retval < 0)
                        ui_socket_error(errno);

------- Comment #1 From Sune Kloppenborg Jeppesen 2005-01-18 09:23:24 0000 -------
Upstream has been notified of disclosure date.

------- Comment #2 From Sune Kloppenborg Jeppesen 2005-02-01 08:23:11 0000 -------
net-news please provide an updated ebuild. Upstream has apparently not released
a fixed version.

------- Comment #3 From Sven Wegener 2005-02-01 08:52:05 0000 -------
net-nntp/newspost-2.0-r1
net-nntp/newspost-2.1.1-r1

with the patch in CVS and stable on x86. 2.0 is still needed because net-nntp/gnewspost depends on it.

------- Comment #4 From Luke Macken (RETIRED) 2005-02-02 16:25:43 0000 -------
GLSA 200502-05, thanks everyone!

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