Email me

Rust advisories / kuva

VulnerabilityRUSTSEC-2026-0345 · kuva

RUSTSEC-2026-0345: Untrusted labels can inject SVG attributes, CSS values, and terminal escape sequences

Short answerA security vulnerability in the kuva crate: Untrusted labels can inject SVG attributes, CSS values, and terminal escape sequences. No severity score was published. Fixed in 0.3.1, 0.4.1: update to a fixed version.

Cratekuva
TypeVulnerability (format-injection)
Affected versionsFrom 0.1.5 before 0.3.1; from 0.4.0 before 0.4.1.
Fixed in0.3.1, 0.4.1
Severitynot scored
Published2026-08-07
Last changed2026-10-13
Also known asGHSA-3c48-9r95-hqhr

What to do

  1. See which version you have: cargo tree -i kuva (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p kuva. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example kuva = "0.4.1") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Affected versions of kuva wrote data-derived strings straight into rendered output without escaping them for the target format. Applications that plot untrusted input (column headers, category and group names, series labels) were affected in three places.

**1. SVG attribute injection / stored XSS (CWE-79).** When SVG interactivity was enabled via Layout::with_interactive, group and category labels were formatted directly into data-group and data-x attributes through the raw Primitive::GroupStart.extra_attrs string, which the SVG backend emitted verbatim. The backend's escaping helper covered text nodes and <title> but not attributes. A label containing a double quote could close the attribute and add another, for example an event handler. Opening the resulting SVG in a browser, or inlining it into an HTML page, executed the injected script. Reachable from scatter, line, bar, and strip plots, and from legends.

**2. Unvalidated CSS and style attribute values (CWE-74).** Color::Css wrote arbitrary strings into fill and stroke, stroke-dasharray was emitted raw from the public dash-pattern builders, and the SVG root font-family and fill plus the background rectangle fill were written raw from layout and theme configuration. Applications that forwarded user-supplied style values into the plotting API could have those values break out of the attribute they were written into.

**3. Terminal escape sequence injection (CWE-150).** TerminalBackend stored label characters unfiltered and emitted each one unconditionally when producing its ANSI string. Control characters in a label, including ESC, OSC sequences, and carriage returns, were written straight to the operator's terminal. Depending on the emulator this allows forged or misleading output, window title and clipboard manipulation, and reaching terminal emulator vulnerabilities that are triggered by escape sequences.

The fix routes every data-derived string through format-appropriate escaping. A single escape_attr helper XML-escapes &, <, >, ", and ', and is applied at each raw-attribute site: the extra_attrs interpolations, the Color::Css catch-all, and the SVG backend's stroke-dasharray, font-family, and background fill writes. TerminalBackend::set_char replaces control characters with U+FFFD before they enter the character grid, so one cell stays one column rather than the grid shifting, and the ANSI writer emits the grid unchanged.

Patched in 0.5.0, with backports to 0.4.1 for the 0.4.x line and 0.3.1 for users still on 0.1.5 through 0.3.0. No versions were yanked.

Users who cannot upgrade should sanitize labels before passing them to kuva, and avoid interactive SVG output for untrusted data.

Note that Scene::defs, Scene::scripts, and Primitive::GroupStart.extra_attrs remain raw escape hatches by design. They are documented as trusted-only and are not covered by this advisory; populating them from user data is equivalent to executing that data.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