search menu icon-carat-right cmu-wordmark

CERT Coordination Center

klogd does not adequately handle NULL byte when parsing text using LogLine( )

Vulnerability Note VU#249579

Original Release Date: 2001-07-24 | Last Revised: 2003-04-09

Overview

There is a denial-of-service vulnerability in certain distributions of the Linux kernel logging daemon (klogd) which could allow an attacker to cause klogd to hang.

Description

The Linux kernel logging daemon (klogd) can be forced to hang if it receives a null byte in a log message from the Linux kernel. Please see the following bug report for more information:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=85478

Impact

This vulnerability causes klogd to go into an infinite loop, thus preventing further kernel log messages from being written to disk.

Solution

Upgrade to latest version of klogd for your Linux distribution.

The following workaround is taken from http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=85478:
The patch below contains a possible fix for this, by treating a null byte as a delimiter, equivalent to \. Additionally, the patch prevents LogLine from being invoked with a negative counter as an argument.

diff -u sysklogd-1.3.orig/klogd.c sysklogd-1.3/klogd.c
--- sysklogd-1.3.orig/klogd.c\t\t Sat Feb 10 13:04:06 2001
+++ sysklogd-1.3/klogd.c\t\t Sat Feb 10 12:58:11 2001
@@ -707,7 +707,7 @@
\t\t break; /* full line_buff or end of input buffer */
}

- if( *ptr == '\' ) /* newline */
+ if( *ptr == '\' || *ptr == '\0') /* newline or null terminator */
{
ptr++;\t\t /* skip newline */
space -= 1;
@@ -877,8 +877,10 @@
\t\t fprintf(stderr, "klogd: Error return from sys_sycall: " \
\t\t \t\t "%d - %s\", errno, strerror(errno));
}
-\t\t
-\t\t LogLine(log_buffer, rdcnt);
+ else
+ \t\t LogLine(log_buffer, rdcnt);
+
+
return;
}

@@ -902,8 +904,8 @@
\t\t Syslog(LOG_ERR, "Cannot read proc file system: %d - %s.", \
\t\t errno, strerror(errno));
}
-\t\t
-\t\t LogLine(log_buffer, rdcnt);
+ else
+ \t\t \t\t LogLine(log_buffer, rdcnt);

return;
}

Vendor Information

249579
 

CVSS Metrics

Group Score Vector
Base
Temporal
Environmental

References

Acknowledgements

This vulnerability was discovered by Thomas Roessler and was reported to the bugs.debian.org mailing list on February 10, 2001.

This document was written by Ian A. Finlay

Other Information

CVE IDs: CVE-2001-0738
Severity Metric: 1.83
Date Public: 2001-02-10
Date First Published: 2001-07-24
Date Last Updated: 2003-04-09 19:19 UTC
Document Revision: 51

Sponsored by CISA.