3571e53040
patches for easier mirroring, to eliminate a special copy, to make www.freebsd.org/security a full copy of security.freebsd.org and be eventually be the same. For now files are just sitting there. The symlinks are missing. Discussed on: www (repository location) Discussed with: simon (so)
235 lines
7.9 KiB
Text
235 lines
7.9 KiB
Text
-----BEGIN PGP SIGNED MESSAGE-----
|
|
|
|
=============================================================================
|
|
FreeBSD-SA-96:15 Security Advisory
|
|
FreeBSD, Inc.
|
|
|
|
Topic: security compromise from ppp
|
|
|
|
Category: core
|
|
Module: ppp
|
|
Announced: 1996-07-04
|
|
Affects: FreeBSD 2.0.5, 2.1, 2.1-stable, and 2.2-current
|
|
Corrected: 2.1-stable and 2.2-current as of 1996-06-10
|
|
FreeBSD only: unknown
|
|
|
|
Patches: ftp://freebsd.org/pub/CERT/patches/SA-96:15/
|
|
|
|
=============================================================================
|
|
|
|
I. Background
|
|
|
|
FreeBSD ships a userland ppp program that can be used by users
|
|
to set up ppp connections.
|
|
This program is also known as ijppp.
|
|
The ppp program has a vulnerability that allows any user to run
|
|
commands under root privileges.
|
|
|
|
II. Problem Description
|
|
|
|
The ppp program does not properly manage user privileges, allowing
|
|
users to run any program with root privileges.
|
|
|
|
III. Impact
|
|
|
|
This vulnerability can only be exploited by users with a valid
|
|
account on the local system to easily obtain superuser access.
|
|
|
|
IV. Workaround
|
|
|
|
One may simply disable the setuid bit on all copies of the ppp
|
|
program. This will close the vulnerability but will only allow
|
|
the superuser to set up ppp connections.
|
|
|
|
As root, execute the commands:
|
|
|
|
# chmod 555 /usr/sbin/ppp
|
|
|
|
then verify that the setuid permissions of the files have been
|
|
removed. The permissions array should read "-r-xr-xr-x" as
|
|
shown here:
|
|
|
|
# ls -l /usr/sbin/ppp
|
|
-r-xr-xr-x 1 root bin 86016 Nov 16 1995 /usr/sbin/ppp
|
|
|
|
V. Solution
|
|
|
|
Patches are available which eliminate this vulnerability.
|
|
The following patch should be applied to the system sources and
|
|
ppp should be rebuilt and reinstalled. The first patch is against
|
|
the FreeBSD 2.1 and FreeBSD-stable source tree. The second patch
|
|
is for FreeBSD-current (version before 1996-06-10).
|
|
|
|
Apply the patch, then (being superuser):
|
|
# cd /usr/src/usr.sbin/ppp
|
|
# make depend
|
|
# make all
|
|
# make install
|
|
|
|
Index: command.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/usr.sbin/ppp/command.c,v
|
|
retrieving revision 1.5.4.3
|
|
retrieving revision 1.5.4.4
|
|
diff -u -r1.5.4.3 -r1.5.4.4
|
|
--- command.c 1996/02/05 17:02:52 1.5.4.3
|
|
+++ command.c 1996/06/10 09:41:49 1.5.4.4
|
|
@@ -17,7 +17,7 @@
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
*
|
|
- * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
+ * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
*
|
|
*/
|
|
#include <sys/types.h>
|
|
@@ -187,9 +187,14 @@
|
|
* We are running setuid, we should change to
|
|
* real user for avoiding security problems.
|
|
*/
|
|
- setgid( getgid() );
|
|
- setuid( getuid() );
|
|
-
|
|
+ if (setgid(getgid()) < 0) {
|
|
+ perror("setgid");
|
|
+ exit(1);
|
|
+ }
|
|
+ if (setuid(getuid()) < 0) {
|
|
+ perror("setuid");
|
|
+ exit(1);
|
|
+ }
|
|
TtyOldMode();
|
|
if(argc > 0)
|
|
execvp(argv[0], argv);
|
|
Index: chat.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/usr.sbin/ppp/chat.c,v
|
|
retrieving revision 1.4.4.1
|
|
retrieving revision 1.4.4.2
|
|
diff -u -r1.4.4.1 -r1.4.4.2
|
|
--- chat.c 1995/10/06 11:24:31 1.4.4.1
|
|
+++ chat.c 1996/06/10 09:41:45 1.4.4.2
|
|
@@ -18,7 +18,7 @@
|
|
* Columbus, OH 43221
|
|
* (614)451-1883
|
|
*
|
|
- * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
+ * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
*
|
|
* TODO:
|
|
* o Support more UUCP compatible control sequences.
|
|
@@ -331,6 +331,15 @@
|
|
nb = open("/dev/tty", O_RDWR);
|
|
dup2(nb, 0);
|
|
LogPrintf(LOG_CHAT, "exec: %s\n", command);
|
|
+ /* switch back to original privileges */
|
|
+ if (setgid(getgid()) < 0) {
|
|
+ LogPrintf(LOG_CHAT, "setgid: %s\n", strerror(errno));
|
|
+ exit(1);
|
|
+ }
|
|
+ if (setuid(getuid()) < 0) {
|
|
+ LogPrintf(LOG_CHAT, "setuid: %s\n", strerror(errno));
|
|
+ exit(1);
|
|
+ }
|
|
pid = execvp(command, vector);
|
|
LogPrintf(LOG_CHAT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
|
|
exit(127);
|
|
|
|
|
|
Patch for FreeBSd-current before 1996-06-10:
|
|
|
|
|
|
Index: command.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/usr.sbin/ppp/command.c,v
|
|
retrieving revision 1.17
|
|
retrieving revision 1.18
|
|
diff -u -r1.17 -r1.18
|
|
--- command.c 1996/05/11 20:48:22 1.17
|
|
+++ command.c 1996/06/09 20:40:58 1.18
|
|
@@ -17,7 +17,7 @@
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
*
|
|
- * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
+ * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
*
|
|
*/
|
|
#include <sys/types.h>
|
|
@@ -190,9 +190,14 @@
|
|
* We are running setuid, we should change to
|
|
* real user for avoiding security problems.
|
|
*/
|
|
- setgid( getgid() );
|
|
- setuid( getuid() );
|
|
-
|
|
+ if (setgid(getgid()) < 0) {
|
|
+ perror("setgid");
|
|
+ exit(1);
|
|
+ }
|
|
+ if (setuid(getuid()) < 0) {
|
|
+ perror("setuid");
|
|
+ exit(1);
|
|
+ }
|
|
TtyOldMode();
|
|
if(argc > 0)
|
|
execvp(argv[0], argv);
|
|
Index: chat.c
|
|
===================================================================
|
|
RCS file: /home/ncvs/src/usr.sbin/ppp/chat.c,v
|
|
retrieving revision 1.10
|
|
retrieving revision 1.11
|
|
diff -u -r1.10 -r1.11
|
|
--- chat.c 1996/05/11 20:48:20 1.10
|
|
+++ chat.c 1996/06/09 20:40:56 1.11
|
|
@@ -18,7 +18,7 @@
|
|
* Columbus, OH 43221
|
|
* (614)451-1883
|
|
*
|
|
- * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
+ * $Id: FreeBSD-SA-96:15.ppp.asc,v 1.1 2001/09/02 00:04:38 kris Exp $
|
|
*
|
|
* TODO:
|
|
* o Support more UUCP compatible control sequences.
|
|
@@ -393,6 +393,15 @@
|
|
nb = open("/dev/tty", O_RDWR);
|
|
dup2(nb, 0);
|
|
LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
|
|
+ /* switch back to original privileges */
|
|
+ if (setgid(getgid()) < 0) {
|
|
+ LogPrintf(LOG_CHAT_BIT, "setgid: %s\n", strerror(errno));
|
|
+ exit(1);
|
|
+ }
|
|
+ if (setuid(getuid()) < 0) {
|
|
+ LogPrintf(LOG_CHAT_BIT, "setuid: %s\n", strerror(errno));
|
|
+ exit(1);
|
|
+ }
|
|
pid = execvp(command, vector);
|
|
LogPrintf(LOG_CHAT_BIT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
|
|
exit(127);
|
|
|
|
=============================================================================
|
|
FreeBSD, Inc.
|
|
|
|
Web Site: http://www.freebsd.org/
|
|
Confidential contacts: security-officer@freebsd.org
|
|
PGP Key: ftp://freebsd.org/pub/CERT/public_key.asc
|
|
Security notifications: security-notifications@freebsd.org
|
|
Security public discussion: security@freebsd.org
|
|
|
|
Notice: Any patches in this document may not apply cleanly due to
|
|
modifications caused by digital signature or mailer software.
|
|
Please reference the URL listed at the top of this document
|
|
for original copies of all patches if necessary.
|
|
=============================================================================
|
|
|
|
-----BEGIN PGP SIGNATURE-----
|
|
Version: 2.6.3ia
|
|
Charset: noconv
|
|
|
|
iQCVAwUBMdwL31UuHi5z0oilAQEqsQP7BgWUN3uwGk9bSTO0dE/SKUtPDVk+ZVyc
|
|
yKF1NadOm8CaM93i2zAsMhEMPHKUS3RWaNhyyBJe0OC9eQthm+OrA6wHvs2mdJ36
|
|
e0bG8j2FwqKyThc+NWlvQJWOnbAOrveCPeEv4ZvZ95rukICRCy4DeaQHL2qg5xv2
|
|
k75uFnuSVBs=
|
|
=t+pA
|
|
-----END PGP SIGNATURE-----
|