#!/usr/bin/env -S stap -g -m CVE_2026_31431 global cve_name = "CVE-2026-31431" // Work around CVE-2026-31431 by blocking the af_alg_sendmsg function // that lets the kernel process messages to the af_alg subsystem, by // overwriting the incoming $size parameter. It considers each attempt // to send messages to this subsystem as a "hit" - i.e., suspect. // // Run with stap -G kill_p=1 in order to kill processes attempting this. global kill_p = 1 probe kernel.function("af_alg_sendmsg").call if(cve_enabled_p) { cve_count_metric("hit") if (cve_notify_p) printf("cve-2026-31431 bandaid %s[%d] %d kill?%d fix?%d\n", execname(), tid(), $size, kill_p, cve_fix_p) if (kill_p) raise (9); if (cve_fix_p) $size = 0; // on some kernel versions, this is enough even with kill_p=0 } # Take a look at /proc/systemtap/CVE_2026_31431/* for parameters and prometheus metrics