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

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

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **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:** Yes
- **Published:** 21 Jul 2022
- **Updated:** 5 Sep 2024
- **Also known as:** DEBIAN-CVE-2022-31163, DLA-3077-1, DLA-3866-1, GHSA-5cm2-9h8c-rvfx, OESA-2024-1398, OESA-2024-1399, SUSE-SU-2022:2592-1, SUSE-SU-2022:2765-1, UBUNTU-CVE-2022-31163, openSUSE-SU-2024:12249-1, openSUSE-SU-2024:13171-1, openSUSE-SU-2024:14178-1

## 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 (Relative Path Traversal), CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2022-31163?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tzinfo` | RubyGems | All versions | 0.3.61 |
| `tzinfo` | RubyGems | All versions | 0.3.61 |
| `tzinfo` | RubyGems | From 1.0.0 | 1.2.10 |
| `tzinfo` | RubyGems | From 1.0.0 | 1.2.10 |
| `rubygem-tzinfo` | SUSE:Linux Enterprise High Availability Extension 15 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | SUSE:Linux Enterprise High Availability Extension 15 SP1 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | SUSE:Linux Enterprise High Availability Extension 15 SP2 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | SUSE:Linux Enterprise High Availability Extension 15 SP3 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | SUSE:Linux Enterprise High Availability Extension 15 SP4 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | SUSE:OpenStack Cloud Crowbar 8 | All versions | 1.2.2-3.3.1 |
| `rubygem-tzinfo` | SUSE:OpenStack Cloud Crowbar 9 | All versions | 1.2.2-3.3.1 |
| `rubygem-tzinfo` | openSUSE:Leap 15.3 | All versions | 1.2.4-150000.3.3.1 |
| `rubygem-tzinfo` | openSUSE:Leap 15.4 | All versions | 1.2.4-150000.3.3.1 |
| `ruby3.2-rubygem-tzinfo-1.2` | openSUSE:Tumbleweed | All versions | 1.2.10-1.4 |
| `rubygem-tzinfo-1.2` | openSUSE:Tumbleweed | All versions | 1.2.10-1.1 |
| `rubygem-tzinfo-1.2` | openSUSE:Tumbleweed | All versions | 1.2.11-1.5 |

Products: 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.

## Is CVE-2022-31163 being exploited?

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

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-31163 and fix it if it is affected.

What it is: 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.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-31163 exists.

Affected packages and fixed versions:
- tzinfo (RubyGems): affected all versions; fixed in 0.3.61
- tzinfo (RubyGems): affected all versions; fixed in 0.3.61
- tzinfo (RubyGems): affected from 1.0.0; fixed in 1.2.10
- tzinfo (RubyGems): affected from 1.0.0; fixed in 1.2.10

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-31163/ (Markdown: https://insights.sbomify.com/CVE-2022-31163/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-31163
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-31163
- OSV: https://osv.dev/vulnerability/CVE-2022-31163

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-31163/
Summaries are generated and may contain mistakes; the official description above is the record.
