CVE-2025-69257
Description
theshit is a command-line utility that automatically detects and fixes common mistakes in shell commands. Prior to version 0.1.1, the application loads custom Python rules and configuration files from user-writable locations (e.g., ~/.config/theshit/) without validating ownership or permissions when executed with elevated privileges. If the tool is invoked with sudo or otherwise runs with an effective UID of root, it continues to trust configuration files originating from the unprivileged user's environment. This allows a local attacker to inject arbitrary Python code via a malicious rule or configuration file, which is then executed with root privileges. Any system where this tool is executed with elevated privileges is affected. In environments where the tool is permitted to run via sudo without a password (NOPASSWD), a local unprivileged user can escalate privileges to root without additional interaction. The issue has been fixed in version 0.1.1. The patch introduces strict ownership and permission checks for all configuration files and custom rules. The application now enforces that rules are only loaded if they are owned by the effective user executing the tool. When executed with elevated privileges (EUID=0), the application refuses to load any files that are not owned by root or that are writable by non-root users. When executed as a non-root user, it similarly refuses to load rules owned by other users. This prevents both vertical and horizontal privilege escalation via execution of untrusted code. If upgrading is not possible, users should avoid executing the application with sudo or as the root user. As a temporary mitigation, ensure that directories containing custom rules and configuration files are owned by root and are not writable by non-root users. Administrators may also audit existing custom rules before running the tool with elevated privileges.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
theshitcrates.io | < 0.1.1 | 0.1.1 |
Patches
18e0b565e7876Merge commit from fork
3 files changed · +39 −4
Cargo.lock+4 −3 modified@@ -290,9 +290,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libredox" @@ -710,12 +710,13 @@ dependencies = [ [[package]] name = "theshit" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "crossterm", "dirs", "include_dir", + "libc", "pyo3", "regex", "shell-words",
Cargo.toml+2 −1 modified@@ -1,6 +1,6 @@ [package] name = "theshit" -version = "0.1.0" +version = "0.1.1" edition = "2024" license = "MIT" license-file = "LICENSE" @@ -34,6 +34,7 @@ shell-words = "1.1.0" strum = { version = "0.27.1", features = ["derive"] } sysinfo = "0.35.2" regex = "1.11.1" +libc = "0.2.178" [dev-dependencies] tempfile = "3.20.0"
src/fix/python.rs+33 −0 modified@@ -2,8 +2,36 @@ use super::structs::Command; use crossterm::style::Stylize; use pyo3::types::{PyAnyMethods, PyList, PyListMethods}; use pyo3::{PyResult, Python}; +use std::fs; +use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::{Path, PathBuf}; +fn check_security(path: &Path) -> Result<(), String> { + let metadata = fs::metadata(path).map_err(|e| e.to_string())?; + let file_uid = metadata.uid(); + let current_uid = unsafe { libc::geteuid() }; + + if current_uid != file_uid { + return Err(format!( + "{} Running with UID {}, but file '{}' is owned by UID {}. Aborting to prevent privilege escalation.", + "SECURITY ERROR:".red().bold(), + current_uid, + path.display(), + file_uid + )); + } + + if metadata.permissions().mode() & 0o022 == 0 { + return Err(format!( + "{} Python rule '{}' is writable by non-owners. Aborting to prevent privilege escalation.", + "SECURITY ERROR:".red().bold(), + path.display() + )); + } + + Ok(()) +} + pub fn process_python_rules( command: &Command, rule_paths: Vec<PathBuf>, @@ -20,6 +48,11 @@ pub fn process_python_rules( } for rule_path in rule_paths { + if let Err(e) = check_security(&rule_path) { + eprintln!("{}", e); + continue; + } + let module_name = match get_module_name(&module_path, &rule_path) { Some(module_name) => module_name, None => continue,
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-95qg-89c2-w5hjghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-69257ghsaADVISORY
- github.com/AsfhtgkDavid/theshit/commit/8e0b565e7876a83b0e1cfbacb8af39dadfdcc500nvdWEB
- github.com/AsfhtgkDavid/theshit/security/advisories/GHSA-95qg-89c2-w5hjnvdWEB
- rustsec.org/advisories/RUSTSEC-2025-0139.htmlghsaWEB
News mentions
0No linked articles in our index yet.