Exclude working directory from library path (CVE-2016-1238)
authorSimon McVittie <smcv@debian.org>
Thu, 28 Jul 2016 08:50:09 +0000 (09:50 +0100)
committerSimon McVittie <smcv@debian.org>
Thu, 28 Jul 2016 08:50:21 +0000 (09:50 +0100)
commit4729ff0812c1f3d06d98524e2fec232d3bf90513
treefcb8ace67ba164a5463ba23b978baaf058b5f897
parenta6c453606ead56312533e0d494e9aaebe6b1e57d
Exclude working directory from library path (CVE-2016-1238)

Current Perl versions put '.' at the end of the library search path
@INC, although this will be fixed in a future Perl release. This means
that when software loads an optionally-present module, it will be
looked for in the current working directory before giving up. An
attacker could use this to execute arbitrary Perl code from ikiwiki's
current working directory.

Removing '.' from the library search path in Perl is the correct
fix for this vulnerability, but is not trivial to do due to
backwards-compatibility concerns. Mitigate this (even if ikiwiki is run
with a vulnerable Perl version) by explicitly removing '.' from the
search path, and instead looking for ikiwiki's own modules relative
to the absolute path of the executable when run from the source
directory.

In tests that specifically want to use the current working directory,
use "-I".getcwd instead of "-I." so we use its absolute path, which
is immune to the removal of ".".
18 files changed:
ikiwiki-calendar.in
ikiwiki-comment.in
ikiwiki-mass-rebuild
ikiwiki-transition.in
ikiwiki-update-wikilist
ikiwiki.in
pm_filter
t/basewiki_brokenlinks.t
t/comments.t
t/conflicts.t
t/img.t
t/inline.t
t/meta.t
t/permalink.t
t/podcast.t
t/relativity.t
t/trail.t
t/wrapper-environ.t