Multiple system messages in MultimediaViewer are vulnerable to stored XSS.
**multimediaviewer-multiple-authors-combine**
Cause: https://gerrit.wikimedia.org/g/mediawiki/extensions/MultimediaViewer/+/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv/ui/mmv.ui.metadataPanel.js#467
**multimediaviewer-repository-local**
# Upload a file to your wiki
# Add the file to a page
# Go to the page using the `?uselang=x-xss` parameter
# Click on the thumbnail to open it in MultimediaViewer
{F60325493}
Cause: https://gerrit.wikimedia.org/g/mediawiki/extensions/MultimediaViewer/+/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv/ui/mmv.ui.stripeButtons.js#78
**multimediaviewer-view-expanded**
# Upload a file to your wiki
# Go to the file's page while using the `?uselang=x-xss` parameter
# Click on the thumbnail to open it in MultimediaViewer
{F60325593}
Cause: https://gerrit.wikimedia.org/g/mediawiki/extensions/MultimediaViewer/+/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv.bootstrap/mmv.bootstrap.js#391
**multimediaviewer-copy-button**
# Upload a file to your wiki
# Add the file to a page
# Go to the page using the `?uselang=x-xss` parameter
# Click on the thumbnail to open it in MultimediaViewer
# Click the Download button in the bottom right
{F60325623}
Cause: https://gerrit.wikimedia.org/g/mediawiki/extensions/MultimediaViewer/+/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv.ui.reuse/mmv.ui.utils.js#53
**multimediaviewer-download**
# Upload a file to your wiki
# Add the file to a page
# Go to the page using the `?uselang=x-xss` parameter
# Click on the thumbnail to open it in MultimediaViewer
# Click the Download button in the bottom right
{F60325618}
Cause: Concatenation of HTML and the unescaped message at https://github.com/wikimedia/mediawiki-extensions-MultimediaViewer/blob/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv.ui.reuse/mmv.ui.download.pane.js#L83
**multimediaviewer-download-preview-link-title**
{F60325620}
Cause: Calling `.html()` with the unescaped message as the argument: https://github.com/wikimedia/mediawiki-extensions-MultimediaViewer/blob/8423935d2167119bc3421a946c720138456cb6b4/resources/mmv.ui.reuse/mmv.ui.download.pane.js#L108
== Requirement
Fix multiple stored XSS vulnerabilities in MultimediaViewer by ensuring system messages are properly escaped and not directly injected into the DOM using `.html()` or string concatenation.
Vulnerable messages:
- `multimediaviewer-multiple-authors-combine`
- `multimediaviewer-repository-local`
- `multimediaviewer-view-expanded`
- `multimediaviewer-copy-button`
- `multimediaviewer-download`
- `multimediaviewer-download-preview-link-title`
All are exploitable by manipulating the `uselang` parameter to `x-xss`, which injects arbitrary content into localized UI elements in MultimediaViewer.
== BDD
```
Feature: XSS protection in MultimediaViewer
Scenario: Localized system messages are properly escaped
Given a file is uploaded and added to a wiki page
And the URL is accessed with ?uselang=x-xss
When the thumbnail is clicked to open MultimediaViewer
Then no XSS is executed in the following UI elements:
| Message key |
| multimediaviewer-multiple-authors-combine |
| multimediaviewer-repository-local |
| multimediaviewer-view-expanded |
| multimediaviewer-copy-button |
| multimediaviewer-download |
| multimediaviewer-download-preview-link-title |
```
== Test Steps
__Test Case 1: Validate XSS is not triggered in `multimediaviewer-multiple-authors-combine`__
1. Upload a file to the wiki
2. Add the file to a wiki page
3. Visit the page with `?uselang=x-xss`
4. Click the thumbnail to open MultimediaViewer
5. **AC1:** Confirm the multiple authors label is shown without script execution
__Test Case 2: Validate XSS is not triggered in `multimediaviewer-repository-local`__
1. Repeat steps from Test Case 1
2. **AC2:** Confirm repository name in MultimediaViewer is not executable HTML
__Test Case 3: Validate XSS is not triggered in `multimediaviewer-view-expanded`__
1. Visit the file’s page directly (not via a content page)
2. Add `?uselang=x-xss` to the URL
3. Click the file to open in MultimediaViewer
4. **AC3:** Confirm view-expanded label is escaped
__Test Case 4: Validate XSS is not triggered in `multimediaviewer-copy-button`__
1. Open any file with `?uselang=x-xss`
2. Open MultimediaViewer and click “Download”
3. **AC4:** Confirm Copy button text is safe
__Test Case 5: Validate XSS is not triggered in `multimediaviewer-download`__
1. Open MultimediaViewer with `?uselang=x-xss`
2. Click “Download”
3. **AC5:** Confirm Download label is not executing HTML
__Test Case 6: Validate XSS is not triggered in `multimediaviewer-download-preview-link-title`__
1. Open MultimediaViewer and click “Download” tab
2. **AC6:** Confirm preview link title is escaped properly