Dev

Enhanced AF_ALG Restrictions with New sysctl Introduced in Linux 7.3

Following its deprecation in Linux 7.2, the AF_ALG interface in the Linux kernel will see stricter restrictions in version 7.3 with a new `af_alg_restrict` sysctl parameter, featuring three levels of control to mitigate security risks.

6 min read Reviewed & edited by the SINGULISM Editorial Team

Enhanced AF_ALG Restrictions with New sysctl Introduced in Linux 7.3
Photo by FlyD on Unsplash

The AF_ALG interface, which allows direct user-space manipulation of the Linux kernel’s cryptographic API, has long been criticized for exposing significant security vulnerabilities. In the upcoming Linux 7.3 release, stricter restrictions on AF_ALG will be implemented through the introduction of a new sysctl parameter called af_alg_restrict. This measure follows its deprecation in Linux 7.2 and aims to further address the associated risks.

Proposed by Google Linux cryptography expert Eric Biggers, the af_alg_restrict parameter enables three levels of control over the AF_ALG functionality. The change is part of a broader move to phase out AF_ALG and mitigate its potential for exploitation.

AF_ALG has historically enabled applications to directly invoke cryptographic processes in the kernel. However, Biggers described the interface as a “frequent source of vulnerabilities and a maintenance nightmare” in his patch notes. A particular concern is the accessibility of kernel implementation details, such as the “authencesn” feature, from user space.

The Reality of Frequent Vulnerabilities

The AF_ALG interface was initially designed to allow user-space programs to interact directly with the Linux kernel’s cryptographic API. While its convenience was acknowledged, Biggers noted that it has led to the widespread exposure of functionalities that were never meant to be accessible to non-privileged processes.

Recent exploits have increasingly targeted kernel implementation details that offer little practical utility when accessed from user space. Consequently, AF_ALG has been consistently abused as an entry point for such attacks.

According to Phoronix, this interface represents a “massive attack surface,” with numerous security vulnerabilities reported over time.

Details of af_alg_restrict

The new sysctl parameter, af_alg_restrict, will be implemented under /proc/sys/crypto/af_alg_restrict in the kernel. This parameter can be configured at three levels:

  • 0: No restrictions (legacy behavior).
  • 1: Limited functionality (default setting).
  • 2: Fully disabled.

With the default value of “1,” a restricted list of permissible algorithms will apply to non-privileged processes. Privileged processes will be granted access to a slightly broader list, but full access will not be allowed.

While this permission list may be adjusted in the future, it has been carefully designed to ensure that commonly used services like iwd (Intel Wireless Daemon) and bluez (Bluetooth stack) operate correctly. Biggers has confirmed that “AF_ALG functions properly with iwd.”

The “2” setting completely disables AF_ALG, making it suitable for environments demanding maximum security. On the other hand, users who rely on AF_ALG for specific applications can maintain legacy behavior by setting the parameter to “0.”

Privilege and Algorithm Segmentation

A key design feature of af_alg_restrict is the segmentation of accessible algorithm lists based on the presence or absence of privileges. The kernel’s cryptographic API primarily serves drivers and file systems operating in the kernel space, with user-space access being a secondary consideration.

Biggers emphasized that “user-space cryptographic libraries already exist, and AF_ALG is rarely used in practice.” Even in cases where AF_ALG is utilized, such as with iwd, it is typically employed by processes that hold CAP_NET_ADMIN capability and are restricted to a known list of algorithms.

This targeted restriction has been broadly welcomed by security researchers and Linux distribution maintainers. However, companies and organizations that have developed custom applications reliant on AF_ALG will need to revise their migration plans.

Software Impacted

The most well-known use case for AF_ALG is Intel’s wireless daemon “iwd,” which directly utilizes the kernel’s cryptographic API for network management functions. The functionality of iwd is ensured under the default restriction level of “1.”

Similarly, the Bluetooth stack bluez also relies on AF_ALG. These essential system components are confirmed to operate without issues under the default settings.

