CVE-2022-28738: Double Free

Published Apr 14, 2022
·
Updated

A double free was found in the Regexp compiler in Ruby 3.x before 3.0.4 and 3.1.x before 3.1.2. If a victim attempts to create a Regexp from untrusted user input, an attacker may be able to write to unexpected memory locations.

Other sources

A double-free vulnerability was found in Ruby. The issue occurs during Regexp compilation. This flaw allows an attacker to create a Regexp object with a crafted source string that could cause the same memory to be freed twice.

VE-2022-28738: Double free in Regexp compilation

Posted by mame on 12 Apr 2022

A double-free vulnerability is discovered in Regexp compilation. This vulnerability has been assigned the CVE identifier CVE-2022-28738. We strongly recommend upgrading Ruby. Details

Due to a bug in the Regexp compilation process, creating a Regexp object with a crafted source string could cause the same memory to be freed twice. This is known as a “double free” vulnerability. Note that, in general, it is considered unsafe to create and use a Regexp object generated from untrusted input. In this case, however, following a comprehensive assessment, we treat this issue as a vulnerability.

Please update Ruby to 3.0.4, or 3.1.2. Affected versions

ruby 3.0.3 or prior ruby 3.1.1 or prior

Note that ruby 2.6 series and 2.7 series are not affected. Credits

Thanks to piao for discovering this issue. History

Originally published at 2022-04-12 12:00:00 (UTC)

Red Hat

Affected Software

6 affected componentsFixes available
redhat/ruby<0:3.0.4-160.el9_0
0:3.0.4-160.el9_0
redhat/rh-ruby30-ruby<0:3.0.4-149.el7
0:3.0.4-149.el7
ruby-lang Ruby>=3.0.0<3.0.4
redhat/ruby<3.0.4
3.0.4
redhat/ruby<3.1.2
3.1.2
debian/ruby2.7
2.7.4-1+deb11u12.7.4-1+deb11u5

Event History

Apr 14, 2022
CVE Published
12:00 AM
Data Sourced
via Red Hat·09:34 PM
DescriptionSeverityAffected Software
May 9, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Feb 25, 2026
Data Sourced
via Debian·02:42 PM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is CVE-2022-28738?

CVE-2022-28738 is a double-free vulnerability found in Ruby, specifically in the Regexp compiler.

2

How does CVE-2022-28738 affect Ruby?

CVE-2022-28738 allows an attacker to write to unexpected memory locations if a victim attempts to create a Regexp from untrusted user input.

3

Which versions of Ruby are affected by CVE-2022-28738?

Ruby 3.x before 3.0.4 and 3.1.x before 3.1.2 are affected by CVE-2022-28738.

4

What is the severity of CVE-2022-28738?

CVE-2022-28738 has a severity value of 9.8, which is considered critical.

5

How do I fix CVE-2022-28738?

To fix CVE-2022-28738, update Ruby to version 3.0.4 or 3.1.2, depending on the affected version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203