A formally verified drop-in replacement for sudo written in Lean 4.
Project details
lean-sudo offers a secure and reliable alternative to the traditional sudo, leveraging Lean 4's formal verification to ensure that security policies and authentication logic are correct. This drop-in replacement maintains full compatibility with existing sudoers files and system behaviors, aiming to eliminate the vulnerabilities associated with conventional implementations.
lean-sudo is a reimagined and secure version of the widely-used sudo, implemented in Lean 4. This drop-in replacement leverages formal verification to ensure the integrity of its policy, environment, and authentication logic—providing enhanced security guarantees that traditional C implementations cannot fully achieve.
The core function of sudo is to grant users the ability to execute commands with elevated privileges, but the original implementation has been plagued by a history of security vulnerabilities. lean-sudo addresses these concerns by transforming security decisions into verifiable theorems, promoting a trust model where correctness is mathematically proven rather than merely assumed through manual code reviews.
lean-sudo integrates seamlessly with the existing configuration files (/etc/sudoers, /etc/sudoers.d, and /etc/sudo.conf), ensuring a smooth transition for users and administrators familiar with the traditional sudo application.sudo, including prompts, system messages, and logging functionalities. This familiarity means no steep learning curve for users transitioning to lean-sudo from sudo.The architecture of lean-sudo comprises two main components:
LeanSudo.Core.decide, is the heart of the security logic. It ensures that commands are executed only when explicitly allowed by the policy.lean-sudo specifically enhances security through:
lean-sudo ensures that its operations are conducted in a safe environment using the Lean programming language.root user through unintended means) are denied before execution can occur.lean-sudo ceases to function, preventing potential misconfigurations from leading to security holes.Using lean-sudo is intuitive for existing sudo users, as the basic commands are unchanged:
$ sudo -l
Matching Defaults entries for alice on host:
env_reset, mail_badpass, secure_path=…, use_pty
User alice may run the following commands on host:
(ALL : ALL) ALL
$ sudo id -u
[sudo] password for alice:
0
The implementation of lean-sudo has undergone extensive testing against the original sudo, ensuring behavioral consistency. Verification through integration tests confirms that lean-sudo meets or exceeds the security and performance benchmarks set by its predecessor.
For anyone concerned with security in their systems, especially when considering the growing risks associated with privilege escalation, lean-sudo provides a compelling alternative that combines ease of use with the highest standards of security afforded by formal verification.
In summary, lean-sudo transforms privilege management in Linux environments into a domain where correctness is guaranteed, ushering in a new standard in secure software design.
Comments
0Start the conversation
Share the first comment.