Blobfolio/righteous-mimes

Docx rejected for security reason + Error: The file type could not be determined.

Closed this issue · 1 comments

Hi,

VALIDATION:
  Naive Name: Document sans titre.docx
  Naive Extension: docx
  Naive Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  Magic Type: application/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
  Best Type: 

FINAL:
  Name: Document sans titre.docx
  Extension: 
  Type: 
  Code: 64

SYSTEM:
  Kernel: Linux inst71637-0 5.4.49+ #1 SMP Sun Oct 18 19:43:35 PDT 2020 x86_64
  PHP: 7.3.26-1+0~20210112.74+debian9~1.gbpd78724
  Modules: Core; PDO; Phar; Reflection; SPL; SimpleXML; Zend OPcache; calendar; cgi-fcgi; ctype; curl; date; dom; exif; fileinfo; filter; ftp; gd; geoip; gettext; gmp; hash; iconv; igbinary; intl; json; libxml; mbstring; mcrypt; memcached; msgpack; mysqli; mysqlnd; openssl; pcre; pdo_mysql; pdo_sqlite; posix; readline; redis; session; shmop; soap; sockets; sodium; sqlite3; standard; sysvmsg; sysvsem; sysvshm; tokenizer; wddx; xml; xmlreader; xmlwriter; xsl; zip; zlib
  WordPress: 5.6
  Plugins: acf [5.9.5]; adminimize [1.11.7]; analytify-analytics-dashboard-widget [1.1.5]; autodescription [4.1.3]; blob-mimes [1.2.2]; classic-editor [1.6]; cookie-notice [2.0.2]; custom-post-type-ui [1.8.2]; disable-comments [2.1.0]; dt-the7-core [2.5.5.2]; duracelltomi-google-tag-manager [1.11.6]; easy-google-fonts [1.4.4]; gravityforms [2.4.22]; invisible-recaptcha [1.2.3]; js_composer [6.5.0]; revslider [6.3.4]; sendgrid-email-delivery-simplified [1.11.8]; swarmify [2.0.21]; tc-team-members [2.9.1]; ultimate_vc [3.19.8]; use-any-font [5.11.5]; user-role-editor [4.58.2]; user-switching [1.5.6]; webarx [2.0.15]; worker [4.9.7]; wp-analytify [3.1.6]; wp-analytify-pro [2.2.1]; wp-google-maps [8.1.4]; wp-social-widget [2.2.0]
  Theme: dt-the7 [9.3.1]

Document sans titre.docx
(intentionally empty)

Thanks @alapiere!

The strange "typetype" duplication from fileinfo appears to be related to PHP bug #77784. I went ahead and added a partial workaround to this library and the Lord of the Files plugin that should allow you to upload documents like this one.

It looks like the issue extends to other arbitrary MS Office-related files as well, so once I've managed to track down some more examples, I'll implement a more comprehensive workaround for the lot.