Skip to content

theshit's Improper Privilege Dropping Allows Local Privilege Escalation via Command Re-execution

High severity GitHub Reviewed Published Feb 28, 2026 in AsfhtgkDavid/theshit • Updated Mar 2, 2026

Package

cargo theshit (Rust)

Affected versions

< 0.2.0

Patched versions

0.2.0

Description

Impact

Vulnerability Type: Local Privilege Escalation (LPE) / Improper Privilege Management / Arbitrary Command Execution.

The application automatically re-executes the previously failed command but does not properly drop elevated privileges during this process.

When the tool is executed with sudo or otherwise runs with an effective UID of root, it records the last executed command and attempts to rerun it. However, the application fails to restore the original unprivileged user context before re-executing the command. As a result, the retried command is executed with root privileges, even if the original command was issued by an unprivileged user.

This allows a local attacker to intentionally trigger a failed command under elevated execution and gain arbitrary command execution as root via the retry mechanism.

Who is impacted:
Any system where this tool is executed with elevated privileges is affected. The risk is especially high in environments where the tool is permitted to run via sudo, including configurations with NOPASSWD, as an unprivileged user can escalate privileges to root without additional interaction.

Proof of Concept

To verify the vulnerability without a shell, attempt to create a file in a root-protected directory.

1. Verify the file does not exist

sudo ls /root/proof_of_lpe
# Output: No such file or directory

2. Run the vulnerable command

sudo bash -c "SH_PREV_CMD='touch /root/proof_of_lpe' target/release/theshit fix"

3. Check if the file was created by root

sudo ls -l /root/proof_of_lpe

Expected Result:
The command succeeds silently, and the file /root/proof_of_lpe is created, confirming arbitrary command execution with root privileges.

Patches

The issue has been fixed in version 0.1.2.

The patch ensures that privilege levels are correctly handled during command re-execution. Before retrying any previously executed command, the application now explicitly resets the effective UID and GID to the original invoking user.

Workarounds

If upgrading is not possible, users should avoid executing the application with sudo or as the root user.

As a temporary mitigation, administrators should restrict the use of the tool in privileged contexts and ensure it is not included in sudoers configurations, particularly with NOPASSWD. Running the tool strictly as an unprivileged user prevents exploitation of the retry mechanism.

References

  • Commit fixing the issue
  • CWE-269: Improper Privilege Management
  • CWE-273: Improper Check for Dropped Privileges
  • CWE-250: Execution with Unnecessary Privileges

References

@AsfhtgkDavid AsfhtgkDavid published to AsfhtgkDavid/theshit Feb 28, 2026
Published to the GitHub Advisory Database Mar 2, 2026
Reviewed Mar 2, 2026
Published by the National Vulnerability Database Mar 2, 2026
Last updated Mar 2, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(4th percentile)

Weaknesses

Execution with Unnecessary Privileges

The product performs an operation at a privilege level that is higher than the minimum level required, which creates new weaknesses or amplifies the consequences of other weaknesses. Learn more on MITRE.

Improper Privilege Management

The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. Learn more on MITRE.

Improper Check for Dropped Privileges

The product attempts to drop privileges but does not check or incorrectly checks to see if the drop succeeded. Learn more on MITRE.

CVE ID

CVE-2026-21882

GHSA ID

GHSA-2j3p-gqw5-g59j

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.