@highcharts/dashboards: Highcharts Dashboards parses sidebar component labels as HTML
What fixes it
- 4.2.3@highcharts/dashboards, npmGitHub
npm install @highcharts/dashboards@4.2.3
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
Impact
The component language strings shown in the edit mode sidebar are parsed as HTML rather than inserted as text. An attacker who controls those language options can supply markup carrying event handlers, which execute in the origin of the page hosting the dashboard once the sidebar renders the affected labels. Exploitation requires that untrusted data reach the Dashboards language configuration and that a user open the edit mode sidebar.
Workarounds
Until you can upgrade, patch EditMode once at application startup. The hook runs before the sidebar is built, so the labels are already harmless by the time they are rendered. Assigning a string to textContent and reading back innerHTML turns any markup into literal text, which is exactly what the fixed version renders.
After importing the module, use this code snipped once, before any board is created.
{
const EditMode = window.Dashboards?.EditMode;
const escapeHTML = (text) => text
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
const patched = new WeakSet();
const originalInit = EditMode.prototype.init;
EditMode.prototype.init = function (...args) {
const labels = this.lang?.sidebar;
if (labels && !patched.has(this)) {
patched.add(this);
for (const key of Object.keys(labels)) {
if (typeof labels[key] === 'string') {
labels[key] = escapeHTML(labels[key]);
}
}
}
return originalInit.apply(this, args);
};
}If your application does not need Edit Mode, leaving it disabled (editMode.enabled: false) removes the exposure as well.
Obtaining the patched version
The patched releases are available from all the usual distribution channels. With npm, upgrade the affected package to the patched version listed above, for example npm install @highcharts/dashboards@4.2.3. If you load Highcharts Dashboards from a CDN, use a versioned URL, for example https://code.highcharts.com/dashboards/4.2.3/dashboards.js. For more on each installation method, see the installation guide.
Text from GitHub Advisory Database
Affected versions 4
- @highcharts/dashboards, npm>= 1.0.0, <= 4.2.2GitHub
- highchartsaffected: < 13.0.0-beta.2CVE List
- dashboardsaffected: >= 1.0.0, < 4.2.3CVE List
- @highcharts/dashboards, npmfrom 1.0.0, fixed in 4.2.3OSV
References 4
- github.com/highcharts/highcharts/commit/e65f8c21b9974dcccfa1c600a375d836acef4a7dFixvia CVE List
- github.com/highcharts/highcharts/releases/tag/dashboards-v4.2.3Fixvia CVE List
- github.com/highcharts/highcharts/security/advisories/GHSA-rcqf-f6h2-ccg9Advisoryvia CVE List
- github.com/advisories/GHSA-rcqf-f6h2-ccg9Advisoryvia GitHub