Page MenuHomePhabricator

CVE-2026-14358: Stored XSS in Wikimedia Chart pie tooltip via Data:*.tab field title
Closed, ResolvedPublicSecurity

Description

From email to security@

Hi Security team,

I found a stored XSS issue in the Chart extension’s progressive enhancement path.

The vulnerable flow is specific to pie charts. A malicious title in a numeric field inside a Data:*.tab page is preserved into the client chart spec as spec.series[0].data[*].name. On the client side,
Chart/resources/ext.chart/render.js uses that value as raw params.name inside the pie tooltip formatter, and the bundled ECharts build renders tooltip HTML via innerHTML. As a result, attacker-controlled HTML in the field title can execute when another user views the page and triggers the tooltip by hover/tap.

I validated this against the local source at:
  - mediawiki/extensions/Chart commit 2f96bb9f59b9d65a2f460066e800ce35cc1796f4
  - mediawiki/services/chart-renderer commit 543b8eec4fa9f56110f3fa3d6957c077e5dc4438
  - mediawiki/extensions/JsonConfig commit 27d9983a1244743f12d3cb0e3403f51d9fa32852

Relevant code points:
  - Chart/resources/ext.chart/render.js: pie tooltip formatter returns raw params.name
  - Chart/lib/echarts/echarts.common.js: tooltip HTML mode defaults to HTML and inserts formatter output with innerHTML
  - chart-renderer/src/lib/charts/pieChart.ts: pie slice name is taken from numeric column title
  - chart-renderer/src/lib/render.ts: the generated spec is embedded into data-mw-chart
  - JsonConfig/includes/JCTabularContent.php: .tab field titles are accepted as localized strings, not HTML-sanitized

Minimal reproduction:
  1. Create Data:XssPie.tab with a numeric field whose title is <img src=x onerror=alert(1)>
  2. Create Data:XssPie.chart with type: "pie" and source: "XssPie.tab"
  3. Render the chart on a page
  4. View the page and trigger the pie tooltip

Observed result:
  - the malicious title survives into data-mw-chart.spec.series[0].data[*].name
  - the tooltip formatter returns HTML containing the raw payload
  - the payload executes when the tooltip is shown

Expected result:
  - attacker-controlled field titles should be treated as text in tooltips, not executable HTML

Impact:
This appears to be cross-user stored XSS for users who can create or edit the relevant Data:
pages and get the chart rendered to other viewers.

I also checked the local Wikimedia config path: Chart is enabled, progressive enhancement is enabled, and Data: chart/tab content is configured through JsonConfig on Commons. I did not rely on production testing.

Best,
Fase Rais Baradika

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy triaged this task as High priority.Jun 29 2026, 2:52 PM
Reedy added projects: Vuln-XSS, Charts, JsonConfig.

I can reproduce this locally (using the CLI renderer):

image.png (2,036×944 px, 102 KB)

Per https://echarts.apache.org/en/option.html#tooltip.formatter:

[WARNING]: tooltip is implemented in HTML (unless tooltip.renderMode is set as richText), allowing users to customize the HTML in this way. The content in the HTML must be properly escaped before being passed in. Security risks must be considered when using it. See document "Security Guidelines" for recommendations on safe usage.

So a potential solution (which fixes the XSS for me locally) could be to add renderMode: "richText", to the tooltip options at https://github.com/wikimedia/mediawiki-extensions-Chart/blob/1299046d42f708fc644fd5317e96329dba0b97b4/resources/ext.chart/render.js#L178-L180 (edit: richText seems to support some sort of styling syntax AFAICT which is "safe from injection" according to the docs, but might be unwanted functionality).

(I'm not familiar enough with the extension to be able to tell whether we need to let some HTML through though; if so, we probably could instead mw.html.escape() all unsafe strings before returning them in the tooltip formatter)

I think using richText renderMode is the better solution it renders the tooltip as text rather than html. It is less error prone than trying to apply mw.html.escape at all the correct places.

I tested this also with RTL and other types of charts and inputs, and it looks good to me and fixes teh issue.

sbassett changed the task status from Open to In Progress.Jun 29 2026, 4:42 PM
sbassett moved this task from Incoming to In Progress on the Security-Team board.
sbassett subscribed.

I think using richText renderMode is the better solution it renders the tooltip as text rather than html. It is less error prone than trying to apply mw.html.escape at all the correct places.

I tested this also with RTL and other types of charts and inputs, and it looks good to me and fixes teh issue.

Hey all (@egardner) - if we can get this reviewed by 9 pm UTC, we can deploy this during today's security deployment window. Thanks!

Can someone have a look if this may have been exploited in the wild in WMF production?

[...]

Note that per https://www.mediawiki.org/wiki/Developing_security_patches, the subject of the commit message should be prefixed with SECURITY:. Also, it would be good if this task was mentioned (Bug: T430548) so it's linked to the commit when it's made public.

Added SECURITY: and reference to the bug

This patch seems to fix the problem and is good to merge IMO. I could see a regression test being useful to capture this, but addTooltip would need to be exported from render.js in that case and I'm not sure if that kind of design change is worthwhile (or if a quick fix is preferred here). @aude I'd say this is your call. Aside from that consideration (which I don't consider blocking), this LGTM.

@egardner I wanted to keep the patch small as possible but definitely want to add tests, maybe as a follow up in gerrit.

Added SECURITY: and reference to the bug

Deployed

Change #1306774 merged by jenkins-bot:

[mediawiki/extensions/Chart@REL1_46] SECURITY: Use richText render mode in tooltipFormatter

https://gerrit.wikimedia.org/r/1306774

Change #1306772 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] SECURITY: Use richText render mode in tooltipFormatter

https://gerrit.wikimedia.org/r/1306772

Change #1306773 merged by jenkins-bot:

[mediawiki/extensions/Chart@REL1_45] SECURITY: Use richText render mode in tooltipFormatter

https://gerrit.wikimedia.org/r/1306773

Mstyles renamed this task from Stored XSS in Wikimedia Chart pie tooltip via Data:*.tab field title to CVE-2026-14358: Stored XSS in Wikimedia Chart pie tooltip via Data:*.tab field title.Jul 1 2026, 6:49 PM
Mstyles closed this task as Resolved.
Mstyles claimed this task.
Mstyles changed the visibility from "Custom Policy" to "Public (No Login Required)".
Mstyles changed the edit policy from "Custom Policy" to "All Users".
Mstyles moved this task from Watching to Our Part Is Done on the Security-Team board.