linux/include
Eric Biggers 2f204fe718 crypto: af_alg - Add af_alg_restrict sysctl, defaulting to 1
AF_ALG is a frequent source of vulnerabilities and a maintenance
nightmare.  It exposes far more functionality to userspace than ever
should have been exposed, especially to unprivileged processes.  Recent
exploits have targeted kernel internal implementation details like
"authencesn" that have zero use case for userspace access.

Fortunately, AF_ALG is rarely used in practice, as userspace crypto
libraries exist.  And when it is used, only some functionality is known
to be used, and many users are known to hold capabilities already.
iwd for example requires CAP_NET_ADMIN and has a known algorithm list
(https://lore.kernel.org/linux-crypto/bcbbef00-5881-421b-8892-7be6c04b832d@gmail.com/).

Thus, let's restrict the set of allowed algorithms by default, depending
on the capabilities held.

Add a sysctl /proc/sys/crypto/af_alg_restrict with meaning:

    0: unrestricted
    1: limited functionality
    2: completely disabled

Set the default value to 1, which enables an algorithm allowlist for
unprivileged processes and a slightly longer allowlist for privileged
processes.

Note that the list may be tweaked in the future.  However, the common
use cases such as iwd and bluez are taken into account already.  I've
tested that iwd still works with the default value of 1.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-07-05 13:27:15 +08:00
..
acpi Driver core changes for 7.2-rc1 2026-06-15 12:41:17 +05:30
asm-generic mm.git review status for mm-hotfixes-stable..mm-nonmm-stable 2026-06-21 13:20:19 -07:00
clocksource
crypto crypto: af_alg - Add af_alg_restrict sysctl, defaulting to 1 2026-07-05 13:27:15 +08:00
cxl cxl/region: Introduce devm_cxl_probe_mem() 2026-06-12 13:47:30 -07:00
drm drm fixes for 7.2-rc1 2026-06-26 17:03:48 -07:00
dt-bindings This is all clk driver updates. Mostly new SoC support for 2026-06-25 12:48:57 -07:00
hyperv
keys keys: Pin request_key_auth payload in instantiate paths 2026-06-15 15:19:13 +03:00
kunit linux_kselftest-kunit-7.2-rc1 2026-06-16 16:33:57 +05:30
kvm Merge branch kvm-arm64/vgic-v5-PPI-fixes into kvmarm-master/next 2026-06-12 09:08:31 +01:00
linux crypto: ccp - Introduce SNP_VERIFY_MITIGATION command 2026-07-05 13:25:36 +08:00
math-emu
media media: v4l2-fwnode: Fix subdev owner overwritten in v4l2_async_register_subdev_sensor() 2026-06-05 10:28:03 +03:00
memory
misc
net Including fixes from netfilter and IPsec. 2026-06-25 12:25:36 -07:00
pcmcia
ras
rdma RDMA v7.2 merge window 2026-06-18 08:16:21 -07:00
rv rv: Prevent task migration while handling per-CPU events 2026-06-03 12:33:25 +02:00
scsi
soc This is all clk driver updates. Mostly new SoC support for 2026-06-25 12:48:57 -07:00
sound ASoC: Fixes for v7.2 2026-06-26 07:33:15 +02:00
target
trace This adds support for manual client session reset in CephFS, allowing 2026-06-26 16:15:53 -07:00
uapi Including fixes from netfilter and IPsec. 2026-06-25 12:25:36 -07:00
ufs Merge branch 7.1/scsi-fixes into 7.2/scsi-staging 2026-06-15 21:01:30 -04:00
vdso futex: Provide infrastructure to plug the non contended robust futex unlock race 2026-06-03 11:38:52 +02:00
video
xen xen: constify xsd_errors array 2026-06-08 09:00:06 +02:00
Kbuild