Browse Source

libpam: Applied fix for CVE-2014-2583

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Nikos Mavrogiannopoulos 10 years ago
parent
commit
0a232ca6c6
2 changed files with 54 additions and 2 deletions
  1. 2
    2
      libs/libpam/Makefile
  2. 52
    0
      libs/libpam/patches/007-cve-2014-2583.patch

+ 2
- 2
libs/libpam/Makefile View File

@@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=libpam
11 11
 PKG_VERSION:=1.1.8
12
-PKG_RELEASE:=3
12
+PKG_RELEASE:=4
13 13
 
14 14
 PKG_SOURCE:=Linux-PAM-$(PKG_VERSION).tar.bz2
15
-PKG_SOURCE_URL:=http://www.linux-pam.org/library/
15
+PKG_SOURCE_URL:=http://www.linux-pam.org/
16 16
 PKG_MD5SUM:=35b6091af95981b1b2cd60d813b5e4ee
17 17
 PKG_INSTALL:=1
18 18
 PKG_FIXUP:=autoreconf

+ 52
- 0
libs/libpam/patches/007-cve-2014-2583.patch View File

@@ -0,0 +1,52 @@
1
+From 9dcead87e6d7f66d34e7a56d11a30daca367dffb Mon Sep 17 00:00:00 2001
2
+From: "Dmitry V. Levin" <ldv@altlinux.org>
3
+Date: Wed, 26 Mar 2014 22:17:23 +0000
4
+Subject: pam_timestamp: fix potential directory traversal issue (ticket #27)
5
+
6
+pam_timestamp uses values of PAM_RUSER and PAM_TTY as components of
7
+the timestamp pathname it creates, so extra care should be taken to
8
+avoid potential directory traversal issues.
9
+
10
+* modules/pam_timestamp/pam_timestamp.c (check_tty): Treat
11
+"." and ".." tty values as invalid.
12
+(get_ruser): Treat "." and ".." ruser values, as well as any ruser
13
+value containing '/', as invalid.
14
+
15
+Fixes CVE-2014-2583.
16
+
17
+Reported-by: Sebastian Krahmer <krahmer@suse.de>
18
+
19
+diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c
20
+index 5193733..b3f08b1 100644
21
+--- a/modules/pam_timestamp/pam_timestamp.c
22
++++ b/modules/pam_timestamp/pam_timestamp.c
23
+@@ -158,7 +158,7 @@ check_tty(const char *tty)
24
+ 		tty = strrchr(tty, '/') + 1;
25
+ 	}
26
+ 	/* Make sure the tty wasn't actually a directory (no basename). */
27
+-	if (strlen(tty) == 0) {
28
++	if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, "..")) {
29
+ 		return NULL;
30
+ 	}
31
+ 	return tty;
32
+@@ -243,6 +243,17 @@ get_ruser(pam_handle_t *pamh, char *ruserbuf, size_t ruserbuflen)
33
+ 		if (pwd != NULL) {
34
+ 			ruser = pwd->pw_name;
35
+ 		}
36
++	} else {
37
++		/*
38
++		 * This ruser is used by format_timestamp_name as a component
39
++		 * of constructed timestamp pathname, so ".", "..", and '/'
40
++		 * are disallowed to avoid potential path traversal issues.
41
++		 */
42
++		if (!strcmp(ruser, ".") ||
43
++		    !strcmp(ruser, "..") ||
44
++		    strchr(ruser, '/')) {
45
++			ruser = NULL;
46
++		}
47
+ 	}
48
+ 	if (ruser == NULL || strlen(ruser) >= ruserbuflen) {
49
+ 		*ruserbuf = '\0';
50
+-- 
51
+cgit v0.10.2
52
+