Vulnerabilities in pkg:pypi/thefuck

PACKAGE
Advisory Identifier: GHSA-8wwf-2644-f8x4
Advisory Summary

CVE-2021-34363 is a HIGH (CVSS 9.1) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Thefuck libraries in the PyPI ecosystem. The issue involves the fuck arbitrary file deletion via path traversal. Remediation is available by upgrading affected packages to version 3.31.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/thefuck

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/thefuck. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-8wwf-2644-f8x4 CVE-2021-34363 HIGH The Fuck Arbitrary File Deletion via Path Traversal

CVE-2021-34363 at a Glance

CVE Identifier CVE-2021-34363
GHSA Identifier GHSA-8wwf-2644-f8x4
Severity HIGH
CVSS v3.1 Base Score 9.1
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Thefuck
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

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:N/S:U/C:N/I:H/A:H).

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

How to Fix CVE-2021-34363

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

thefuck fixed: 3.31
pip install thefuck>=3.31
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 thefuck

How to Check if You Are Affected

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

pip show thefuck

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

Note: The pip show thefuck 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 Thefuck, 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

The thefuck (aka _The Fuck_) is app that corrects errors in previous console commands. _The Fuck_ python package before 3.31 allows Path Traversal that leads to arbitrary file deletion via the `undo archive operation` feature.

CVE-2021-34363 Affected Thefuck Versions

1 component(s)
Fixed Versions:
3.31
Product / Package Ecosystem Affected Versions Fixed Version
thefuck
PyPI
< 3.31
3.31

References

Frequently Asked Questions

What is CVE-2021-34363?
CVE-2021-34363 is a security vulnerability in Thefuck involving The Fuck Arbitrary File Deletion via Path Traversal under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Thefuck versions are affected?
Affected versions include releases prior to 3.31 across affected packages: thefuck.
What version fixes CVE-2021-34363?
Upgrading to 3.31 (or the latest patched release for your respective branch) resolves the vulnerability.
Is thefuck affected?
Yes, thefuck is affected in releases prior to 3.31. Upgrade your dependency to 3.31 or later.
What is the CVSS score of CVE-2021-34363?
CVE-2021-34363 has a CVSS v3.1 base score of 9.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2021-34363?
CVE-2021-34363 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-2021-34363?
Run the dependency tree command: 'pip show thefuck'. 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-8wwf-2644-f8x4",
  "modified" : "2024-11-13T23:02:06Z",
  "published" : "2021-06-15T15:49:01Z",
  "aliases" : [ "CVE-2021-34363" ],
  "summary" : "The Fuck Arbitrary File Deletion via Path Traversal",
  "details" : "The thefuck (aka _The Fuck_) is app that corrects errors in previous console commands. _The Fuck_ python package before 3.31 allows Path Traversal that leads to arbitrary file deletion via the `undo archive operation` feature.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "thefuck"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.31"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-34363"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nvbn/thefuck/commit/e343c577cd7da4d304b837d4a07ab4df1e023092"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nvbn/thefuck"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nvbn/thefuck/releases/tag/3.31"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/thefuck/PYSEC-2021-97.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4MEDDLBFVRUQHPYIBJ4MFM3M4NUJUXL5"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YA6UNQSOY6M3NJDZLS6YJXTS4WGDMEEJ"
  }, {
    "type" : "WEB",
    "url" : "https://vuln.ryotak.me/advisories/48"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-14T19:25:06Z",
    "nvd_published_at" : "2021-06-10T11:15:00Z"
  }
}