Summary
The JS implementation for copying button labels to the sticky header in the Citizen skin unescapes HTML characters, allowing for stored XSS through system messages.
Details
In the copyButtonAttributes function in stickyHeader.js, when copying the button labels, the innerHTML of the new element is set to the textContent of the old element:
|
/** |
|
* Copies attribute from an element to another. |
|
* |
|
* @param {Element} from |
|
* @param {Element} to |
|
*/ |
|
function copyButtonAttributes( from, to ) { |
|
copyAttribute( from, to, 'title' ); |
|
// Copy button labels |
|
if ( to.lastElementChild && from.lastElementChild ) { |
|
to.lastElementChild.innerHTML = from.lastElementChild.textContent || ''; |
|
} |
|
} |
This unescapes any escaped HTML characters and causes the contents of the system messages to be interpreted as HTML.
PoC
- Edit any of the affected messages (
citizen-share, citizen-view-history, citizen-view-edit, nstab-talk) to the following payload: <img src="" onerror="alert('Sticky Header Button XSS')">.
- Visit any mainpage article in the wiki using the Citizen skin.
Impact
This impacts wikis where a group has the editinterface but not the editsitejs user right. By default, this is the case for the sysop group.
Summary
The JS implementation for copying button labels to the sticky header in the Citizen skin unescapes HTML characters, allowing for stored XSS through system messages.
Details
In the
copyButtonAttributesfunction instickyHeader.js, when copying the button labels, theinnerHTMLof the new element is set to thetextContentof the old element:mediawiki-skins-Citizen/resources/skins.citizen.scripts/stickyHeader.js
Lines 29 to 41 in f4cbcec
This unescapes any escaped HTML characters and causes the contents of the system messages to be interpreted as HTML.
PoC
citizen-share,citizen-view-history,citizen-view-edit,nstab-talk) to the following payload:<img src="" onerror="alert('Sticky Header Button XSS')">.Impact
This impacts wikis where a group has the
editinterfacebut not theeditsitejsuser right. By default, this is the case for thesysopgroup.