Executive brief
Chartkick is a charting library that allows developers to easily create charts in web applications. A prototype pollution vulnerability in versions 3.1.0 through 3.1.3 allows attackers to inject malicious code through chart options or data loaded from URLs, potentially leading to unexpected application behavior and client-side code execution. While the impact is limited to client-side context, it could be exploited to bypass security controls or manipulate application logic.
Technical details
Chartkick.js fails to properly sanitize chart options before processing them, allowing prototype pollution attacks through the __proto__ property. An attacker can pass malicious JSON containing __proto__ keys either directly as chart options or via a crafted response from a data URL endpoint. The vulnerability affects all Object instances created after pollution, as they inherit the polluted prototype properties. The attack requires either the ability to control chart options passed to the library or to serve a malicious response at a URL that Chartkick loads data from. The fix in version 3.2.0 and later prevents this by filtering or rejecting prototype pollution attempts during chart initialization.
Affected products
- ankane chartkick 3.1.0 through 3.1.3 (npm); 0 through 3.2.x (RubyGems, fixed in 3.3.0)
Timeline
- 2019-11-10: disclosed: Vulnerability reported as issue #117 on GitHub
- 2019-12-02: advisory: GHSA-5pm8-492c-92p5 published
- 2019-11-09: patched: Fix released in version 3.2.0 (npm) and 3.3.0 (RubyGems)
References
- https://github.com/ankane/chartkick.js/issues/117
- https://github.com/ankane/chartkick/commit/b810936bbf687bc74c5b6dba72d2397a399885fa
- https://chartkick.com/
- https://github.com/ankane/chartkick/blob/master/CHANGELOG.md
- https://github.com/ankane/chartkick/commits/master
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/chartkick/CVE-2019-18841.yml