diff --git a/C4/Auth.pm b/C4/Auth.pm index 06525c135b..a2aa8aa132 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -157,6 +157,10 @@ sub get_template_and_user { C4::Context->interface( $in->{type} ); + # Sanitize template path to avoid path traversal + $in->{template_name} =~ s|^/||; + $in->{template_name} =~ s|\.\.||g; + $in->{'authnotrequired'} ||= 0; my $template = C4::Templates::gettemplate( $in->{'template_name'},