Developing a Rust implementation of zlib Project

The ISRG (Internet Security Research Group) organization, which is the founder of the Let's Encrypt project and promotes the development of technologies to improve the security of the Internet, presented project zlib-rs on creating a secure analogue of a data compression library zlib. The zlib-rs code is written in Rust and is distributed under the Zlib license. Development is carried out with an eye on the project zlib-ng, which develops a high-performance variant of zlib. The project has developed two libraries: zlib-rs, an implementation of the zlib API that does not use unsafe blocks; libz-rs-sys is a plugin with C API support that contains code in “unsafe” mode.

The reason for creating zlib-rs is said to be to provide a version of zlib that avoids potential breakdowns caused by memory errors. According to companies Microsoft and Google, about 70% of vulnerabilities are caused by insecure memory handling. It is expected that using the Rust language to develop zlib-rs will reduce the risk of vulnerabilities caused by unsafe work with memory, and eliminate the occurrence of errors such as accessing a memory area after it has been freed and overrunning the buffer.

The Zlib library is widely distributed and used as a dependency on many systems, although Zlib code occasionally pop up dangerous vulnerabilities. For example, in 2022, a buffer overflow was discovered in zlib when attempting to compress a specially prepared sequence of characters, which made it possible to exploit the vulnerability through the transmission of specially formatted incoming data.

Thanks for reading: