/

CVE-2026-41518

Severity:

HIGH RISK

(7.6)

Stored Cross-Site Scripting (CWE-79) in Chartbrew Tooltip Rendering

CVE-2026-41518

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to arbitrary JavaScript execution in viewers' browsers

Severity:

HIGH RISK

(7.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A stored cross-site scripting vulnerability in Chartbrew versions 4.9.0 through 5.0.0 allows project editors to inject arbitrary HTML and JavaScript via the ChartDatasetConfig.legend field.

Because this content is later inserted into the tooltip DOM using innerHTML without sanitization, any visitor to a public dashboard can have attacker-controlled JavaScript executed in their browser on page load.

Affected context

The issue appears in Chartbrew deployments where:

  • Versions 4.9.0 through 5.0.0 are in use
  • Project members have editor permissions and can define or modify chart dataset configuration
  • Dashboards are shared publicly or broadly within an organization
  • Tooltips are rendered using Chart.js and the ChartTooltip.js component assigns tooltip content with innerHTML

In this context, attacker-controlled legend text flows from the ChartDatasetConfig.legend field, through the Chart.js rendering pipeline, and into the tooltip element that is displayed automatically when charts load.

Exploit preconditions

  • Attack surface: Web-based Chartbrew dashboards, especially public or widely shared dashboards.
  • Required access: Authenticated access with at least project-editor permissions to create or modify chart dataset configuration.
  • Primary trigger point: Page load or initial chart rendering of a dashboard containing a malicious legend value; no user hover or click interaction is necessary.
  • Why exploitation is possible: User-supplied text from ChartDatasetConfig.legend is stored verbatim in the database, not validated or sanitized for HTML/JavaScript, and is later written directly into the tooltip DOM element via element.innerHTML. This enables embedded script or event-handler attributes to execute in the context of the viewer's origin.

Why this happens

This vulnerability stems from unsafe handling of user-controlled content in a UI rendering path.

The ChartDatasetConfig.legend field accepts arbitrary text from project editors and persists it directly to storage without enforcing an HTML-safe encoding or performing robust sanitization.

During dashboard rendering, Chartbrew passes this legend value through the Chart.js integration, where a tooltip component (ChartTooltip.js) inserts the content into the DOM using innerHTML instead of a text-only API.

This pattern maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), where user-controlled input is used to generate HTML without proper escaping, allowing attackers to inject script tags, event handlers, or other active content.

Potential impact

  • Attacker-controlled JavaScript can run in the victim's browser within the Chartbrew application origin.
  • Theft of session tokens, CSRF tokens, or other sensitive data accessible to front-end scripts may occur.
  • Unauthorized actions can be performed on behalf of the victim (stored CSRF-style behavior) using the victim's established session.
  • Defacement or manipulation of dashboard content and visualizations could mislead viewers or hide malicious activity.
  • Use of the vulnerability as a pivot for broader attacks, such as delivering further payloads or probing internal applications via the victim's browser.

General mitigation guidance

Effective mitigation focuses on breaking the direct path from user-controlled data to executable HTML or script execution:

  • Treat all chart configuration fields, including legend text, as untrusted input and encode/escape them before inserting into the DOM.
  • Replace innerHTML with text-safe APIs (e.g., textContent or equivalent) for tooltip and legend rendering, unless strictly necessary to support limited HTML.
  • If some markup must be supported, apply a robust, allowlist-based HTML sanitizer that strips script tags, event handlers, JavaScript URLs, and other executable constructs.
  • Normalize data flow so that visual configuration values are processed through centralized encoding utilities rather than ad-hoc string concatenation in UI components.
  • Reduce the privileges of project-editor roles where possible, and limit who can modify chart configurations on dashboards with large or untrusted audiences.
  • Adopt a secure-by-default component pattern where all UI components expect encoded data, and any deviation must be explicitly justified and reviewed.

How teams detect issues like this

Detection can combine code-level analysis with application behavior monitoring:

  • Static code analysis: Search for use of innerHTML, dangerouslySetInnerHTML, template literals, or other HTML injection points that receive data from chart configuration or other user-supplied fields.
  • Data-flow review: Trace the flow from inputs like ChartDatasetConfig.legend (and similar configuration fields) to UI rendering, ensuring either encoding or sanitization is applied before DOM insertion.
  • Code review practices: Include XSS-specific review checklists for any changes to tooltip, annotation, label, or legend rendering logic, especially when integrating with charting libraries.
  • Automated scanning: Use dynamic application security testing tools or browser automation (e.g., Playwright, Selenium) to inject benign XSS test payloads into configuration fields and observe whether they appear as executable content in the DOM.
  • Security linting and policies: Enforce lint rules or framework-specific security policies that flag direct DOM manipulation with untrusted data during CI.

Sources

SourceLink
github.comgithub.com/chartbrew/chartbrew/security/advisories/GHSA-6q2j-365c-7gqf

Frequently asked

questions

Anonymous users cannot directly inject payloads, but they can be victims. Exploitation requires an authenticated project editor to store a malicious legend value, after which any unauthenticated viewer of the affected public dashboard will automatically execute the payload on page load.

The attacker must have authenticated access with at least project-editor permissions on a Chartbrew project, or compromise such an account. Viewers need no special access; simply loading the malicious dashboard is enough to trigger the script.

The safest pattern is to treat all user-supplied values as plain text and ensure they are properly encoded before being rendered. In practice this means replacing innerHTML with text-safe rendering APIs or ensuring that any HTML insertion passes through a strict, allowlist-based sanitizer that removes scripting capabilities.

Preventive strategies include adopting a consistent output encoding strategy for all UI components, banning or tightly controlling direct innerHTML usage, integrating security-focused code review checks for any DOM manipulation, and using static and dynamic analysis tools to flag unescaped insertion of user-controlled data into HTML.

Find out what's already
exploitable in your codebase.