CVE-2022-31163 TZInfo relative path traversal vulnerability allows loading of arbitrary files

High 7.5 Published Updated

Attackers can exploit path traversal in TZInfo to load arbitrary files, leading to code execution within the Ruby process.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2022-31163?

CVE-2022-31163 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 21 Jul 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

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`.

Weakness: CWE-23, CWE-22

Which versions are affected by CVE-2022-31163?

4 open source packages ship an affected version, including tzinfo. It affects 2 products.

PackageAffectedFixed in
tzinfo RubyGemsAll versions0.3.61
tzinfo RubyGemsAll versions0.3.61
tzinfo RubyGemsFrom 1.0.01.2.10
tzinfo RubyGemsFrom 1.0.01.2.10
Linux distribution packages (12)
rubygem-tzinfo SUSE:Linux Enterprise High Availability Extension 15All versions1.2.4-150000.3.3.1
rubygem-tzinfo SUSE:Linux Enterprise High Availability Extension 15 SP1All versions1.2.4-150000.3.3.1
rubygem-tzinfo SUSE:Linux Enterprise High Availability Extension 15 SP2All versions1.2.4-150000.3.3.1
rubygem-tzinfo SUSE:Linux Enterprise High Availability Extension 15 SP3All versions1.2.4-150000.3.3.1
rubygem-tzinfo SUSE:Linux Enterprise High Availability Extension 15 SP4All versions1.2.4-150000.3.3.1
rubygem-tzinfo SUSE:OpenStack Cloud Crowbar 8All versions1.2.2-3.3.1
rubygem-tzinfo SUSE:OpenStack Cloud Crowbar 9All versions1.2.2-3.3.1
rubygem-tzinfo openSUSE:Leap 15.3All versions1.2.4-150000.3.3.1
rubygem-tzinfo openSUSE:Leap 15.4All versions1.2.4-150000.3.3.1
ruby3.2-rubygem-tzinfo-1.2 openSUSE:TumbleweedAll versions1.2.10-1.4
rubygem-tzinfo-1.2 openSUSE:TumbleweedAll versions1.2.10-1.1
rubygem-tzinfo-1.2 openSUSE:TumbleweedAll versions1.2.11-1.5

Products include Debian Debian Linux, Tzinfo Project Tzinfo.

How do I fix CVE-2022-31163?

Upgrade tzinfo to a fixed version for your release line: 0.3.61 or 1.2.10.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2022-31163 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-31163 exists.

All Debian Debian Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-31163, DLA-3077-1, DLA-3866-1, GHSA-5cm2-9h8c-rvfx, OESA-2024-1398, OESA-2024-1399 and 6 more.

Is CVE-2022-31163 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free