CVE-2022-21693: Onionshare cli Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-jgm9-xpfj-4fq6
CVSS 6.3
CWE-22
Published
Advisory Summary

CVE-2022-21693 is a MODERATE (CVSS 6.3) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Onionshare cli libraries in the PyPI ecosystem. The issue involves path traversal in onionshare. Remediation is available by upgrading affected packages to version 2.5.

CVE-2022-21693 at a Glance

CVE Identifier CVE-2022-21693
GHSA Identifier GHSA-jgm9-xpfj-4fq6
Severity MODERATE
CVSS v3.1 Base Score 6.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Onionshare cli
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.3

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-21693

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

onionshare-cli fixed: 2.5
pip install onionshare-cli>=2.5
Verify Direct and Transitive Dependencies

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

pip show onionshare-cli

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-21693, inspect your installed packages using pip:

pip show onionshare-cli

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

Note: The pip show onionshare-cli command checks currently installed packages in your active Python environment.

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 Onionshare cli, 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

Between September 26, 2021 and October 8, 2021, [Radically Open Security](https://www.radicallyopensecurity.com/) conducted a penetration test of OnionShare 2.4, funded by the Open Technology Fund's [Red Team lab](https://www.opentech.fund/labs/red-team-lab/). This is an issue from that penetration test. - Vulnerability ID: OTF-013 - Vulnerability type: Improper Hardening - Threat level: Low ## Description: The filesystem restriction could be hardened and should only allow for pre-defined subfolders. ## Technical description: The Flatpak and Snap configurations allow for read-only access on the whole home folder. The relevant lines in the configuration files are `onionshare/snap/snapcraft.yaml#L20` and `onionshare/flatpak/org.onionshare.OnionShare.yaml#L19` , respectively. The encapsulation of filesystem access via these mechanisms should be restricted to pre-defined folders and not allow for access to (configuration) files outside the Onionshare-specific folders. Sadly Snap does not allow for further restriction to specific folders and therefore cannot be further hardened. By default both frameworks disallow access to hidden folders and therefore reduce the potential impact. ## Impact: An adversary with a primitive that allows for filesystem access from the context of the Onionshare process can access sensitive files in the entire user home folder. This could lead to the leaking of sensitive data. Due to the automatic exclusion of hidden folders, the impact is reduced. ## Recommendation: - Reduce read access in Flatpak configuration.

CVE-2022-21693 Affected Onionshare cli Versions

1 component(s)
Fixed Versions:
2.5
Product / Package Ecosystem Affected Versions Fixed Version
onionshare-cli
PyPI
≥ 2.3
< 2.5
2.5

References

Frequently Asked Questions

What is CVE-2022-21693?
CVE-2022-21693 is a security vulnerability in Onionshare cli involving Path traversal in Onionshare under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Onionshare cli versions are affected?
Affected versions include releases prior to 2.5 across affected packages: onionshare-cli.
What version fixes CVE-2022-21693?
Upgrading to 2.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is onionshare-cli affected?
Yes, onionshare-cli is affected in releases prior to 2.5. Upgrade your dependency to 2.5 or later.
What is the CVSS score of CVE-2022-21693?
CVE-2022-21693 has a CVSS v3.1 base score of 6.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2022-21693?
CVE-2022-21693 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 PyPI dependencies for CVE-2022-21693?
Run the dependency tree command: 'pip show onionshare-cli'. 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-jgm9-xpfj-4fq6",
  "modified" : "2024-10-07T21:02:51Z",
  "published" : "2022-01-21T23:20:19Z",
  "aliases" : [ "CVE-2022-21693" ],
  "summary" : "Path traversal in Onionshare",
  "details" : "Between September 26, 2021 and October 8, 2021, [Radically Open Security](https://www.radicallyopensecurity.com/) conducted a penetration test of OnionShare 2.4, funded by the Open Technology Fund's [Red Team lab](https://www.opentech.fund/labs/red-team-lab/). This is an issue from that penetration test.\n\n- Vulnerability ID: OTF-013\n- Vulnerability type: Improper Hardening\n- Threat level: Low\n\n## Description:\n\nThe filesystem restriction could be hardened and should only allow for pre-defined subfolders.\n\n## Technical description:\n\nThe Flatpak and Snap configurations allow for read-only access on the whole home folder. The relevant lines in the configuration files are `onionshare/snap/snapcraft.yaml#L20` and `onionshare/flatpak/org.onionshare.OnionShare.yaml#L19` , respectively.\n\nThe encapsulation of filesystem access via these mechanisms should be restricted to pre-defined folders and not allow for access to (configuration) files outside the Onionshare-specific folders.\n\nSadly Snap does not allow for further restriction to specific folders and therefore cannot be further hardened. By default both frameworks disallow access to hidden folders and therefore reduce the potential impact.\n\n## Impact:\n\nAn adversary with a primitive that allows for filesystem access from the context of the Onionshare process can access sensitive files in the entire user home folder. This could lead to the leaking of sensitive data. Due to the automatic exclusion of hidden folders, the impact is reduced.\n\n## Recommendation:\n\n- Reduce read access in Flatpak configuration.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "onionshare-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3"
      }, {
        "fixed" : "2.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/onionshare/onionshare/security/advisories/GHSA-jgm9-xpfj-4fq6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21693"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/onionshare/onionshare"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/onionshare/onionshare/releases/tag/v2.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/onionshare-cli/PYSEC-2022-44.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-19T19:28:05Z",
    "nvd_published_at" : "2022-01-18T22:15:00Z"
  }
}