diff options
Diffstat (limited to 'meta/recipes-extended/pam')
-rw-r--r-- | meta/recipes-extended/pam/libpam/pam_timestamp-fix-potential-directory-traversal-issu.patch | 63 | ||||
-rw-r--r-- | meta/recipes-extended/pam/libpam_1.1.6.bb | 1 |
2 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/pam_timestamp-fix-potential-directory-traversal-issu.patch b/meta/recipes-extended/pam/libpam/pam_timestamp-fix-potential-directory-traversal-issu.patch new file mode 100644 index 0000000000..06cca13abe --- /dev/null +++ b/meta/recipes-extended/pam/libpam/pam_timestamp-fix-potential-directory-traversal-issu.patch | |||
@@ -0,0 +1,63 @@ | |||
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: [PATCH] pam_timestamp: fix potential directory traversal issue | ||
5 | (ticket #27) | ||
6 | |||
7 | commit 9dcead87e6d7f66d34e7a56d11a30daca367dffb upstream | ||
8 | |||
9 | pam_timestamp uses values of PAM_RUSER and PAM_TTY as components of | ||
10 | the timestamp pathname it creates, so extra care should be taken to | ||
11 | avoid potential directory traversal issues. | ||
12 | |||
13 | * modules/pam_timestamp/pam_timestamp.c (check_tty): Treat | ||
14 | "." and ".." tty values as invalid. | ||
15 | (get_ruser): Treat "." and ".." ruser values, as well as any ruser | ||
16 | value containing '/', as invalid. | ||
17 | |||
18 | Fixes CVE-2014-2583. | ||
19 | |||
20 | Reported-by: Sebastian Krahmer <krahmer@suse.de> | ||
21 | |||
22 | Upstream-Status: Backport | ||
23 | |||
24 | Signed-off-by: Yue Tao <Yue.Tao@windriver.com> | ||
25 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> | ||
26 | --- | ||
27 | modules/pam_timestamp/pam_timestamp.c | 13 ++++++++++++- | ||
28 | 1 files changed, 12 insertions(+), 1 deletions(-) | ||
29 | |||
30 | diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c | ||
31 | index 5193733..b3f08b1 100644 | ||
32 | --- a/modules/pam_timestamp/pam_timestamp.c | ||
33 | +++ b/modules/pam_timestamp/pam_timestamp.c | ||
34 | @@ -158,7 +158,7 @@ check_tty(const char *tty) | ||
35 | tty = strrchr(tty, '/') + 1; | ||
36 | } | ||
37 | /* Make sure the tty wasn't actually a directory (no basename). */ | ||
38 | - if (strlen(tty) == 0) { | ||
39 | + if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, "..")) { | ||
40 | return NULL; | ||
41 | } | ||
42 | return tty; | ||
43 | @@ -243,6 +243,17 @@ get_ruser(pam_handle_t *pamh, char *ruserbuf, size_t ruserbuflen) | ||
44 | if (pwd != NULL) { | ||
45 | ruser = pwd->pw_name; | ||
46 | } | ||
47 | + } else { | ||
48 | + /* | ||
49 | + * This ruser is used by format_timestamp_name as a component | ||
50 | + * of constructed timestamp pathname, so ".", "..", and '/' | ||
51 | + * are disallowed to avoid potential path traversal issues. | ||
52 | + */ | ||
53 | + if (!strcmp(ruser, ".") || | ||
54 | + !strcmp(ruser, "..") || | ||
55 | + strchr(ruser, '/')) { | ||
56 | + ruser = NULL; | ||
57 | + } | ||
58 | } | ||
59 | if (ruser == NULL || strlen(ruser) >= ruserbuflen) { | ||
60 | *ruserbuf = '\0'; | ||
61 | -- | ||
62 | 1.7.5.4 | ||
63 | |||
diff --git a/meta/recipes-extended/pam/libpam_1.1.6.bb b/meta/recipes-extended/pam/libpam_1.1.6.bb index 7e55adfb04..3190aaf0d1 100644 --- a/meta/recipes-extended/pam/libpam_1.1.6.bb +++ b/meta/recipes-extended/pam/libpam_1.1.6.bb | |||
@@ -25,6 +25,7 @@ SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \ | |||
25 | file://libpam-fix-for-CVE-2010-4708.patch \ | 25 | file://libpam-fix-for-CVE-2010-4708.patch \ |
26 | file://pam-security-abstract-securetty-handling.patch \ | 26 | file://pam-security-abstract-securetty-handling.patch \ |
27 | file://pam-unix-nullok-secure.patch \ | 27 | file://pam-unix-nullok-secure.patch \ |
28 | file://pam_timestamp-fix-potential-directory-traversal-issu.patch \ | ||
28 | " | 29 | " |
29 | SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4" | 30 | SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4" |
30 | SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2" | 31 | SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2" |