CVE-2021-41146: Qutebrowser URL Handler Vulnerability

HIGH
Advisory Identifier: GHSA-vw27-fwjf-5qxm
CVSS 8.8
CWE-641 CWE-88 CWE-77
Published
Advisory Summary

CVE-2021-41146 is a HIGH (CVSS 8.8) url handler vulnerability (CWE-641: Improper Restriction of Names for Files and Other Resources) affecting Qutebrowser libraries in the PyPI ecosystem. The issue involves url handler. Remediation is available by upgrading affected packages to version 2.4.0.

CVE-2021-41146 at a Glance

CVE Identifier CVE-2021-41146
GHSA Identifier GHSA-vw27-fwjf-5qxm
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-641: Improper Restriction of Names for Files and Other Resources
Affected Product Qutebrowser
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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

How to Fix CVE-2021-41146

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

qutebrowser fixed: 2.4.0
pip install qutebrowser>=2.4.0
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 qutebrowser

How to Check if You Are Affected

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

pip show qutebrowser

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-641: Improper Restriction of Names for Files and Other Resources, where the product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name. In Qutebrowser, 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 Starting with qutebrowser v1.7.0, the Windows installer for qutebrowser registers it as a handler for certain URL schemes. With some applications such as Outlook Desktop, opening a specially crafted URL can lead to argument injection, allowing execution of qutebrowser commands, which in turn allows arbitrary code execution via commands such as `:spawn` or `:debug-pyeval`. Only Windows installs where qutebrowser is registered as URL handler are affected. It does *not* have to be set as default browser for the exploit to work. ### Patches The issue has been fixed in [qutebrowser v2.4.0](https://github.com/qutebrowser/qutebrowser/releases/tag/v2.4.0) in commit 8f46ba3f6dc7b18375f7aa63c48a1fe461190430. The fix also adds additional hardening for potential similar issues on Linux (by adding the new `--untrusted-args` flag to the `.desktop` file), though no such vulnerabilities are known. Backported patches for older versions are available, but no further releases are planned: - v1.7.x: d1ceaab - v1.8.x: ca7155d - v1.9.x: 157d871 - v1.10.x: 94a6125 - v1.11.x: 10acfbb - v1.12.x: 363a18f - v1.13.x: 410f262 - v1.14.x: e4f4d93 - v2.0.x: 15a1654 - v2.1.x: 509ddf2 - v2.2.x: 03dcba5 - v2.3.x: 00a694c (commits are referring to qutebrowser/qutebrowser on GitHub) ### Workarounds Remove qutebrowser from the default browser settings entirely, so that it does not handle any kind of URLs. Make sure to remove *all* handlers, including an (accidental) `qutebrowserURL` handler, e.g. using [NirSoft URLProtocolView](https://www.nirsoft.net/utils/url_protocol_view.html). ### Timeline 2021-10-15: Issue reported via security@qutebrowser.org by Ping Fan (Zetta) Ke of [Valkyrie-X Security Research Group (VXRL)](https://www.vxrl.hk/) 2021-10-15: Issue confirmed by @The-Compiler (lead developer), author of installer (@bitraid) contacted for help/review 2021-10-15: CVE assigned by GitHub 2021-10-15 to 2021-10-17: Fix developed 2021-10-17: Additional core developer (@toofar) contacted for help/review 2021-10-21: v2.4.0 released containing the fix 2021-10-21: Advisory and fix published ### References See the [commit message](https://github.com/qutebrowser/qutebrowser/commit/8f46ba3f6dc7b18375f7aa63c48a1fe461190430) for additional information and references to various similar issues in other projects. ### Acknowledgements Thanks to Ping Fan (Zetta) Ke of [Valkyrie-X Security Research Group](https://www.vxrl.hk/) (VXRL/@vxresearch) for finding and responsibly disclosing this issue. ### Contact If you have any questions or comments about this advisory, please email [security@qutebrowser.org](mailto:security@qutebrowser.org).

CVE-2021-41146 Affected Qutebrowser Versions

1 component(s)
Fixed Versions:
2.4.0
Product / Package Ecosystem Affected Versions Fixed Version
qutebrowser
PyPI
≥ 1.7.0
< 2.4.0
2.4.0

References

Frequently Asked Questions

