r72890 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72889‎ | r72890 | r72891 >
Date:04:05, 13 September 2010
Author:tstarling
Status:ok (Comments)
Tags:
Comment:
Added some warnings for some upload security issues, such as allowing OpenDocument uploads.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -502,6 +502,10 @@
503503 /**
504504 * This is the list of preferred extensions for uploading files. Uploading files
505505 * with extensions not in this list will trigger a warning.
 506+ *
 507+ * WARNING: If you add any OpenDocument file formats here, such as odt, ods or
 508+ * odp, and untrusted users are allowed to upload files, then your wiki will be
 509+ * vulnerable to cross-site request forgery (CSRF).
506510 */
507511 $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg' );
508512
@@ -539,12 +543,18 @@
540544 'application/x-opc+zip',
541545 );
542546
543 -/** This is a flag to determine whether or not to check file extensions on upload. */
 547+/**
 548+ * This is a flag to determine whether or not to check file extensions on upload.
 549+ *
 550+ * WARNING: setting this to false is insecure for public wikis.
 551+ */
544552 $wgCheckFileExtensions = true;
545553
546554 /**
547555 * If this is turned off, users may override the warning for files not covered
548556 * by $wgFileExtensions.
 557+ *
 558+ * WARNING: setting this to false is insecure for public wikis.
549559 */
550560 $wgStrictFileExtensions = true;
551561

Follow-up revisions

RevisionCommit summaryAuthorDate
r72892MS Office creates vulnerabilities also, per comment on r72890.tstarling06:29, 13 September 2010

Comments

#Comment by MaxSem (talk | contribs)   05:40, 13 September 2010

Newer MS Office documents are also ZIP documents, probbly worth mentioning them, too.

#Comment by MaxSem (talk | contribs)   05:40, 13 September 2010

Newer MS Office documents are also ZIP documents, probbly worth mentioning them, too.

#Comment by MaxSem (talk | contribs)   05:55, 13 September 2010

Newer MS Office documents are also ZIP documents, probably worth mentioning them, too.

#Comment by MaxSem (talk | contribs)   05:55, 13 September 2010

Sorry, network lag.

#Comment by Tim Starling (talk | contribs)   06:18, 13 September 2010

Newer MS Office documents are blacklisted in $wgMimeTypeBlacklist.

#Comment by Tim Starling (talk | contribs)   06:27, 13 September 2010

Actually you're right, detectZipType() will return application/msword, application/vnd.ms-powerpoint, etc. which is not blacklisted.

Status & tagging log