CVE-2023-5349
Ruby vulnerability analysis and mitigation

Overview

A memory leak vulnerability (CVE-2023-5349) was discovered in ruby-magick, an interface between Ruby and ImageMagick. The vulnerability was reported on October 3, 2023, affecting RMagick versions up to (excluding) 5.3.0. The flaw specifically impacts the Magick::Draw functionality when calling GetDrawInfo() (NVD, Red Hat).

Technical details

The vulnerability occurs due to a double call to GetDrawInfo in the DrawOptionsinitialize function. The issue was introduced in version 2.16.0-6 where AcquireDrawInfo() was used instead of magickmalloc() for memory allocation, but the GetDrawInfo call wasn't removed. Since AcquireDrawInfo internally calls GetDrawInfo, this resulted in a memory leak. The vulnerability has been assigned a CVSS v3.1 base score of 3.3 (Low) with the vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L (Ubuntu).

Impact

The memory leak can lead to denial of service (DoS) through memory exhaustion in long-running processes. Testing showed that affected versions could consume up to 7GB of memory that keeps accruing exponentially, compared to normal usage of around 248MB (GitHub Issue).

Mitigation and workarounds

The vulnerability has been fixed in RMagick version 5.3.0 by removing the unnecessary GetDrawInfo() call. Users are advised to upgrade to this version or later. The fix was implemented through a patch that removes the redundant GetDrawInfo call since AcquireDrawInfo already includes this functionality (GitHub PR).

Community reactions

The issue was initially reported as a performance problem on GitHub, where users noticed significant memory consumption increases after the ImageMagick 6.9.12-90 release. After investigation, it was confirmed as a security vulnerability and assigned CVE-2023-5349. Various Linux distributions, including Fedora and Ubuntu, have released security updates to address this vulnerability (Fedora Update).

Additional resources


SourceThis report was generated using AI

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