What is CVE-2021-41146?
CVE-2021-41146 is a security vulnerability in Qutebrowser involving URL handler under CWE-641: Improper Restriction of Names for Files and Other Resources.
Which Qutebrowser versions are affected?
Affected versions include releases prior to 2.4.0 across affected packages: qutebrowser.
What version fixes CVE-2021-41146?
Upgrading to 2.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is qutebrowser affected?
Yes, qutebrowser is affected in releases prior to 2.4.0. Upgrade your dependency to 2.4.0 or later.
What is the CVSS score of CVE-2021-41146?
CVE-2021-41146 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-41146?
CVE-2021-41146 is classified under CWE-641: Improper Restriction of Names for Files and Other Resources (The product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name.).
How can I check PyPI dependencies for CVE-2021-41146?
Run the dependency tree command: 'pip show qutebrowser'. 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-vw27-fwjf-5qxm",
  "modified" : "2024-10-16T20:48:13Z",
  "published" : "2021-10-22T16:20:10Z",
  "aliases" : [ "CVE-2021-41146" ],
  "summary" : "Arbitrary command execution on Windows via qutebrowserurl: URL handler",
  "details" : "### Impact\nStarting with qutebrowser v1.7.0, the Windows installer for qutebrowser registers it as a handler for certain URL schemes. With some applications such as Outlook Desktop, opening a specially crafted URL can lead to argument injection, allowing execution of qutebrowser commands, which in turn allows arbitrary code execution via commands such as `:spawn` or `:debug-pyeval`.\n\nOnly Windows installs where qutebrowser is registered as URL handler are affected. It does *not* have to be set as default browser for the exploit to work.\n\n### Patches\nThe issue has been fixed in [qutebrowser v2.4.0](https://github.com/qutebrowser/qutebrowser/releases/tag/v2.4.0) in commit 8f46ba3f6dc7b18375f7aa63c48a1fe461190430.\n\nThe fix also adds additional hardening for potential similar issues on Linux (by adding the new `--untrusted-args` flag to the `.desktop` file), though no such vulnerabilities are known.\n\nBackported patches for older versions are available, but no further releases are planned:\n\n- v1.7.x: d1ceaab\n- v1.8.x: ca7155d\n- v1.9.x: 157d871\n- v1.10.x: 94a6125\n- v1.11.x: 10acfbb\n- v1.12.x: 363a18f\n- v1.13.x: 410f262\n- v1.14.x: e4f4d93\n- v2.0.x: 15a1654\n- v2.1.x: 509ddf2\n- v2.2.x: 03dcba5\n- v2.3.x: 00a694c\n\n(commits are referring to qutebrowser/qutebrowser on GitHub)\n\n### Workarounds\nRemove qutebrowser from the default browser settings entirely, so that it does not handle any kind of URLs. Make sure to remove *all* handlers, including an (accidental) `qutebrowserURL` handler, e.g. using [NirSoft URLProtocolView](https://www.nirsoft.net/utils/url_protocol_view.html).\n\n### Timeline\n2021-10-15: Issue reported via security@qutebrowser.org by Ping Fan (Zetta) Ke of [Valkyrie-X Security Research Group (VXRL)](https://www.vxrl.hk/)\n2021-10-15: Issue confirmed by @The-Compiler (lead developer), author of installer (@bitraid) contacted for help/review\n2021-10-15: CVE assigned by GitHub\n2021-10-15 to 2021-10-17: Fix developed\n2021-10-17: Additional core developer (@toofar) contacted for help/review\n2021-10-21: v2.4.0 released containing the fix\n2021-10-21: Advisory and fix published\n\n### References\nSee the [commit message](https://github.com/qutebrowser/qutebrowser/commit/8f46ba3f6dc7b18375f7aa63c48a1fe461190430) for additional information and references to various similar issues in other projects.\n\n### Acknowledgements\nThanks to Ping Fan (Zetta) Ke of [Valkyrie-X Security Research Group](https://www.vxrl.hk/) (VXRL/@vxresearch) for finding and responsibly disclosing this issue.\n\n### Contact\nIf you have any questions or comments about this advisory, please email [security@qutebrowser.org](mailto:security@qutebrowser.org).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "qutebrowser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "2.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/qutebrowser/qutebrowser/security/advisories/GHSA-vw27-fwjf-5qxm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41146"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/qutebrowser/qutebrowser/commit/8f46ba3f6dc7b18375f7aa63c48a1fe461190430"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/qutebrowser/PYSEC-2021-382.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/qutebrowser/qutebrowser"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-641", "CWE-77", "CWE-88" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-21T20:46:42Z",
    "nvd_published_at" : "2021-10-21T18:15:00Z"
  }
}