However, user-space cryptographic libraries like OpenSSL, GnuTLS, and libsodium implement their own cryptographic solutions and do not depend on AF_ALG. Most applications using these libraries are unlikely to be affected.

The environments most likely to be impacted are those using specialized hardware encryption accelerators accessed via AF_ALG or custom-developed applications reliant on kernel cryptographic primitives. In such cases, administrators may need to adjust the af_alg_restrict setting to “0” or modify the applications accordingly.

The Future of Kernel Development

The tightening of restrictions on AF_ALG is part of a broader initiative to enhance security across the Linux kernel. Recent kernel updates have focused on both performance optimization—such as the Linux Cache Aware Scheduling improvements for MySQL optimization—and security enhancements.

Since its deprecation in Linux 7.2, some AF_ALG functionalities have already been removed. With the introduction of af_alg_restrict in Linux 7.3, it is likely that the default value will be raised to “2” (fully disabled) in the future, and the interface may eventually be removed from the kernel codebase altogether.

Biggers’ patch has already been incorporated into the “cryptodev” Git repository and is expected to be merged during the Linux 7.3 development cycle. Other updates, such as the addition of GPU IDs for Nova Lake S, are also planned for this release.

Practical Steps for Transition

System administrators relying on AF_ALG need to consider the following actions:

  1. Identify Dependencies: Determine which applications use AF_ALG. Use tools like lsof or strace to inspect the state of /proc/sys/crypto/af_alg_restrict.
  2. Evaluate Alternatives: Explore migrating to user-space cryptographic libraries such as OpenSSL, GnuTLS, or NSS, which are independently maintained and regularly audited for security.
  3. Adjust Restriction Levels: If AF_ALG is indispensable, configure af_alg_restrict=0 in settings files (e.g., /etc/sysctl.d/99-afalg.conf) for persistent use.
  4. Conduct Testing: Verify functionality under restriction level “1.” If no issues arise, continue with the default settings. For future-proofing, develop a plan to transition away from AF_ALG.

This change underscores the Linux kernel development community’s shift toward prioritizing security. While AF_ALG was introduced for convenience, it has since become a significant security liability.

Editorial Opinion

In the short term, the introduction of af_alg_restrict in Linux 7.3 will significantly reduce attack vectors via the AF_ALG interface by default. While general users relying on iwd or bluez will experience minimal disruption, developers utilizing custom applications dependent on AF_ALG will need to act swiftly. It is advisable for them to complete dependency audits and plan migrations to alternatives by the 7.3 release in late 2026.

In the long term, the complete removal of AF_ALG seems inevitable. The introduction of this sysctl parameter is a precursor to its eventual deprecation, likely within a few years. This step reflects a tightening of security standards for kernel APIs exposed to user space, which may have implications for other kernel APIs. Industrial and embedded systems relying on direct hardware encryption accelerators are expected to face the most significant challenges.

The editorial team supports the overall security improvements brought about by the stricter regulation of AF_ALG. However, the relatively short timeline from deprecation to removal raises concerns about the adequacy of transition periods for affected stakeholders.

References

  • Phoronix — Published on 2026-07-07T10:24:22.000Z

Frequently Asked Questions

What is the default value for `af_alg_restrict`?
The default value is "1," which applies a restricted list of algorithms to non-privileged processes. Privileged processes are granted access to a slightly broader list, ensuring that key use cases like iwd and bluez function properly.
How can I revert `af_alg_restrict` to disable restrictions (set to 0)?
Write "0" to `/proc/sys/crypto/af_alg_restrict` or add "crypto.af_alg_restrict = 0" to a configuration file under `/etc/sysctl.d/` and execute `sysctl -p` to make the setting persistent.
How can I identify applications that depend on AF_ALG?
Use `lsof /proc/sys/crypto/af_alg_restrict` to check for open file handles or `strace -e socket,open,ioctl` to monitor AF_ALG socket creation. Reviewing kernel audit logs is another effective method.
Source: Phoronix

Comments

← Back to Home