The
OpenBSD operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
focuses on
security and the development of security features. According to author Michael W. Lucas, OpenBSD "is widely regarded as the most secure operating system available anywhere, under any licensing terms."
API and build changes
Bugs and security flaws are often caused by programmer error. A common source of error is the misuse of the
strcpy
and
strcat
string functions in the
C programming language. There are two common alternatives,
strncpy
and
strncat
, but they can also be difficult to understand and easy to misuse, so OpenBSD developers
Todd C. Miller and
Theo de Raadt designed the
strlcpy
and
strlcat
functions. These functions are intended to make it harder for programmers to accidentally leave buffers unterminated or allow them to be overflowed. They have been adopted by the NetBSD and FreeBSD projects but not by the
GNU C Library.
On OpenBSD, the
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
has been changed to issue a warning when
unsafe string manipulation functions, such as
strcpy
,
strcat
, or
sprintf
, are found. All occurrences of these functions in the OpenBSD source tree have been replaced. In addition, a
static bounds checker is included in OpenBSD in an attempt to find other common programming mistakes at compile time. Other security-related
APIs developed by the OpenBSD project include
issetugid
and
arc4random
.
Kernel randomization
In a June 2017 email, Theo de Raadt stated that a problem with stable systems was that they could be running for months at a time. Although there is considerable randomization within the kernel, some key addresses remain the same. The project in progress modifies the
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
so that on every boot, the kernel is relinked, as well as all other randomizations. This differs from kernel
ASLR; in the email he states that "As a result, every new kernel is unique. The relative offsets between functions and data are unique ...
he currentchange is scaffolding to ensure you boot a newly-linked kernel upon every reboot ... so that a new random kernel can be linked together ... On a fast machine it takes less than a second ... A reboot runs the new kernel, and yet another kernel is built for the next boot. The internal deltas between functions inside the kernel are not where an attacker expects them to be, so he'll need better info leaks".
Memory protection
OpenBSD integrates several technologies to help protect the operating system from attacks such as
buffer overflows or
integer overflows.
Developed by Hiroaki Etoh,
ProPolice is a
GCC extension designed to protect applications from
stack-smashing attacks. It does this through a number of operations: local stack variables are reordered to place buffers after pointers, protecting them from corruption in case of a buffer overflow; pointers from function arguments are also placed before local buffers; and a
canary value is placed after local buffers which, when the function exits, can sometimes be used to detect buffer overflows. ProPolice chooses whether or not to protect a buffer based on automatic heuristics which judge how vulnerable it is, reducing the performance overhead of the protection. It was integrated in OpenBSD's version GCC in December 2002, and first made available in OpenBSD 3.3; it was applied to the kernel in release 3.4. The extension works on all the CPU architectures supported by OpenBSD and is enabled by default, so any C code compiled will be protected without user intervention.
In May 2004, OpenBSD on the
SPARC platform received further stack protection in the form of
StackGhost. This makes use of features of the SPARC architecture to help prevent exploitation of buffer overflows. Support for SPARC64 was added to in March 2005.
OpenBSD 3.4 introduced
W^X, a memory management scheme to ensure that memory is either writable or executable, but never both, which provides another layer of protection against buffer overflows. While this is relatively easy to implement on a platform like
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit extension of the x86 instruction set architecture, instruction set. It was announced in 1999 and first available in the AMD Opteron family in 2003. It introduces two new ope ...
, which has hardware support for the
NX bit, OpenBSD is one of the few OSes to support this on the generic i386 platform, which lacks built in per-page execute controls.
During the development cycle of the 3.8 release, changes were made to the
malloc
memory management functions. In traditional Unix operating systems,
malloc
allocates more memory by extending the Unix data segment, a practice that has made it difficult to implement strong protection against security problems. The
malloc
implementation now in OpenBSD makes use of the
mmap
system call, which was modified so that it returns random memory addresses and ensures that different areas are not mapped next to each other. In addition, allocation of small blocks in shared areas are now randomized and the
free
function was changed to return memory to the kernel immediately rather than leaving it mapped into the process. A number of additional, optional checks were also added to aid in development. These features make program bugs easier to detect and harder to exploit: instead of memory being corrupted or an invalid access being ignored, they often result in a
segmentation fault and abortion of the process. This has brought to light several issues with software running on OpenBSD 3.8, particularly with programs reading beyond the start or end of a buffer, a type of bug that would previously not be detected directly but can now cause an error. These abilities took more than three years to implement without considerable performance loss.
Cryptography and randomization
One of the goals of the OpenBSD project is the integration of facilities and software for
strong cryptography into the core operating system. To this end, a number of low-level features are provided, including a source of strong
pseudo random numbers; built-in
cryptographic hash functions and transforms; and support for cryptographic hardware (
OpenBSD Cryptographic Framework). These abilities are used throughout OpenBSD, including the
bcrypt password-hashing algorithm derived from
Bruce Schneier
Bruce Schneier (; born January 15, 1963) is an American cryptographer, computer security professional, privacy specialist, and writer. Schneier is an Adjunct Lecturer in Public Policy at the Harvard Kennedy School and a Fellow at the Berkman ...
's
Blowfish block cipher, which takes advantage of the CPU-intensive Blowfish
key schedule
In cryptography, the so-called product ciphers are a certain kind of cipher, where the (de-)ciphering of data is typically done as an iteration of '' rounds''. The setup for each round is generally the same, except for round-specific fixed va ...
, making
brute-force attacks less practical.
In OpenBSD 5.3, support for
full disk encryption was introduced, but enabling it during the installation of OpenBSD had required manual intervention from the user by exiting the installer and entering some commands. Starting from OpenBSD 7.3, the installer supports enabling full disk encryption using a guided procedure, not requiring manual intervention anymore.
To protect sensitive information such as
password
A password, sometimes called a passcode, is secret data, typically a string of characters, usually used to confirm a user's identity. Traditionally, passwords were expected to be memorized, but the large number of password-protected services t ...
s from leaking on to disk, where they can persist for many years, OpenBSD supports encryption of swap space. The swap space is split up into many small regions that are each assigned their own encryption key, which is generated randomly and automatically with no input from the user, held entirely in memory, and never written to disk except when
hibernating; as soon as the data in a region is no longer required, OpenBSD discards its encryption key, effectively transforming the data in that region into useless garbage. Toggling this feature can be done using a single ''sysctl'' configuration option, and doesn't require any prior setup, disk partitioning, or partition-related settings to be done/changed; furthermore, there is no choice of encryption parameters (such as the algorithm or key length to use), as strong parameters are always used. There is no harm and no loss of functionality with this feature, because the encryption keys used to access swapped processes are only lost when the computer crashes (e.g. power loss), after which all operating systems discard the previous contents of the memory and swap anyway, and because
hibernation continues to work as usual with this feature. This feature is enabled by default in OpenBSD 3.8 (released in November 2005) and later; OpenBSD, as of 2022, remains the only prominent operating system to have swap encrypted by default independently of disk encryption and its user-provided password. (
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
requires toggling a configuration setting that is not presented in its user-facing ''Control Panel'' and ''Settings'' apps, and other operating systems, including
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
,
FreeBSD, and every
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
-based operating system, rely on the existing disk encryption features to encrypt the swap, which often (a) need to be enabled by the user manually, (b) require setup (if disk encryption wasn't chosen during the operating system's installation) which is not as trivial to do as toggling swap encryption on OpenBSD, and (c) use the user-provided password, which users need to remember and could be weak/guessable or even extracted out of the users.)
The
network stack also makes heavy use of randomization to increase security and reduce the predictability of various values that may be of use to an attacker, including
TCP initial sequence numbers and timestamps, and ephemeral source ports. A number of features to increase network resilience and availability, including countermeasures for problems with
ICMP and software for redundancy, such as
CARP
The term carp (: carp) is a generic common name for numerous species of freshwater fish from the family (biology), family Cyprinidae, a very large clade of ray-finned fish mostly native to Eurasia. While carp are prized game fish, quarries and a ...
and
pfsync, are also included. The project was the first to disable the plain-text
telnet daemon in favor of the encrypted
SSH daemon, in 1999, and features other integrated cryptographic software such as
IPsec. The telnet daemon was completely removed from OpenBSD in 2005 before the release of OpenBSD version 3.8.
Signify
The OpenBSD project had invented their own utility for cryptographic signing and verification of files,
signify
,
instead of using existing standards and software such as
OpenPGP and
GnuPG. The creator of the
signify
utility, Ted Unangst, wrote in 2015, speaking of
OpenPGP and
GnuPG: ''"The concerns I had using an existing tool were complexity, quality, and complexity."''
This is in line with the project's longtime tendency to reduce complexity, and
in turn, reduce the probability of vulnerabilities existing in the software, and help the user understand the software better and make more security-educated decisions.
signify
is integrated into the base operating system and used for verification of all releases, patches, and packages starting with OpenBSD 5.5. In contrast, other
Free Software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
operating systems and security-focused software tend to use
OpenPGP for release verification, and as of 2022 continue to do so, including:
Debian
Debian () is a free and open-source software, free and open source Linux distribution, developed by the Debian Project, which was established by Ian Murdock in August 1993. Debian is one of the oldest operating systems based on the Linux kerne ...
, a prominent operating system that's also used as a base for other operating systems, including
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed primarily of free and open-source software. Developed by the British company Canonical (company), Canonical and a community of contributors under a Meritocracy, meritocratic gover ...
;
Kali Linux, a specialized operating system for
penetration testing, security research,
digital forensics, and
reverse engineering
Reverse engineering (also known as backwards engineering or back engineering) is a process or method through which one attempts to understand through deductive reasoning how a previously made device, process, system, or piece of software accompl ...
;
Qubes OS, a security-focused operating system;
Tor Browser, an anonymous Web browser;
SecureDrop, a software package for journalists and whistleblowers to exchange information securely and anonymously over the Internet; and
VeraCrypt, a software program for
on-the-fly encryption and
full disk encryption.
X11
In X11 on OpenBSD, neither the X server nor X clients normally have any escalated direct memory or hardware privileges: When driving X with the Intel(4) or Radeon(4) drivers, these normally interact with the underlying hardware via the Direct Rendering Management(4) kernel interface only, so that lowlevel memory/hardware access is handled solely by the kernel. Other drivers such as WSFB follow a similar pattern. For this reason, X11 on OpenBSD does not open up lowlevel memory or hardware access to user/root programs as is done on some other systems, and as was done in the past, which then needed the user to escalate the machdep.allowaperture setting from its default zero setting, to an unsecure setting.
OpenBSD's version of the
X Window System
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
(named
Xenocara) has some security modifications. The
server and some of the default applications are patched to make use of
privilege separation
Privilege may refer to:
Arts and entertainment
* Privilege (film), ''Privilege'' (film), a 1967 film directed by Peter Watkins
* Privilege (Ivor Cutler album), ''Privilege'' (Ivor Cutler album), 1983
* Privilege (Television Personalities album ...
, and OpenBSD provides an "aperture" driver to limit X's access to memory. However, after work on X security flaws by Loïc Duflot, Theo de Raadt commented that the aperture driver was merely "the best we can do" and that X "violates all the security models you will hear of in a university class." He went on to castigate X developers for "taking their time at solving this > 10-year-old problem." On November 29, 2006, a
VESA
VESA (), formally known as Video Electronics Standards Association, is an American standards organization, technical standards organization for computer display standards. The organization was incorporated in California in July 1989To retrieve ...
kernel driver was developed that permitted X to run, albeit more slowly, without the use of the aperture driver.
On February 15, 2014, X was further modified to allow it to run without root privileges.
After the discovery of a security vulnerability in X, OpenBSD doesn't support the running of X as a root user and only supports running X via a display manager as a dedicated
_x11
user.
Other features
Privilege separation
Privilege may refer to:
Arts and entertainment
* Privilege (film), ''Privilege'' (film), a 1967 film directed by Peter Watkins
* Privilege (Ivor Cutler album), ''Privilege'' (Ivor Cutler album), 1983
* Privilege (Television Personalities album ...
,
privilege revocation,
chroot
chroot is a shell (computer), shell command (computing), command and a system call on Unix and Unix-like operating systems that changes the apparent root directory for the current running process and its Child process, children. A program that i ...
ing and randomized loading of libraries also play a role in increasing the security of the system. Many of these have been applied to the OpenBSD versions of common programs such as
tcpdump and
Apache, and to the
BSD Authentication system.
OpenBSD has a history of providing its users with
full disclosure in relation to various bugs and security breaches detected by the OpenBSD team. This is exemplified by
the project's slogan: "Only two remote holes in the default install, in a heck of a long time!"
OpenBSD is intended to be secure by default, which includes (but is not limited to) having all non-essential services be disabled by default. This is done not only to not require users to learn how and waste time to secure their computers after installing OpenBSD, but also in hope of making users more aware of security considerations, by requiring them to make conscious decisions to enable features that could reduce their security.
OpenBSD 5.9 included support for the then–new
pledge
system call (introduced in OpenBSD 5.8 as
tame
and renamed in 5.9 to
pledge
) for restricting process capabilities to a minimal subset required for correct operation. If the process is compromised and attempts to perform an unintended behavior, it will be terminated by the kernel. OpenBSD 6.4 introduced the
unveil
system call for restricting
filesystem visibility to a minimum level.
pledge
and
unveil
are used together to confine applications, further limiting what they're otherwise permitted to do under the user account they're running as. Since the introduction of
pledge
, base OpenBSD programs (included
out of the box in OpenBSD), applications (handled by their developers), and ports (of applications, handled by the OpenBSD team) have been updated to be confined with
pledge
and/or
unveil
. Some examples of third-party applications updated with these features (by their developers or in OpenBSD's app ports) include the
Chromium
Chromium is a chemical element; it has Symbol (chemistry), symbol Cr and atomic number 24. It is the first element in Group 6 element, group 6. It is a steely-grey, Luster (mineralogy), lustrous, hard, and brittle transition metal.
Chromium ...
and
Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements curr ...
web browser
A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
s.
References
External links
Exploit Mitigation Techniques: an Update After 10 Years
*
Theo de Raadt's email about secure programming
On the matter of strlcpy/strlcat acceptance by industry
{{OpenBSD
Security
Operating system security
Embedded operating systems
OpenBSD