Page MenuHomePhabricator

Uploading office 2007 files (docx, pptx etc) results in error
Closed, ResolvedPublic

Description

Author: amit.ray1

Description:
Overview:
With Mediawiki 1.14.0, trying to upload a word 2007 file (docx extension) resulted in an error message that it as application/zip and the file could be harmful, hence cannot be uploaded.
The LocalSettings.php had already been updated with 'docx' extension included in the array variable $wgFileExtensions. Also, the IIS server (5.0) has 'docx' extension type configured for allowable file transfer.

Temporary Work-around implemented at the local server:

In file "includes\Specials\SpecialUpload.php", in "function verify($tmpfile, $extension )", I bypass the checks "if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist )", if the file extension is 'docx'.

Comments:
Not sure if it is a known issue in MediaWiki 1.14.0.
If it is a bug, I would be looking forward to a permanent solution to the above.


Version: 1.16.x
Severity: normal

Details

Reference
bz18684

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:31 PM
bzimport set Reference to bz18684.

amit.ray1 wrote:

see patch in 'function verify( $tmpfile, $extension )'

attachment SpecialUpload.php ignored as obsolete

Downgrading status from blocker.

(In reply to comment #1)

Created an attachment (id=6090) [details]
see patch in 'function verify( $tmpfile, $extension )'

Please submit a real patch in unified diff format.

Created attachment 6291
Patch of above file to trunk

Here's a diff of patching the above file into trunk. That being said, I won't commit it.

It's a nasty hack with a very easily exploitable vector: rename any file to one of the MSFT files, and you skip all of Tim's content-detection work.

Attached:

Patch for mime.types to allow MS Office 2007 doc types

This problem could also be fixed by patching the includes/mime.types file to identify the MS 2007 Office docs (see attached patch). If someone will assign to me, I would be glad to fix and submit.

Attached:

Bryan.TongMinh wrote:

Looks ok.(In reply to comment #5)

Created an attachment (id=6403) [details]
Patch for mime.types to allow MS Office 2007 doc types

This problem could also be fixed by patching the includes/mime.types file to
identify the MS 2007 Office docs (see attached patch). If someone will assign
to me, I would be glad to fix and submit.

Looks ok.