Bug 25336

Summary: dmesg -a
Product: Base System Reporter: mitsuru <mitsuru>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description mitsuru 2001-02-24 07:20:00 UTC
 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':
Comment 1 Poul-Henning Kamp freebsd_committer freebsd_triage 2001-04-04 08:38:57 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

over to bugs
Comment 2 iedowse freebsd_committer freebsd_triage 2001-11-19 23:18:52 UTC
State Changed
From-To: open->closed


Duplicate of bin/25337, which has more information in the audit 
trail.