Skip to main content
Vulnerability Database/CVE-2026-95168

CVE-2026-95168: thefuck RCE Vulnerability

CVE-2026-95168 is a remote code execution vulnerability in thefuck v.3.32 that enables local attackers to execute arbitrary code through rule import paths. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-95168 Overview

CVE-2026-95168 is a code injection vulnerability [CWE-94] affecting nvbn thefuck version 3.32, a popular command-line utility that corrects previous console commands. A local attacker can execute arbitrary code by abusing the get_rules_import_paths function in thefuck/corrector.py and the Rule.from_path method in thefuck/types.py. These functions load and execute Python rule files from predictable paths without validating their origin. An attacker with local access can place a malicious rule file that executes when thefuck loads its rule set.

Critical Impact

Local attackers can achieve arbitrary code execution in the context of the user running thefuck, leading to full confidentiality, integrity, and availability impact on the affected account.

Affected Products

  • nvbn thefuck v3.32
  • Installations loading contributed rules from user-writable directories
  • Python environments where thefuck is invoked by privileged or shared users

Discovery Timeline

  • 2026-10-20 - CVE-2026-95168 published to the National Vulnerability Database (NVD)
  • 2026-10-21 - Last updated in NVD database

Technical Details for CVE-2026-95168

Vulnerability Analysis

The thefuck utility uses a plugin-style rule loader to correct mistyped shell commands. The get_rules_import_paths function in thefuck/corrector.py enumerates rule modules from built-in and user-controlled directories. For each discovered path, Rule.from_path in thefuck/types.py imports the Python file and binds its callables as active rules. Because imports execute module-level code, any file placed in a loaded directory runs with the privileges of the invoking user.

An attacker who can write to a rule directory, or who can trick a user into placing a crafted file there, achieves arbitrary code execution the next time thefuck runs. The attack requires local access and low privileges but no user interaction beyond the normal invocation of the tool.

Root Cause

The root cause is improper control of code generation [CWE-94]. The rule loader treats any .py file within configured paths as trusted and imports it directly. There is no signature check, allowlist, or sandboxing of the imported module.

Attack Vector

Exploitation requires local access to a directory included in get_rules_import_paths. The attacker drops a Python file containing arbitrary code at module scope. When the victim runs thefuck or fuck from their shell, Rule.from_path imports the file and executes the payload. Refer to the GitHub Vulnerability Report and the GitHub Issue Discussion for technical details.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-95168

Indicators of Compromise

  • Unexpected .py files in user rule directories such as ~/.config/thefuck/rules/
  • Modifications to files under the thefuck package path performed by non-package-manager processes
  • Child processes spawned by shell wrappers immediately after invoking fuck or thefuck

Detection Strategies

  • Monitor file creation and modification events in thefuck rule directories and alert on writes by non-administrative users
  • Baseline the set of installed rule files and flag deviations through file integrity monitoring
  • Correlate python or thefuck process launches with subsequent outbound network connections or shell spawns

Monitoring Recommendations

  • Collect endpoint process telemetry for Python interpreter invocations and parent-child relationships
  • Audit shell initialization files for aliases that invoke thefuck with elevated privileges
  • Review package inventories to identify hosts running thefuck v3.32 or earlier

How to Mitigate CVE-2026-95168

Immediate Actions Required

  • Restrict write access to all directories enumerated by get_rules_import_paths to the owning user only
  • Remove thefuck from shared or multi-user hosts where rule directories cannot be isolated
  • Audit existing rule directories for unexpected Python files and remove any that are not vendor-supplied

Patch Information

At the time of publication, no fixed version is listed in the NVD entry for CVE-2026-95168. Track the upstream GitHub Issue Discussion for remediation status and apply the vendor patch when released.

Workarounds

  • Set directory permissions on ~/.config/thefuck/ and any custom rule paths to 0700 to prevent other local users from dropping files
  • Avoid running thefuck under elevated accounts such as root or service identities
  • Uninstall thefuck on systems where the correction functionality is not required until a patched release is available
bash
# Configuration example: restrict thefuck rule directory permissions
chmod 700 ~/.config/thefuck
chmod 700 ~/.config/thefuck/rules 2>/dev/null || true
find ~/.config/thefuck -type f -name '*.py' -exec ls -l {} \;

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.