Bugzilla – Attachment 159222 Details for
Bug 35291
File Upload vulnerability in upload-cover-image.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35291: Validate filepaths in linking files
Bug-35291-Validate-filepaths-in-linking-files.patch (text/plain), 1.59 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-11-23 23:49:14 UTC
(
hide
)
Description:
Bug 35291: Validate filepaths in linking files
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-11-23 23:49:14 UTC
Size:
1.59 KB
patch
obsolete
>From 75c90b505efc531d1018c0f7610ae3a5039eeadb Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 9 Nov 2023 00:49:54 +0000 >Subject: [PATCH] Bug 35291: Validate filepaths in linking files > >Validate that the files in linking files are contained within the ZIP. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > tools/upload-cover-image.pl | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/tools/upload-cover-image.pl b/tools/upload-cover-image.pl >index bf43928b582..7ddd13adbcc 100755 >--- a/tools/upload-cover-image.pl >+++ b/tools/upload-cover-image.pl >@@ -38,6 +38,7 @@ resized, maintaining aspect ratio. > =cut > > use Modern::Perl; >+use Cwd; > > use File::Temp; > use CGI qw ( -utf8 ); >@@ -187,7 +188,11 @@ if ($fileID) { > $filename =~ s/[\"\r\n]//g; > $filename =~ s/^\s+//; > $filename =~ s/\s+$//; >- my $srcimage = GD::Image->new("$dir/$filename"); >+ my $full_filename = Cwd::abs_path("$dir/$filename"); #Resolve any relative filepath references >+ my $srcimage; >+ if ( $full_filename =~ /^\Q$dir\E/ ){ >+ $srcimage = GD::Image->new($full_filename); >+ } > my $biblio; > my $item; > if ( defined $srcimage ) { >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35291
:
158664
|
158684
|
158685
|
158686
|
159151
|
159152
|
159153
|
159215
|
159216
|
159217
|
159218
|
159220
|
159221
| 159222 |
159223