CVE-2022-46171: Tauri Tauri Filesystem Scope Glob Pattern Vulnerability

MODERATE
Advisory Identifier: GHSA-6mv3-wm7j-h4w5
CVSS 6.8
CWE-22
Published
Advisory Summary

CVE-2022-46171 is a MODERATE (CVSS 6.8) tauri filesystem scope glob pattern vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Tauri libraries in the crates.io ecosystem. The issue involves tauri filesystem scope glob pattern is too permissive. Remediation is available by upgrading affected packages to version 1.0.8, 1.1.3, 1.2.3, 2.0.0-alpha.2.

CVE-2022-46171 at a Glance

CVE Identifier CVE-2022-46171
GHSA Identifier GHSA-6mv3-wm7j-h4w5
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Tauri
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2022-46171

To remediate this vulnerability, upgrade all affected Tauri dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tauri fixed: 1.0.8
Upgrade tauri to 1.0.8
tauri fixed: 1.1.3
Upgrade tauri to 1.1.3
tauri fixed: 1.2.3
Upgrade tauri to 1.2.3
tauri fixed: 2.0.0-alpha.2
Upgrade tauri to 2.0.0-alpha.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for tauri

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-46171, inspect your project dependencies for Tauri:

inspect dependencies for tauri

Analyze the terminal output to locate any version of Tauri in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Tauri, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact The filesystem glob pattern wildcards `*`, `?`, and `[...]` match file path literals and leading dots by default, which unintentionally exposes sub folder content of allowed paths. Example: The `fs` scope `$HOME/*.key` would also allow `$HOME/.ssh/secret.key` to be read even though it is in a sub directory of `$HOME` and is inside a hidden folder. Scopes without the wildcards are not affected. As `**` allows for sub directories the behavior there is also as expected. ### Patches The issue has been patched in the latest release and was backported into the currently supported 1.x branches. ### Workarounds No workaround is known at the time of publication. ### References The original report contained information that the `dialog.open` component automatically allows one sub directory to be read, regardless of the `recursive` option. Imagine a file system looking like ``` o ../ o documents/ - file.txt - deeper/ o deep_file.txt ``` Reproduction steps: 1. Trying to load “file.txt” or “deep_file.txt” doesn’t work. Expected 2. Select “documents” as folder to open(ie. with window.__TAURI__.dialog.open) 3. Trying to load “file.txt” works. Expected 5. Trying to load “deep_file.txt” also works, which isn’t expected The recursive flag is used in https://github.com/tauri-apps/tauri/blob/cd8c074ae6592303d3f6844a4fb6d262eae913b2/core/tauri/src/scope/fs.rs#L154 to scope the filesystem access to either files in the folder or to also include sub directories. The original issue was replicated and further investigated. The root cause was triaged to the `glob` crate facilitating defaults, which allow the `*` and `[...]` to also match path literals. ```rust MatchOptions { case_sensitive: true, require_literal_separator: false, require_literal_leading_dot: false } ``` This implicated that not only the `dialog.open` component was affected but rather all `fs` scopes containing the `*` or `[...]` glob. During this investigation it became obvious that the current glob matches would also match hidden folder (e.g: `.ssh`) content by default, without explicitly allowing hidden folders to be matched. This is not commonly expected behavior in comparison to for example `bash`. The new default Match options are: ```rust MatchOptions { case_sensitive: true, require_literal_separator: true, require_literal_leading_dot: true } ``` > Another note security relevant for developers building applications interacting with case sensitive filesystems is, that the `case_sensitive` option only affects ASCII file paths and is not valid in Unicode based paths. This is considered a known risk until the `glob` crate supports non-ASCII file paths for this type of case sensitive matching. ### For more Information If you have any questions or comments about this advisory: Open an issue in tauri Email us at [security@tauri.app](mailto:security@tauri.app)

CVE-2022-46171 Affected Tauri Versions

4 component(s)
Fixed Versions:
1.0.81.1.31.2.32.0.0-alpha.2
Product / Package Ecosystem Affected Versions Fixed Version
tauri
crates.io
≥ 1.0.0
< 1.0.8
1.0.8
tauri
crates.io
≥ 1.1.0
< 1.1.3
1.1.3
tauri
crates.io
≥ 1.2.0
< 1.2.3
1.2.3
tauri
crates.io
≥ 2.0.0-alpha.0
< 2.0.0-alpha.2
2.0.0-alpha.2

References

Frequently Asked Questions

