The security vulnerability is a local privilege escalation in the theshit rust application. It stems from the unsafe loading of user-provided Python rules when the application is run with root privileges. The patch, introduced in version 0.1.1, addresses this by adding strict ownership and permission checks.
The analysis of the commits, specifically 3dc12905cafb5fd47fff4071a05c231f925ac113, reveals the core of the vulnerability. The changes are concentrated in src/fix/python.rs. A new function, check_security, was introduced to verify that the rule files are owned by the effective user ID and are not writable by other users. This function is now called within process_python_rules for each rule before it is processed.
The vulnerable function is identified as theshit::fix::python::process_python_rules. Prior to the patch, this function would iterate through rule paths and load them without any security validation. This meant that if a local user created a malicious Python script and theshit was run as root, the script would be executed with root privileges. The introduction of the check_security call directly within this function in the patch is clear evidence that this is where the vulnerability was located. During exploitation, a profiler would show theshit::fix::python::process_python_rules in the stack trace as it processes the malicious rule file.