From: mkanat%bugzilla.org <> Date: Tue, 12 Aug 2008 14:41:57 +0000 (+0000) Subject: Bug 437169: [SECURITY] Local files on the server can be attached to a bug (making... X-Git-Tag: bugzilla-3.0.5~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=44209cd76e1ed6ab63db970f9374ea8ba0492135;p=thirdparty%2Fbugzilla.git Bug 437169: [SECURITY] Local files on the server can be attached to a bug (making them publicly visible) when importing bugs with -attach_path Patch By Greg Hendricks r=LpSolit, a=mkanat --- diff --git a/importxml.pl b/importxml.pl index 6e6f4a6191..f62fdab002 100755 --- a/importxml.pl +++ b/importxml.pl @@ -379,8 +379,13 @@ sub process_attachment() { elsif ($encoding =~ /filename/) { # read the attachment file Error("attach_path is required", undef) unless ($attach_path); - my $attach_filename = $attach_path . "/" . $attach->field('data'); - open(ATTACH_FH, $attach_filename) or + + my $filename = $attach->field('data'); + # Remove any leading path data from the filename + $filename =~ s/(.*\/|.*\\)//gs; + + my $attach_filename = $attach_path . "/" . $filename; + open(ATTACH_FH, "<", $attach_filename) or Error("cannot open $attach_filename", undef); $attachment{'data'} = do { local $/; }; close ATTACH_FH;