What is CVE-2022-46171?
CVE-2022-46171 is a security vulnerability in Tauri involving Tauri Filesystem Scope Glob Pattern is too Permissive under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Tauri versions are affected?
Affected versions include releases prior to 1.0.8, 1.1.3, 1.2.3, 2.0.0-alpha.2 across affected packages: tauri.
What version fixes CVE-2022-46171?
Upgrading to 1.0.8, 1.1.3, 1.2.3, 2.0.0-alpha.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tauri affected?
Yes, tauri is affected in releases prior to 1.0.8, 1.1.3, 1.2.3, 2.0.0-alpha.2. Upgrade your dependency to 1.0.8, 1.1.3, 1.2.3, 2.0.0-alpha.2 or later.
What is the CVSS score of CVE-2022-46171?
CVE-2022-46171 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2022-46171?
CVE-2022-46171 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check crates.io dependencies for CVE-2022-46171?
Run the dependency tree command: 'inspect dependencies for tauri'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6mv3-wm7j-h4w5",
  "modified" : "2022-12-23T18:01:54Z",
  "published" : "2022-12-22T20:03:43Z",
  "aliases" : [ "CVE-2022-46171" ],
  "summary" : "Tauri Filesystem Scope Glob Pattern is too Permissive",
  "details" : "### Impact\n\nThe filesystem glob pattern wildcards `*`, `?`, and `[...]` match file path literals and leading dots by default, which unintentionally exposes sub folder content of allowed paths.\n\nExample: The `fs` scope `$HOME/*.key` would also allow `$HOME/.ssh/secret.key` to be read even though it is in a sub directory of `$HOME` and is inside a hidden folder.\n\nScopes without the wildcards are not affected. As `**` allows for sub directories the behavior there is also as expected.\n\n### Patches\n\nThe issue has been patched in the latest release and was backported into the currently supported 1.x branches.\n\n### Workarounds\n\nNo workaround is known at the time of publication.\n\n### References\n\nThe original report contained information that the `dialog.open` component automatically allows one sub directory to be read, regardless of the `recursive` option.\n\nImagine a file system looking like\n```\n o ../\n o documents/\n    - file.txt\n    - deeper/\n       o deep_file.txt\n```\n\nReproduction steps:\n\n1. Trying to load “file.txt” or “deep_file.txt” doesn’t work. Expected\n2. Select “documents” as folder to open(ie. with window.__TAURI__.dialog.open)\n3. Trying to load “file.txt” works. Expected\n5. Trying to load “deep_file.txt” also works, which isn’t expected\n\nThe recursive flag is used in https://github.com/tauri-apps/tauri/blob/cd8c074ae6592303d3f6844a4fb6d262eae913b2/core/tauri/src/scope/fs.rs#L154 to scope the filesystem access to either files in the folder or to also include sub directories.\n\nThe original issue was replicated and further investigated.\n\nThe root cause was triaged to the `glob` crate facilitating defaults, which allow the `*` and `[...]` to also match path literals.\n\n```rust\nMatchOptions {\n    case_sensitive: true,\n    require_literal_separator: false,\n    require_literal_leading_dot: false\n}\n```\n\nThis implicated that not only the `dialog.open` component was affected but rather all `fs` scopes containing the `*` or `[...]` glob.\nDuring this investigation it became obvious that the current glob matches would also match hidden folder (e.g: `.ssh`) content by default, without explicitly allowing hidden folders to be matched. This is not commonly expected behavior in comparison to for example `bash`.\n\nThe new default  Match options are:\n\n```rust\nMatchOptions {\n    case_sensitive: true,\n    require_literal_separator: true,\n    require_literal_leading_dot: true\n}\n```\n\n> Another note security relevant for developers building applications interacting with case sensitive filesystems is, that the `case_sensitive` option only affects ASCII file paths and is not valid in Unicode based paths. This is considered a known risk until the `glob` crate supports non-ASCII file paths for this type of case sensitive matching.\n\n### For more Information\n\nIf you have any questions or comments about this advisory:\n\nOpen an issue in tauri\nEmail us at [security@tauri.app](mailto:security@tauri.app)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.1.0"
      }, {
        "fixed" : "1.1.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "1.2.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tauri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-alpha.0"
      }, {
        "fixed" : "2.0.0-alpha.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/security/advisories/GHSA-6mv3-wm7j-h4w5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-46171"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/14d567f7ecb25a6d1024cf3d796f86aee89d0dd4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/72389b00d7b495ffd7750eb1e75a3b8537d07cf3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tauri-apps/tauri/commit/f0602e7c294245ab6ef6fbf2a976ef398340ef58"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tauri-apps/tauri"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-22T20:03:43Z",
    "nvd_published_at" : "2022-12-23T14:15:00Z"
  }
}