The MintyDocs extension is vulnerable to stored XSS in several ways.
Stored XSS through parser functions
mintydocs_topic
- Make sure Show preview without reloading the page is enabled in your preferences
- Create a topic page and insert {{#mintydocs_topic:display name=<script>alert("Topic XSS")</script>}} into the edit box
- Click "Show preview"
The display title is set to the value of the "display name" parameter without any sanitization: https://github.com/wikimedia/mediawiki-extensions-MintyDocs/blob/f3427df9bd0d421d3af99b052cf471f8af7817c8/includes/MintyDocsParserFunctions.php#L279
According to https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Parser_1_1ParserOutput.html#a926241e270866eb52b06047d978f7dc8, the setDisplayTitle function expects safe HTML.
mintydocs_manual (1)
- Make sure Show preview without reloading the page is enabled in your preferences
- Create a manual page and insert {{#mintydocs_manual:display name=<script>alert("Manual XSS 1")</script>}} into the edit box
- Click "Show preview"
The display title is set to the value of the "display name" parameter without any sanitization: https://github.com/wikimedia/mediawiki-extensions-MintyDocs/blob/f3427df9bd0d421d3af99b052cf471f8af7817c8/includes/MintyDocsParserFunctions.php#L219
According to https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Parser_1_1ParserOutput.html#a926241e270866eb52b06047d978f7dc8, the setDisplayTitle function expects safe HTML.
mintydocs_manual (2)
- Create a manual page with the content {{#mintydocs_manual:display name=<script>alert("Manual XSS 2")</script>}}
- Go to a topic page that is a subpage of this manual page
The display name (defined via the "display name" parameter, not the one built into MW) is inserted into raw HTML without sanitization: https://github.com/wikimedia/mediawiki-extensions-MintyDocs/blob/f3427df9bd0d421d3af99b052cf471f8af7817c8/includes/MintyDocsTopic.php#L161
mintydocs_version
- Create a version page with the content {{#mintydocs_version: manuals list=<script>alert("version xss")</script>}}
- Visit the page
The content of the manuals list parameter is inserted into raw HTML without sanitization: https://github.com/wikimedia/mediawiki-extensions-MintyDocs/blob/f3427df9bd0d421d3af99b052cf471f8af7817c8/includes/MintyDocsVersion.php#L60
Stored XSS through system messages
mintydocs-topic-desc
- Make sure $wgUseXssLanguage is set to true
- Go to a topic page
- Append ?uselang=x-xss to the end of the URL
mintydocs-topic-otherversions
- Make sure $wgUseXssLanguage is set to true
- Go to a topic page that exists in multiple versions
- Append ?uselang=x-xss to the end of the URL
mintydocs-manual-desc
- Make sure $wgUseXssLanguage is set to true
- Go to a manual page
- Append ?uselang=x-xss to the end of the URL
mintydocs-manual-otherversions
- Make sure $wgUseXssLanguage is set to true
- Go to a manual page that exists in multiple versions
- Append ?uselang=x-xss to the end of the URL
mintydocs-version-desc
- Make sure $wgUseXssLanguage is set to true
- Go to a version page
- Append ?uselang=x-xss to the end of the URL
mintydocs-product-versionlist
- Make sure $wgUseXssLanguage is set to true
- Go to a product page that has at least one version
- Append ?uselang=x-xss to the end of the URL
mintydocs-publish-success
- Assure there are multiple drafts in your wiki
- Make sure $wgUseXssLanguage is set to true
- Go to the publish special page (Special:MintyDocsPublish) with the uselang parameter set to x-xss and publish multiple drafts at once
Additional information
- MW: 1.45.0-alpha (4a86955)
- PHP: 8.3.14 (fpm-fcgi)
- MintyDocs: 1.4 (f3427df)
- Browser: Firefox 138.0.4 (64-bit) on Fedora Linux 42
You might need to apply the following changes to get the extension working on >1.44:
diff --git a/includes/MintyDocsTopic.php b/includes/MintyDocsTopic.php index 1527c2d..e4bf60f 100644 --- a/includes/MintyDocsTopic.php +++ b/includes/MintyDocsTopic.php @@ -1,5 +1,6 @@ <?php +use MediaWiki\Html\Html; use MediaWiki\MediaWikiServices; use MediaWiki\Title\Title; diff --git a/includes/specials/MintyDocsPublish.php b/includes/specials/MintyDocsPublish.php index 70b4068..e0486d1 100644 --- a/includes/specials/MintyDocsPublish.php +++ b/includes/specials/MintyDocsPublish.php @@ -1,6 +1,7 @@ <?php use MediaWiki\Html\Html; +use MediaWiki\Html\ListToggle; use MediaWiki\MediaWikiServices; use MediaWiki\Title\Title;









