| Summary: | dmesg -a | ||
|---|---|---|---|
| Product: | Base System | Reporter: | mitsuru <mitsuru> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 1.0-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: gnats-admin->freebsd-bugs over to bugs State Changed From-To: open->closed Duplicate of bin/25337, which has more information in the audit trail. |
Submitter-Id: current-users Originator: Mitsuru Yoshida Organization: RIKEN Confidential: no Synopsis: dmesg -a should be restricted Severity: serious Priority: medium Category: bin Release: FreeBSD 4.2-STABLE i386 Class: change-request Environment: FreeBSD 4.2-STABLE i386 Description: Using dmesg -a, any user can get all data in the message buffer, and it may cause security problem. Especially all messages written to the console are stored in the message buffer during single user mode, and any user can get them later. The use of -a option should be restricted to root user. How-To-Repeat: dmesg -a Fix: --- dmesg.c.dist Wed Feb 21 10:00:26 2001 +++ dmesg.c Wed Feb 21 10:02:11 2001 @@ -56,6 +56,7 @@ #include <unistd.h> #include <vis.h> #include <sys/syslog.h> +#include <sys/types.h> struct nlist nl[] = { #define X_MSGBUF 0 @@ -87,6 +88,10 @@ while ((ch = getopt(argc, argv, "aM:N:")) != -1) switch(ch) { case 'a': + if (getuid() != (uid_t)0) { + fprintf(stderr,"dmesg: must be root to get all data in the message buffer\n"); + exit(1); + } all++; break; case 'M':