Subject: security/6761: ntop should not (need to) be installed set{u,g}id
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@proven.weird.com>
List: netbsd-bugs
Date: 01/07/1999 17:30:00
>Number: 6761
>Category: security
>Synopsis: ntop should not (need to) be installed set{u,g}id
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Jan 7 14:35:01 1999
>Last-Modified:
>Originator: Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release: pkgsrc sup Wed Jan 6 08:05:41 EST 1999
>Environment:
System: NetBSD proven 1.3I NetBSD 1.3I (GENERIC) #1: Thu Dec 3 16:23:20 EST 1998 root@woffi.planix.com:/local1/netbsd/netbsd-current/src/sys/arch/i386/compile/GENERIC i386
>Description:
ntop is installed both setuid (to root) and setgid (to wheel)
it should not need to be setuid, and it most definitely
shouldn't complain that it needs to be run as root (it works
perfectly well if you run it as a user in group "wheel" and have
run "chmod g+rw /dev/bpf*".
>How-To-Repeat:
try removing the setiid bits from ntop and run it as non-root.
>Fix:
add the following patches to the pkgsrc/net/ntop/patches/ dir:
(note that Makefile.in needs a newline at the end too!)
--- Makefile.in.orig Tue Oct 6 11:27:31 1998
+++ Makefile.in Thu Jan 7 16:44:33 1999
@@ -99,7 +99,7 @@
report.c: ntop.h
install: force
- $(INSTALL) -m 6550 $(PROG) $(DESTDIR)$(BINDEST)/$(PROG)
+ $(INSTALL) -m 555 $(PROG) $(DESTDIR)$(BINDEST)/$(PROG)
$(INSTALL) -m 444 $(PROG).8 $(DESTDIR)$(MANDEST)/man8/$(PROG).8
lint: $(GENSRC) force
@@ -181,4 +181,4 @@
cd /tmp; mv ntop ntop-1.00; gzip ntop-1.00
/bin/rm -rf /opt/ntop
/bin/rm -rf /var/spool/ntop
- echo "The package file is in /tmp/ntop-1.00.gz: have fun!"
+ echo "The package file is in /tmp/ntop-1.00.gz: have fun!"
--- ntop.c-ORIG Tue Oct 6 03:52:50 1998
+++ ntop.c Thu Jan 7 16:39:54 1999
@@ -184,10 +184,6 @@
if (device == NULL && (device = pcap_lookupdev(ebuf)) == NULL)
error(ebuf);
- if((getuid () && geteuid ()) || setuid (0)) {
- error("Sorry, you must be root in order to run this program.");
- }
-
(void)fprintf(stderr, "%s: listening on %s\n", program_name, device);
(void)fflush(stderr);
@@ -199,10 +195,6 @@
if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0)
error(ebuf);
-
- /* Now that the socket is open, throw away potential setuid/setgid */
- (void)setgid(getgid());
- (void)setuid(getuid());
/* get datalink type */
datalink = pcap_datalink(pcapPtr);
>Audit-Trail:
>Unformatted: