The implementation of sudo and su in Rust is intended to improve security in these utilities.
Three months ago, we shared here on the blog the news of the creation of the "Sudo-rs" project by the ISRG, which is the founder of the Let's Encrypt project and promotes the development of technologies to increase Internet security.
In that publication we shared some of the details and characteristics of the project, which basically aim to create implementations of the SUDO and SU utilities in Rust (you can consult the publication at the following link ).
First stable version of sudo-rs
The reason for mentioning this is that the first stable version of the Sudo-rs project was recently launched , in which engineers from Ferrous Systems and Tweede Golf participated in the development with funding provided by Google, Cisco and Amazon Web Services.
For those unfamiliar with the "Sudo-rs" project, I can tell you that its purpose is to develop Rust versions of the SUDO and SU utilities, designed to execute commands on behalf of other users, since SUDO is a console utility in Unix-like operating systems to execute commands with the privileges of another user, by default the root superuser.
The `sudo` and `su` functions, in `sudo-rs`, were written from scratch in Rust, a language that is increasingly used and recommended in the industry, as it has become one of the main languages ​​for Android and even has support for it as a secondary programming language in the Linux kernel. Microsoft, for its part, has also mentioned on several occasions its intention to rewrite the kernel and some of the Windows libraries it contains.
It is mentioned that the utilities are compatible with the classic SUDO and SU utilities whenever possible, allowing sudo-rs to be used as a transparent replacement for SUDO in typical scenarios that match the default /etc/sudoers configuration in Ubuntu and Debian. Sudo-rs has already been implemented in place of the traditional SUDO package in the Wolfi Linux distribution, with the aim of providing the highest level of security.
The use of the Rust language for the development of SU and SUDO is supposed to reduce the risk of vulnerabilities caused by unsafe memory handling and eliminate the occurrence of errors such as accessing a memory area after it has been freed and running out of memory at buffer boundaries.
Furthermore, to ensure the appropriate level of security, the project has developed an expanded suite of tests , which also allows for monitoring the maintenance of the required level of compatibility with the original sudo utility. To reduce the attack surface and the number of potential vulnerabilities in sudo-rs, it was decided to abandon the implementation of the rarely used sudo functionality.
Among the differences with SUDO , it is mentioned that the default use_pty mode is included, among the fundamentally unimplemented features are mail_badpass, as well as compatibility with sendmail, while the features that have not yet been implemented, but will be added in the future: sudoedit utility, NOEXEC and NOINTERCEPT modes, support for linking "default" configuration blocks to individual users and commands, the ability to authenticate without using PAM.
It is worth mentioning that in this month of September, it is expected to be able to confirm the quality of the implementation and that an independent audit of the sudo-rs code base is also planned.
In addition, it is mentioned that the second version is planned to add tools for working in multi-user environments , such as NOEXEC mode, audit logs, the ability for sudoers to map hosts, and support for up to 16 user groups. The third version is planned to be compatible with the sudoers configuration used in Fedora, and will also add the sudoedit utility and utilize SELinux and AppArmor mechanisms to enhance security.
Finally , if you are interested in learning more about this , you can find the details at the following link.