perl: securely handle duplicate environment variables [CVE-2016-2381] 2446/head
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 1 Mar 2016 16:23:45 +0000 (17:23 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 1 Mar 2016 16:26:51 +0000 (17:26 +0100)
commit0d18627cd21ff64875efd54c4c2613ff6a84f352
treed160b3a33a1c82c5f38584de4fdda4233ab64967
parentb49d41f289b8b5a72731228f2abff32d468a2809
perl: securely handle duplicate environment variables [CVE-2016-2381]

Stephane Chazelas discovered a bug in the environment handling in Perl.

Perl provides a Perl-space hash variable, %ENV, in which environment
variables can be looked up.  If a variable appears twice in envp, only
the last value would appear in %ENV, but getenv would return the first.
Perl's taint security mechanism would be applied to the value in %ENV,
but not to the other rest of the environment.  This could result in an
ambiguous environment causing environment variables to be propagated to
subprocesses, despite the protections supposedly offered by taint
checking.

With this update Perl changes the behavior to match the following:

 a) %ENV is populated with the first environment variable, as getenv
    would return.
 b) Duplicate environment entries are removed.

References:

 * http://perl5.git.perl.org/perl.git/commit/ae37b791a73a9e78dedb89fb2429d2628cf58076
 * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-2381

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
lang/perl/Makefile
lang/perl/patches/901-CVE-2016-2381.patch [new file with mode: 0644]