The UNIXv4 code, the first OS with a kernel written in C, has been restored. Vulnerability in UNIXv4.

At the end of last year, during cleaning at the University of Utah's computing center, an archival magnetic tape with the code for the UNIXv4 operating system, developed in 1973 for the PDP-11/45 computer, was found and believed to be lost. UNIXv4 continued the development of the UNIXv3 operating system released a year earlier, which was the first to use the C language and unnamed pipes. A notable feature of UNIXv4 was the rewriting of the kernel from assembly to C language. The UNIXv4 kernel was written by Ken Thompson, while the drivers were created by Dennis Ritchie.

At the end of December 2025, museum staff specializing in the history of computing managed to find the necessary equipment and extract the preserved archive from the tape. The readtape toolkit was used to digitize the recorded analog signal, and efforts developed during the recovery of the Emacs editor archive by James Gosling were employed to decode the archive format.

In addition to the UNIXv4 code, the tape also contained the source code of one of the first compilers for the C language and an interpreter for the SNOBOL language. Later, the UNIXv4 code was cleaned up and published on GitHub in a form suitable for building and running in a PDP-11 simulator. The UNIXv4 code consists of 61 thousand lines, of which 27 thousand are in C, 33 thousand are in assembly for PDP-11, and about a thousand are header files.

The UNIXv4 code, the first OS with a kernel written in C, has been restored. Vulnerability in UNIXv4.

One of the security researchers noted the 'su' utility included with UNIXv4. This utility consisted of less than 50 lines of code, was installed with the setuid-root flag, and allowed the execution of /bin/sh with root permissions when the correct password was entered. The code contained a vulnerability leading to a buffer overflow due to copying the user-input password into a fixed 100-character array without checking the size of the input data.

The issue was commented on by 93-year-old Douglas McIlroy, a member of the original Unix development team at Bell Labs, who proposed the concept of unnamed pipes and created utilities like echo, spell, diff, sort, join, and tr. According to Douglas, prior to the Morris worm in 1988, few paid attention to buffer overflows. Adding checks on the size of manually input data was seen as unnecessary code, and crashing due to overflow was perceived as a clumsy way to handle invalid input. Over time, overflows caused by processing automatically generated strings were addressed, but for manual input, the logic was along the lines of ‘who would need to manually input excessively long strings’.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster