CVE-2021-32740
JSON

7.5high

Regular Expression Denial of Service in Addressable templates

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
2.14% (higher than 83% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-jxhc-q857-3j6g

Description

Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. An uncontrolled resource consumption vulnerability exists after version 2.3.0 through version 2.7.0. Within the URI template implementation in Addressable, a maliciously crafted template may result in uncontrolled resource consumption, leading to denial of service when matched against a URI. In typical usage, templates would not normally be read from untrusted user input, but nonetheless, no previous security advisory for Addressable has cautioned against doing this. Users of the parsing capabilities in Addressable but not the URI template capabilities are unaffected. The vulnerability is patched in version 2.8.0. As a workaround, only create Template objects from trusted sources that have been validated not to produce catastrophic backtracking.

Affected

Product or packageVersionsReported by
sporkmonger addressable> 2.3.0, <= 2.7.0CVE List
addressable (RubyGems)from 2.3.0 before 2.8.0GitHub Advisory Database
addressable_project addressablefrom 2.3.0 before 2.8.0NVD
fedoraproject fedora33, 34NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:N/A:P

Classification

What each source says

CVE List

Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. An uncontrolled resource consumption vulnerability exists after version 2.3.0 through version 2.7.0. Within the URI template implementation in Addressable, a maliciously crafted template may result in uncontrolled resource consumption, leading to denial of service when matched against a URI. In typical usage, templates would not normally be read from untrusted user input, but nonetheless, no previous security advisory for Addressable has cautioned against doing this. Users of the parsing capabilities in Addressable but not the URI template capabilities are unaffected. The vulnerability is patched in version 2.8.0. As a workaround, only create Template objects from trusted sources that have been validated not to produce catastrophic backtracking.

GitHub Advisory Database
Impact

Within the URI template implementation in Addressable, a maliciously crafted template may result in uncontrolled resource consumption, leading to denial of service when matched against a URI. In typical usage, templates would not normally be read from untrusted user input, but nonetheless, no previous security advisory for Addressable has cautioned against doing this. Users of the parsing capabilities in Addressable but not the URI template capabilities are unaffected.

Patches

The vulnerability was introduced in version 2.3.0 (previously yanked) and has been present in all subsequent versions up to, and including, 2.7.0. It is fixed in version 2.8.0.

Workarounds

The vulnerability can be avoided by only creating Template objects from trusted sources that have been validated not to produce catastrophic backtracking.

References
For more information

If you have any questions or comments about this advisory:

NVD (es)

Addressable es una implementación alternativa a la implementación URI que forma parte de la biblioteca estándar de Ruby. Se presenta una vulnerabilidad de consumo de recursos no controlados después de la versión 2.3.0 hasta la versión 2.7.0. Dentro de la implementación de plantillas URI en Addressable, una plantilla diseñada maliciosamente puede resultar en un consumo no controlado de recursos, conllevando a una denegación de servicio cuando se compara con una URI. En el uso típico, las plantillas no se leerían normalmente de la entrada de un usuario no fiable, pero sin embargo, ningún aviso de seguridad anterior para Addressable ha sido advertido en contra esto. Unos usuarios de las capacidades de análisis de Addressable, pero no de las capacidades de plantillas URI, no están afectados. La vulnerabilidad está parcheada en la versión 2.8.0. Como solución, sólo cree objetos de Plantilla desde fuentes confiables que hayan sido comprobadas para no producir retrocesos catastróficos

References

https://github.com/sporkmonger/addressable/security/advisories/GHSA-jxhc-q857-3j6gthird-party-advisory, web
https://github.com/sporkmonger/addressable/commit/0d8a3127e35886ce9284810a7f2438bff6b43cbcpatch, release-notes, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WYPVOOQU7UB277UUERJMCNQLRCXRCIQ5/vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SDFQM2NHNAZ3NNUQZEJTYECYZYXV4UDS/vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2021-32740advisory
https://github.com/sporkmonger/addressable/commit/89c76130ce255c601f642a018cb5fb5a80e679a7web
https://github.com/sporkmonger/addressable/commit/92685096b1f7235ed8986c03ce30a24972eed848#diff-fb36d3dc67e6565ffde17e666a98697f48e76dac38fabf1bb9e97cdf3b583d76web
https://github.com/advisories/GHSA-jxhc-q857-3j6gadvisory
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/addressable/CVE-2021-32740.ymlweb
https://github.com/sporkmonger/addressablepackage
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SDFQM2NHNAZ3NNUQZEJTYECYZYXV4UDSweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WYPVOOQU7UB277UUERJMCNQLRCXRCIQ5web

Sources

SourceRecordLicence
CVE ListCVE-2021-32740 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-jxhc-q857-3j6g changed 2026-07-08CC-BY-4.0
NVDCVE-2021-32740 changed 2026-06-17Public domain