CVE-2022-31163
TZInfo relative path traversal vulnerability allows loading of arbitrary files
Severity Score
Exploit Likelihood
Affected Versions
Public Exploits
1Exploited in Wild
-Decision
Descriptions
TZInfo is a Ruby library that provides access to time zone data and allows times to be converted using time zone rules. Versions prior to 0.36.1, as well as those prior to 1.2.10 when used with the Ruby data source tzinfo-data, are vulnerable to relative path traversal. With the Ruby data source, time zones are defined in Ruby files. There is one file per time zone. Time zone files are loaded with `require` on demand. In the affected versions, `TZInfo::Timezone.get` fails to validate time zone identifiers correctly, allowing a new line character within the identifier. With Ruby version 1.9.3 and later, `TZInfo::Timezone.get` can be made to load unintended files with `require`, executing them within the Ruby process. Versions 0.3.61 and 1.2.10 include fixes to correctly validate time zone identifiers. Versions 2.0.0 and later are not vulnerable. Version 0.3.61 can still load arbitrary files from the Ruby load path if their name follows the rules for a valid time zone identifier and the file has a prefix of `tzinfo/definition` within a directory in the load path. Applications should ensure that untrusted files are not placed in a directory on the load path. As a workaround, the time zone identifier can be validated before passing to `TZInfo::Timezone.get` by ensuring it matches the regular expression `\A[A-Za-z0-9+\-_]+(?:\/[A-Za-z0-9+\-_]+)*\z`.
TZInfo es una biblioteca de Ruby que proporciona acceso a los datos de las zonas horarias y permite convertir las horas usando reglas de zonas horarias. Las versiones anteriores a 0.36.1, así como las anteriores a la 1.2.10 cuando son usadas con la fuente de datos de Ruby tzinfo-data, son vulnerables a un salto de ruta relativo. Con la fuente de datos Ruby, las zonas horarias son definidas en archivos Ruby. Se presenta un archivo por zona horaria. Los archivos de zonas horarias se cargan con "require" bajo demanda. En las versiones afectadas, "TZInfo::Timezone.get" no comprueba correctamente los identificadores de zonas horarias, permitiendo un nuevo carácter de línea dentro del identificador. Con la versión 1.9.3 de Ruby y posteriores, puede hacerse que "TZInfo::Timezone.get" cargue archivos no deseados con "require", ejecutándolos dentro del proceso de Ruby. Las versiones 0.3.61 y 1.2.10 incluyen correcciones para comprender correctamente los identificadores de zona horaria. Las versiones 2.0.0 y posteriores no son vulnerables. La versión 0.3.61 aún puede cargar archivos arbitrarios desde la ruta de carga de Ruby si su nombre sigue las reglas para un identificador de zona horaria válido y el archivo presenta un prefijo de "tzinfo/definición" dentro de un directorio en la ruta de carga. Las aplicaciones deben asegurarse de que los archivos que no son confiables no sean colocados en un directorio de la ruta de carga. Como mitigación, el identificador de la zona horaria puede ser comprobado antes de pasarlo a "TZInfo::Timezone.get" asegurándose de que coincide con la expresión regular "A[A-Za-z0-9+\-_]+(?:\/[A-Za-z0-9+\-_]+)*\z"
A flaw was found in rubygem-tzinfo. When using the Timezone.get function, it fails to validate time zone identifiers correctly, allowing a new line character input within the identifier. This flaw allows an attacker to use the new line character and write any code, which will be executed within the Ruby process.
CVSS Scores
SSVC
- Decision:Attend
Timeline
- 2022-05-18 CVE Reserved
- 2022-07-21 CVE Published
- 2024-09-05 CVE Updated
- 2024-09-05 First Exploit
- 2024-10-12 EPSS Updated
- ---------- Exploited in Wild
- ---------- KEV Due Date
CWE
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- CWE-23: Relative Path Traversal
CAPEC
References (8)
URL | Tag | Source |
---|---|---|
https://github.com/tzinfo/tzinfo/releases/tag/v0.3.61 | Release Notes | |
https://github.com/tzinfo/tzinfo/releases/tag/v1.2.10 | Release Notes | |
https://lists.debian.org/debian-lts-announce/2022/08/msg00009.html | Mailing List |
URL | Date | SRC |
---|---|---|
https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx | 2024-09-05 |
URL | Date | SRC |
---|---|---|
https://github.com/tzinfo/tzinfo/commit/9905ca93abf7bf3e387bd592406e403cd18334c7 | 2022-10-26 | |
https://github.com/tzinfo/tzinfo/commit/9eddbb5c0e682736f61d0dd803b6031a5db9eadf | 2022-10-26 |
URL | Date | SRC |
---|---|---|
https://access.redhat.com/security/cve/CVE-2022-31163 | 2023-05-03 | |
https://bugzilla.redhat.com/show_bug.cgi?id=2110551 | 2023-05-03 |
Affected Vendors, Products, and Versions
Vendor | Product | Version | Other | Status | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Vendor | Product | Version | Other | Status | <-- --> | Vendor | Product | Version | Other | Status |
Tzinfo Project Search vendor "Tzinfo Project" | Tzinfo Search vendor "Tzinfo Project" for product "Tzinfo" | < 0.3.61 Search vendor "Tzinfo Project" for product "Tzinfo" and version " < 0.3.61" | - |
Affected
| ||||||
Tzinfo Project Search vendor "Tzinfo Project" | Tzinfo Search vendor "Tzinfo Project" for product "Tzinfo" | >= 1.0.0 < 1.2.10 Search vendor "Tzinfo Project" for product "Tzinfo" and version " >= 1.0.0 < 1.2.10" | - |
Affected
| ||||||
Debian Search vendor "Debian" | Debian Linux Search vendor "Debian" for product "Debian Linux" | 10.0 Search vendor "Debian" for product "Debian Linux" and version "10.0" | - |
Affected
|