@@ -2254,42 +2254,44 @@ func ValidateCollectWindowsLogsScript(ctx context.Context, s *Scenario) {
22542254 "collect-windows-logs.ps1 failed or did not produce a zip file" )
22552255}
22562256
2257- // ValidateAlgifAeadMitigation verifies CVE-2026-31431 mitigation is active:
2258- // the algif_aead kernel module must be blocked via modprobe config, not loaded,
2259- // and modprobe must refuse to load it.
2260- func ValidateAlgifAeadMitigation (ctx context.Context , s * Scenario ) {
2257+ // ValidateVulnerableKernelModulesDisabled verifies that kernel modules with known
2258+ // LPE vulnerabilities are blocked via modprobe config, not loaded, and cannot be loaded.
2259+ // Covers: CVE-2026-31431 (algif_aead), DirtyFrag (esp4, esp6, rxrpc).
2260+ // To add a new CVE mitigation, append the module name to the list below.
2261+ func ValidateVulnerableKernelModulesDisabled (ctx context.Context , s * Scenario ) {
22612262 s .T .Helper ()
22622263
2263- // Flatcar uses a different kernel module setup
22642264 if s .VHD .Flatcar {
2265- s .T .Log ("Skipping algif_aead validation: not applicable for Flatcar" )
2265+ s .T .Log ("Skipping vulnerable kernel module validation: not applicable for Flatcar" )
22662266 return
22672267 }
22682268
22692269 script := strings .Join ([]string {
2270- `# Check modprobe config blocks the module` ,
2271- `if ! grep -qs 'install algif_aead /bin/false' /etc/modprobe.d/*.conf 2>/dev/null; then` ,
2272- ` echo "FAIL: algif_aead disable rule not found in /etc/modprobe.d/*.conf"` ,
2273- ` exit 1` ,
2274- `fi` ,
2275- `echo "PASS: modprobe config blocks algif_aead"` ,
2276- `` ,
2277- `# Check module is not loaded` ,
2278- `if grep -qE '^algif_aead ' /proc/modules 2>/dev/null; then` ,
2279- ` echo "FAIL: algif_aead module is loaded"` ,
2280- ` exit 1` ,
2281- `fi` ,
2282- `echo "PASS: algif_aead module is not loaded"` ,
2283- `` ,
2284- `# Check modprobe refuses to load it` ,
2285- `if sudo modprobe algif_aead 2>/dev/null; then` ,
2286- ` echo "FAIL: modprobe algif_aead succeeded, should be blocked"` ,
2287- ` sudo rmmod algif_aead 2>/dev/null || true` ,
2288- ` exit 1` ,
2289- `fi` ,
2290- `echo "PASS: modprobe algif_aead correctly refused"` ,
2270+ `failed=0` ,
2271+ `for mod in algif_aead esp4 esp6 rxrpc; do` ,
2272+ ` if ! grep -qsE "^install ${mod} /bin/false" /etc/modprobe.d/*.conf 2>/dev/null; then` ,
2273+ ` echo "FAIL: ${mod} disable rule not found in /etc/modprobe.d/*.conf"` ,
2274+ ` failed=1` ,
2275+ ` else` ,
2276+ ` echo "PASS: modprobe config blocks ${mod}"` ,
2277+ ` fi` ,
2278+ ` if grep -qE "^${mod} " /proc/modules 2>/dev/null; then` ,
2279+ ` echo "FAIL: ${mod} module is loaded"` ,
2280+ ` failed=1` ,
2281+ ` else` ,
2282+ ` echo "PASS: ${mod} module is not loaded"` ,
2283+ ` fi` ,
2284+ ` if sudo modprobe "${mod}" 2>/dev/null; then` ,
2285+ ` echo "FAIL: modprobe ${mod} succeeded, should be blocked"` ,
2286+ ` sudo modprobe -r "${mod}" 2>/dev/null || true` ,
2287+ ` failed=1` ,
2288+ ` else` ,
2289+ ` echo "PASS: modprobe ${mod} correctly refused"` ,
2290+ ` fi` ,
2291+ `done` ,
2292+ `exit $failed` ,
22912293 }, "\n " )
22922294
22932295 execScriptOnVMForScenarioValidateExitCode (ctx , s , script , 0 ,
2294- "CVE-2026-31431 (algif_aead) mitigation validation failed" )
2296+ "Vulnerable kernel module mitigation validation failed (algif_aead/esp4/esp6/rxrpc) " )
22952297}
0 commit comments