CVE-2022-21694: Onionshare cli Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-h29c-wcm8-883h
CVSS 3.7
CWE-732
Published
Advisory Summary

CVE-2022-21694 is a MODERATE (CVSS 3.7) remote code execution vulnerability (CWE-732: Incorrect Permission Assignment for Critical Resource) affecting Onionshare cli libraries in the PyPI ecosystem. The issue involves incorrect permission assignment for critical resource in onionshare. Remediation is available by upgrading affected packages to version 2.5.

CVE-2022-21694 at a Glance

CVE Identifier CVE-2022-21694
GHSA Identifier GHSA-h29c-wcm8-883h
Severity MODERATE
CVSS v3.1 Base Score 3.7
CWE Classification CWE-732: Incorrect Permission Assignment for Critical Resource
Affected Product Onionshare cli
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.7

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

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

How to Fix CVE-2022-21694

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-21694, 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-732: Incorrect Permission Assignment for Critical Resource, where the product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. 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-006 - Vulnerability type: Broken Website Hardening Control - Threat level: Low ## Description: The CSP can be turned on or off but not configured for the specific needs of the website. ## Technical description: The website mode of the application allows to use a hardened CSP, which will block any scripts and external resources. It is not possible to configure this CSP for individual pages and therefore the security enhancement cannot be used for websites using javascript or external resources like fonts or images. If CSP were configurable, the website creator could harden it accordingly to the needs of the application. As this issue correlates with the Github issue for exposing the flask application directly (https://github.com/onionshare/ onionshare/issues/1389), it can be assumed that this can be solved by either changing to a well-known webserver, which supports this kind of configuration, or enhancing the status quo by making the CSP a configurable part of each website. We believe that bundling the nginx or apache webserver would add complexity and dependencies to the application that could result in a larger attack surface - as these packages receive regular security updates. On the other hand it is not recommended to directly expose the flask webserver, due to lack of hardening. This is a trade-off which needs to be evaluated by the Onionshare developers, as multiple features are involved. Ideally the application user could choose between the built-in flask webserver or a system webserver of choice. ## Impact: As this is a general weakness and not a direct vulnerability in the Onionshare application, the direct impact of this issue is rather low. ## Recommendation: - Consider offering a configurable webserver choice - Consider configurable CSP

CVE-2022-21694 Affected Onionshare cli Versions

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

References

Frequently Asked Questions

What is CVE-2022-21694?
CVE-2022-21694 is a security vulnerability in Onionshare cli involving Incorrect Permission Assignment for Critical Resource in OnionShare under CWE-732: Incorrect Permission Assignment for Critical Resource.
Which Onionshare cli versions are affected?
Affected versions include releases prior to 2.5 across affected packages: onionshare-cli.
What version fixes CVE-2022-21694?
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-21694?
CVE-2022-21694 has a CVSS v3.1 base score of 3.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2022-21694?
CVE-2022-21694 is classified under CWE-732: Incorrect Permission Assignment for Critical Resource (The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.).
How can I check PyPI dependencies for CVE-2022-21694?
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-h29c-wcm8-883h",
  "modified" : "2024-10-07T21:16:33Z",
  "published" : "2022-01-21T23:20:17Z",
  "aliases" : [ "CVE-2022-21694" ],
  "summary" : "Incorrect Permission Assignment for Critical Resource 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-006\n- Vulnerability type: Broken Website Hardening Control\n- Threat level: Low\n\n## Description:\n\nThe CSP can be turned on or off but not configured for the specific needs of the website.\n\n## Technical description:\n\nThe website mode of the application allows to use a hardened CSP, which will block any scripts and external resources. It is not possible to configure this CSP for individual pages and therefore the security enhancement cannot be used for websites using javascript or external resources like fonts or images.\n\nIf CSP were configurable, the website creator could harden it accordingly to the needs of the application.\n\nAs this issue correlates with the Github issue for exposing the flask application directly (https://github.com/onionshare/ onionshare/issues/1389), it can be assumed that this can be solved by either changing to a well-known webserver, which supports this kind of configuration, or enhancing the status quo by making the CSP a configurable part of each website.\n\nWe believe that bundling the nginx or apache webserver would add complexity and dependencies to the application that could result in a larger attack surface - as these packages receive regular security updates. On the other hand it is not recommended to directly expose the flask webserver, due to lack of hardening. This is a trade-off which needs to be evaluated by the Onionshare developers, as multiple features are involved. Ideally the application user could choose between the built-in flask webserver or a system webserver of choice.\n\n## Impact:\n\nAs this is a general weakness and not a direct vulnerability in the Onionshare application, the direct impact of this issue is rather low.\n\n## Recommendation:\n\n- Consider offering a configurable webserver choice\n- Consider configurable CSP",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "onionshare-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2"
      }, {
        "fixed" : "2.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/onionshare/onionshare/security/advisories/GHSA-h29c-wcm8-883h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21694"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/onionshare/onionshare/issues/1389"
  }, {
    "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-45.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-732" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-19T19:32:41Z",
    "nvd_published_at" : "2022-01-18T23:15:00Z"
  }
}