From b5b656e56f0afa4c1d4ceefc944b705dcf16f89f Mon Sep 17 00:00:00 2001 From: Hasan Basbunar Date: Wed, 4 Nov 2026 22:44:19 +0100 Subject: [PATCH] extras: the CVE-2026-98432 mitigation says what happens to MPTCP on a box mitigated before What the sixth code review of v1.43.0 found in the extra: - On a box mitigated by an earlier version, the dry run still said it would record MPTCP's value, which the install no longer does there, and --uninstall said MPTCP went back to its value before the install, where it put the kernel's default back: both say what they do now (a test that fails on the commit before). - The check's drop-in line had no test: a mutant without it stayed green. It has one now. Co-Authored-By: Claude Opus 5.5 --- extras/cve-2026-98432/setup.sh | 13 ++++++++++--- tests/test_extras_cve_2026_98432.py | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/extras/cve-2026-98432/setup.sh b/extras/cve-2026-98432/setup.sh index bbaa3b6d..07da3fb0 100755 --- a/extras/cve-2026-98432/setup.sh +++ b/extras/cve-2026-98432/setup.sh @@ -69,13 +69,14 @@ case "${1:-}" in --uninstall) # MPTCP as it was before the install, the kernel's default (on) when nothing says: it was forced on (the 4th review) mptcp=$(sed -n 's/^net\.mptcp\.enabled=//p' "$BEFORE" 2>/dev/null | head -1 || true) - case "$mptcp" in 0|1) ;; *) mptcp=1 ;; esac + said="its value before the install" + case "$mptcp" in 0|1) ;; *) mptcp=1; said="the kernel's default (its value before the install was not recorded)" ;; esac sudo systemctl disable --now cve-2026-98432-nft.service 2>/dev/null || true sudo rm -f "$UNIT" "$NFT" "$CONF" "$BEFORE" "$DROPIN" sudo rmdir --ignore-fail-on-non-empty "$(dirname "$DROPIN")" 2>/dev/null || true sudo systemctl daemon-reload sudo sysctl -w "net.mptcp.enabled=$mptcp" >/dev/null - echo "removed $UNIT, $NFT, $CONF and $DROPIN; MPTCP back to $mptcp, its value before the install." + echo "removed $UNIT, $NFT, $CONF and $DROPIN; MPTCP back to $mptcp, $said." echo "Only do this once a fixed kernel runs." exit 0 ;; --dry-run) @@ -83,7 +84,13 @@ case "${1:-}" in echo "would install and enable $UNIT:"; sed 's/^/ /' "$DIR/cve-2026-98432-nft.service" echo "would install $CONF and apply it:"; sed 's/^/ /' "$DIR/99-cve-2026-98432.conf" echo "would install $DROPIN:"; sed 's/^/ /' "$DIR/nftables-cve-2026-98432.conf" - echo "would write MPTCP's value now in $BEFORE, for --uninstall (once: a run again keeps the first)" + if [ -e "$BEFORE" ]; then + echo "would keep MPTCP's value before the install, in $BEFORE, for --uninstall" + elif [ -e "$CONF" ]; then + echo "would record no MPTCP value: the mitigation is in place already, and --uninstall puts the kernel's default back" + else + echo "would write MPTCP's value now in $BEFORE, for --uninstall" + fi echo; echo "now:"; check || true exit 0 ;; "") ;; diff --git a/tests/test_extras_cve_2026_98432.py b/tests/test_extras_cve_2026_98432.py index 6dd37eb6..36624031 100644 --- a/tests/test_extras_cve_2026_98432.py +++ b/tests/test_extras_cve_2026_98432.py @@ -164,6 +164,28 @@ class TheCveExtra(unittest.TestCase): self.assertFalse(drop.exists()) self.assertFalse(drop.parent.exists(), "its directory, empty, stayed") + def test_a_box_already_mitigated_is_told_what_happens_to_mptcp(self): + # its dry run said it would record MPTCP's value, and its removal that MPTCP went back to its value before the + # install, where nothing was recorded and the kernel's default came back (the 6th review of v1.43.0, 2026-11-04) + root, env, run = self._box(mptcp="0") + (root / "etc/sysctl.d/99-cve-2026-98432.conf").write_text("net.mptcp.enabled = 0\n") + p, _ = run("--dry-run") + self.assertIn("would record no MPTCP value", p.stdout) + self.assertNotIn("would write MPTCP's value", p.stdout) + p, _ = run("--uninstall") + self.assertIn("MPTCP back to 1, the kernel's default", p.stdout) + + def test_the_check_wants_the_drop_in(self): + # the drop-in on nftables.service is part of the mitigation: its absence passed the check with no test that + # failed (the 6th review of v1.43.0, 2026-11-04, a mutant without that check line stayed green) + root, env, run = self._box(mptcp="0") + p, _ = run() + self.assertEqual(p.returncode, 0, p.stderr + p.stdout) + (root / "etc/systemd/system/nftables.service.d/cve-2026-98432.conf").unlink() + p, _ = run("--check") + self.assertEqual(p.returncode, 1, p.stdout) + self.assertIn("nftables.service drop-in: MISSING", p.stdout) + def test_a_box_already_mitigated_records_no_mptcp_of_its_own(self): # a run over a mitigation installed before (its sysctls set, MPTCP 0) wrote that 0 as MPTCP's value before the # install, and --uninstall left MPTCP off (the 5th review of v1.43.0, 2026-11-04)