Subject: | Security vulnerability with XSLoader in Stash/Stash.pm |
Sorry I am not using the preferred bug tracker. I have limited web access and cannot get to code.google.com.
XSLoader 0.21 and earlier have a bug in them that allows paths outside of @INC to be checked for code to load if the calling code’s file (as returned by caller()) is something not in @INC.
Since a string eval has ‘(eval 1)’ or similar for its ’file name’, this code in Stash/Stash.pm is vulnerable:
eval q[
CHECK {
] . ($debug ? q[print "scanxs main\n"; my $debug=1;] : "") . q[
require XSLoader;
XSLoader::load('B::Stash'); # for xs only
my @arr = scanxs( $main::{"main::"},'',$debug );
@arr = map { s/\:\:$//; $_ eq "<none>" ? () : $_; } @arr;
print "-x", join( ",-x", @arr ), "\n";
} ];
XSLoader version 0.22 closes the security hole. I leave it to you whether to put a #line directive inside the string eval to set the file name or to depend on XSLoader 0.22.