CVE-2020-16254
Ruby vulnerability analysis and mitigation

Overview

The Chartkick gem through version 3.3.2 for Ruby contains a CSS Injection vulnerability (CVE-2020-16254) that was discovered on August 4, 2020. The vulnerability affects the width and height options of the charting library, where user input can be used to inject malicious CSS properties (GitHub Issue).

Technical details

The vulnerability exists because Chartkick uses ERB::Util.html_escape to escape the width and height parameters, which prevents XSS but does not escape semicolons. This allows attackers to inject additional CSS properties by adding semicolons after valid width/height values. The vulnerability has a CVSS v3.1 base score of 6.1 MEDIUM (Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N) (NVD).

Impact

An attacker can exploit this vulnerability by passing malicious input to the width or height options of Chartkick charts. For example, they could inject additional CSS properties like background-image to load external resources: width: "100%; background-image: url('http://example.com/image.png')" (GitHub Issue).

Exploitability

The vulnerability can be exploited when user input is passed directly to the width or height options of Chartkick charts. For example: <%= line_chart data, width: params[:width], height: params[:height] %>. The attack requires no special privileges but does require user interaction (GitHub Issue).

Mitigation and workarounds

The vulnerability was fixed in Chartkick version 3.4.0 by limiting width and height values to only alphanumeric characters and the % symbol. While this prevents some valid values like calc(), it provides better security. All users running affected versions should upgrade to version 3.4.0 or later (GitHub Issue).

Additional resources


SourceThis report was generated using AI

Related Ruby vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-71847HIGH8.7
  • Ruby logoRuby
  • ruby-json
NoYesAug 07, 2026
CVE-2026-45414HIGH8.5
  • Ruby logoRuby
  • decidim
NoYesAug 06, 2026
CVE-2026-45573MEDIUM6.4
  • Ruby logoRuby
  • decidim-core
NoYesAug 06, 2026
CVE-2026-45415MEDIUM6
  • Ruby logoRuby
  • decidim-verifications
NoYesAug 06, 2026
CVE-2026-45572MEDIUM4.8
  • Ruby logoRuby
  • decidim-core
NoYesAug 06, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management