Skip to content

apparmor: Deny AF_ALG sockets in default container profile#22

Open
vvoland wants to merge 1 commit intomoby:mainfrom
vvoland:fix-socketcall
Open

apparmor: Deny AF_ALG sockets in default container profile#22
vvoland wants to merge 1 commit intomoby:mainfrom
vvoland:fix-socketcall

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented May 5, 2026

apparmor: Deny AF_ALG sockets in default container profile

The AF_ALG address family exposes the Linux kernel crypto API to userspace via sockets. This has been a source of container escape vulnerabilities (see https://copy.fail/).

Unlike seccomp, which can only filter arguments of the direct socket(2) syscall, AppArmor hooks into the kernel's security_socket_create() LSM callback, which fires regardless of the syscall entry point. This means AppArmor also blocks AF_ALG sockets created via the legacy socketcall(2) multiplexer (used by 32-bit binaries), which seccomp cannot inspect because the address family is behind a userspace pointer that BPF cannot dereference.

The "deny network alg," rule is placed right after the blanket
"network," allow rule so the deny takes precedence for this specific address family.

The AF_ALG address family exposes the Linux kernel crypto API to
userspace via sockets. This has been a source of container escape
vulnerabilities (see https://copy.fail/).

Unlike seccomp, which can only filter arguments of the direct socket(2)
syscall, AppArmor hooks into the kernel's security_socket_create() LSM
callback, which fires regardless of the syscall entry point.
This means AppArmor also blocks AF_ALG sockets created via the legacy
socketcall(2) multiplexer (used by 32-bit binaries), which seccomp
cannot inspect because the address family is behind a userspace pointer
that BPF cannot dereference.

The "deny network alg," rule is placed right after the blanket
"network," allow rule so the deny takes precedence for this specific
address family.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland self-assigned this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants