Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
deny-af-alg-bpf — eBPF LSM program that blocks AF_ALG socket creation to mitigate CVE-2026-31431, with userspace daemon logging denied attempts via ring buffer. | Kitploit
Tools/GitHubGitHub/vatson112/deny-af-alg-bpf
Defensive ToolsVulnerability AnalysisSecurity Virtualization
GitHubvatson112/deny-af-alg-bpf

deny-af-alg-bpf

eBPF LSM program that blocks AF_ALG socket creation to mitigate CVE-2026-31431, with userspace daemon logging denied attempts via ring buffer.

View Repository
13 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

deny-af-alg-bpf

Description

BPF LSM program that blocks AF_ALG (Linux kernel crypto API) socket creation and logs all attempts via a ring buffer to userspace.

What it does

  • Attaches to the lsm/socket_create hook
  • Denies any socket(AF_ALG, ...) call with -EPERM
  • Emits structured events (pid, comm) to a BPF ring buffer
  • Userspace daemon reads the ring buffer and logs to stderr (consumed by systemd journal)

Components

Programs

  • deny_af_alg.bpf.c - main block logic, work in bpf (kernel space)
  • deny_af_alg.user.c - userspace program
    • load bpf program
    • connect to exposed ring buffer
    • get info about denied access and log to stdout

Systemd

  • deny-af-alg.service - main service, contains userspace app and bpf program
  • deny-af-alg-bpf.service - legacy service, works via bpftool, dont contains logging

CVE Fix Information

This eBPF program addresses CVE-2026-31431. It resolves the vulnerability by restricted access to crypto socket

Requirements

Need bfp in lsm

root@kitploit:~
#cat /sys/kernel/security/lsm
lockdown,capability,yama,selinux,bpf

Build

Note on vmlinux.h: vmlinux.h generated on build machine.

If you are targeting a different kernel, regenerate it on the target machine before building:

root@kitploit:~
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

Build via makefile

root@kitploit:~
make

Build artifacts are placed in the project root:

FileDescription
deny_af_algUserspace daemon
deny_af_alg.bpf.oCompiled BPF object

Run via command line

root@kitploit:~
sudo ./deny_af_alg

output

root@kitploit:~
Listening for AF_ALG socket create attempts... (Ctrl-C to stop)
BLOCKED pid=12345  comm=python3

Run via systemd

Copy deny-af-alg.service file and binary to target machine.

Run via systemd

root@kitploit:~
systemctl start deny-af-alg.service

Run only bpf prog manual via bpftool

root@kitploit:~
bpftool prog loadall deny_af_alg.bpf.o /sys/fs/bpf/deny_af_alg autoattach

Additional command

Preparation

root@kitploit:~
dnf install -y bpftool libbpf-devel clang llvm kernel-devel

Compile

root@kitploit:~
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
clang -O2 -g -target bpf -D__TARGET_ARCH_x86 -I/usr/include/bpf -c deny_af_alg.bpf.c -o deny_af_alg.bpf.o

Check

root@kitploit:~
bpftool prog list | grep deny_af_alg
sudo cat /sys/kernel/debug/tracing/trace_pipe
Download Tool
deny_af_alg.skel.h
Generated BPF skeleton header
vmlinux.hGenerated linux headers via btf