Просмотр исходного кода

perl: ensure File::Spec::canonpath() preserves taint [CVE-2015-8607]

Beginning in PathTools 3.47 and/or perl 5.20.0, the File::Spec::canonpath()
routine returned untained strings even if passed tainted input. This defect
undermines the guarantee of taint propagation, which is sometimes used to
ensure that unvalidated user input does not reach sensitive code.

This defect was found and reported by David Golden of MongoDB, and a patch
was provided by Tony Cook.

References:

 * https://rt.perl.org/Public/Bug/Display.html?id=126862
 * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8607

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Jo-Philipp Wich 9 лет назад
Родитель
Сommit
f73e358558

+ 1
- 1
lang/perl/Makefile Просмотреть файл

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=perl
11 11
 PKG_VERSION:=5.22.1
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
15 15
 		http://www.cpan.org/src/5.0 \

+ 1
- 1
lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 --- a/hints/linux.sh
2 2
 +++ b/hints/linux.sh
3
-@@ -204,6 +204,24 @@ case "$libc" in
3
+@@ -221,6 +221,24 @@ case "$libc" in
4 4
      ;;
5 5
  esac
6 6
  

+ 1
- 1
lang/perl/patches/110-always_use_miniperl.patch Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 --- a/Makefile.SH
2 2
 +++ b/Makefile.SH
3
-@@ -315,22 +315,11 @@ MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE
3
+@@ -316,22 +316,11 @@ MANIFEST_SRT = MANIFEST.srt
4 4
  
5 5
  !GROK!THIS!
6 6
  

+ 2
- 4
lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch Просмотреть файл

@@ -1,7 +1,5 @@
1
-Index: perl-5.22.0/t/op/tie_fetch_count.t
2
-===================================================================
3
---- perl-5.22.0.orig/t/op/tie_fetch_count.t
4
-+++ perl-5.22.0/t/op/tie_fetch_count.t
1
+--- a/t/op/tie_fetch_count.t
2
++++ b/t/op/tie_fetch_count.t
5 3
 @@ -250,12 +250,17 @@ for ([chdir=>''],[chmod=>'0,'],[chown=>'
6 4
      check_count "$op $args\\\$tied_glob$postargs";
7 5
  }

+ 2
- 4
lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch Просмотреть файл

@@ -5,10 +5,8 @@ We can't provide either with busybox. Just skip it for now.
5 5
 
6 6
 Signed-off-by: Marcel Denia <naoir@gmx.net>
7 7
 
8
-Index: perl-5.22.0/dist/threads/t/join.t
9
-===================================================================
10
---- perl-5.22.0.orig/dist/threads/t/join.t
11
-+++ perl-5.22.0/dist/threads/t/join.t
8
+--- a/dist/threads/t/join.t
9
++++ b/dist/threads/t/join.t
12 10
 @@ -110,36 +110,41 @@ sub skip {
13 11
  
14 12
  # We parse ps output so this is OS-dependent.

+ 57
- 0
lang/perl/patches/900-CVE-2015-8607.patch Просмотреть файл

@@ -0,0 +1,57 @@
1
+From b6307f728a4f842a54ea96959e386c7daa92ece1 Mon Sep 17 00:00:00 2001
2
+From: Tony Cook <tony@develop-help.com>
3
+Date: Tue, 15 Dec 2015 10:56:54 +1100
4
+Subject: [perl #126862] ensure File::Spec::canonpath() preserves taint
5
+
6
+Previously the unix specific XS implementation of canonpath() would
7
+return an untainted path when supplied a tainted path.
8
+
9
+For the empty string case, newSVpvs() already sets taint as needed on
10
+its result.
11
+---
12
+ dist/PathTools/Cwd.xs    |  1 +
13
+ dist/PathTools/t/taint.t | 19 ++++++++++++++++++-
14
+ 2 files changed, 19 insertions(+), 1 deletion(-)
15
+
16
+--- a/dist/PathTools/Cwd.xs
17
++++ b/dist/PathTools/Cwd.xs
18
+@@ -535,6 +535,7 @@ THX_unix_canonpath(pTHX_ SV *path)
19
+     *o = 0;
20
+     SvPOK_on(retval);
21
+     SvCUR_set(retval, o - SvPVX(retval));
22
++    SvTAINT(retval);
23
+     return retval;
24
+ }
25
+ 
26
+--- a/dist/PathTools/t/taint.t
27
++++ b/dist/PathTools/t/taint.t
28
+@@ -12,7 +12,7 @@ use Test::More;
29
+ BEGIN {
30
+     plan(
31
+         ${^TAINT}
32
+-        ? (tests => 17)
33
++        ? (tests => 21)
34
+         : (skip_all => "A perl without taint support")
35
+     );
36
+ }
37
+@@ -34,3 +34,20 @@ foreach my $func (@Functions) {
38
+ 
39
+ # Previous versions of Cwd tainted $^O
40
+ is !tainted($^O), 1, "\$^O should not be tainted";
41
++
42
++{
43
++    # [perl #126862] canonpath() loses taint
44
++    my $tainted = substr($ENV{PATH}, 0, 0);
45
++    # yes, getcwd()'s result should be tainted, and is tested above
46
++    # but be sure
47
++    ok tainted(File::Spec->canonpath($tainted . Cwd::getcwd)),
48
++        "canonpath() keeps taint on non-empty string";
49
++    ok tainted(File::Spec->canonpath($tainted)),
50
++        "canonpath() keeps taint on empty string";
51
++
52
++    (Cwd::getcwd() =~ /^(.*)/);
53
++    my $untainted = $1;
54
++    ok !tainted($untainted), "make sure our untainted value is untainted";
55
++    ok !tainted(File::Spec->canonpath($untainted)),
56
++        "canonpath() doesn't add taint to untainted string";
57
++}