Exploit database

GH-0b0dc07be547d95c4326d06b71a40f6e

0xcyberstan/cve-2026-31694-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-31694

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files6
0xcyberstan/cve-2026-31694-pocRevision 08e4cd6cc946

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

vm/build_vuln_kernel.sh

Shell · 1,612 bytes
#!/bin/bash
# Build a bzImage with the vulnerable fs/fuse/readdir.c (no reclen > PAGE_SIZE
# guard) from $KERNEL_TREE. If the tree has the fix, the guard is removed for
# the build and the file is restored afterwards. The git index is not touched.
# Output: $BZIMAGE
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; . "$HERE/config.sh"

[ -n "$KERNEL_TREE" ] || { echo "set KERNEL_TREE in vm/config.sh"; exit 1; }
[ -d "$KERNEL_TREE" ] || { echo "KERNEL_TREE is not a directory: $KERNEL_TREE"; exit 1; }
cd "$KERNEL_TREE"
F=fs/fuse/readdir.c
[ -f "$F" ] || { echo "no $F under KERNEL_TREE"; exit 1; }

BK="$(mktemp)"; cp "$F" "$BK"
restore() { cp "$BK" "$F"; rm -f "$BK"; }
trap restore EXIT

# Drop the fix guard if present (matches the 'if (reclen > PAGE_SIZE)' line and
# its 'return;'; leaves the unrelated 'offset + reclen > PAGE_SIZE' check alone).
if grep -qE '^[[:space:]]*if \(reclen > PAGE_SIZE\)' "$F"; then
    echo "[*] removing reclen > PAGE_SIZE guard for this build"
    sed -i '/if (reclen > PAGE_SIZE)/{N;/return;/d}' "$F"
fi
grep -qE '^[[:space:]]*if \(reclen > PAGE_SIZE\)' "$F" && { echo "guard still present, aborting"; exit 1; }
echo "[*] readdir.c is the vulnerable version"

echo "[*] configuring (defconfig + fuse/userns/virtio/serial)"
make defconfig
./scripts/config -e FUSE_FS -e USER_NS \
                 -e VIRTIO -e VIRTIO_PCI -e VIRTIO_BLK -e VIRTIO_NET -e HW_RANDOM_VIRTIO \
                 -e EXT4_FS -e SERIAL_8250 -e SERIAL_8250_CONSOLE
make olddefconfig

echo "[*] building"
make -j"$(nproc)"
cp arch/x86/boot/bzImage "$BZIMAGE"
echo "[+] $BZIMAGE"