Exploit databaseDownload repository ZIP
GH-f838dcf62fc9fa430d033ea61489fdd5
wonjj6768/lenovo-tb365fc-ghostlock-cve-2026-43499
Sources for CVE-2026-43499
164 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
wonjj6768/lenovo-tb365fc-ghostlock-cve-2026-43499Revision bc326e03800f
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/vector-tb365.sh
Shell · 13,372 bytes#!/bin/sh
# Start NeoZygisk + Vector on the TB365FC with a live KernelSU root session.
#
# SERIAL=<serial> ./tools/vector-tb365.sh
#
# NEOZYGISK_ZIP=/path/NeoZygisk-v2.4-289-release.zip \
# VECTOR_ZIP=/path/Vector-v2.2-3080-Release.zip \
# SERIAL=<serial> ./tools/vector-tb365.sh
#
# Requires adb and root; downloads missing ZIPs over plain HTTPS with curl.
# Device notes: README.md.
#
# The step that restarts zygote briefly drops adb. Every wait prints progress
# and retries quietly, so a slow step never looks like a hang.
set -eu
DIR="$(cd "$(dirname "$0")/.." && pwd)"
ADB="${ADB:-adb}"
SERIAL="${SERIAL:-}"
DEV=/data/local/tmp
ZPT="$DEV/zygisk-ptrace64" # pushed copy of NeoZygisk's tracer
NEO_ZPT=/data/adb/modules/zygisksu/bin/zygisk-ptrace64
adb_() { if [ -n "$SERIAL" ]; then "$ADB" -s "$SERIAL" "$@"; else "$ADB" "$@"; fi; }
fail() { echo "[!] $*" >&2; exit 1; }
# Git Bash on Windows rewrites /data/... arguments; keep them literal.
export MSYS_NO_PATHCONV=1
hostpath() { if command -v cygpath >/dev/null 2>&1; then cygpath -w "$1"; else printf '%s' "$1"; fi; }
REMOTE_OUT=""; RC=0
sh_rc() { RC=0; _o="$(adb_ shell "$1" 2>/dev/null)" || RC=$?; REMOTE_OUT="$(printf '%s' "$_o" | tr -d '\r')"; }
root_rc() { sh_rc "su -c '$1'"; }
# Run a command on-device as root via the KernelSU `su`. Output-only use, so it
# must not trip `set -e`, and adb's transient "device not found" is silenced.
rootq() { adb_ shell "su -c '$1'" 2>/dev/null || true; }
# Wait for the device to answer again. Prints progress so a slow reconnect does
# not look like a hang, and never blocks indefinitely (unlike wait-for-device).
wait_device() { # $1 = seconds to keep trying (default 60)
_limit="${1:-60}"; _i=0; _next=0
while [ "$_i" -lt "$_limit" ]; do
_s="$(adb_ get-state 2>/dev/null | tr -d '\r' || true)"
if [ "$_s" = "device" ]; then return 0; fi
if [ "$_i" -ge "$_next" ]; then
echo " waiting for the tablet... (${_i}s)"
_next=$((_i + 6))
fi
sleep 3
_i=$((_i + 3))
done
return 1
}
# Retry an adb step across a transient disconnect (quietly).
adb_retry() { # $1 = attempts, $2 = label, rest = command
_n="$1"; _label="$2"; shift 2
_a=1
while [ "$_a" -le "$_n" ]; do
if "$@" 2>/dev/null; then return 0; fi
if [ "$_a" -lt "$_n" ]; then
echo " $_label: retrying (attempt $((_a + 1))/$_n)"
wait_device 60 || true
sleep 2
fi
_a=$((_a + 1))
done
return 1
}
echo "[*] preparing adb"
# Make sure the adb server matches this adb build, so switching between a
# bundled adb and one already on PATH does not cause mid-run hiccups.
"$ADB" start-server >/dev/null 2>&1 || true
echo "[*] device check"
wait_device 90 || fail "device not ready (set SERIAL= if more than one device is attached)"
rootq 'id' | tr -d '\r' | grep -q 'uid=0(root)' || fail "no root session (run ./run.sh + ./ksu/install_ksu.sh first)"
CACHE="$DIR/runlogs/vector-zips"
mkdir -p "$CACHE"
# Print the supplied ZIP path, or fetch the named release asset into CACHE.
#
# Both upstream projects are public, so the assets come over plain HTTPS with no
# account and no GitHub CLI - curl ships inside the bundled PortableGit, so a
# first-time user needs nothing installed. Because an unauthenticated fetch is
# authenticated by nothing, the expected sha256 below is what actually establishes
# the bytes are the real asset. Set SKIP_VERIFY=1 only for a deliberately
# modified asset; NEOZYGISK_ZIP / VECTOR_ZIP bypass this path entirely.
#
# $1=user path (optional) $2=filename $3=repo $4=tag $5=env name $6=sha256
resolve_zip() {
if [ -n "$1" ]; then
[ -f "$1" ] || fail "not found: $1"
printf '%s' "$1"
return 0
fi
dest="$CACHE/$2"
url="https://github.com/$3/releases/download/$4/$2"
if [ ! -f "$dest" ]; then
command -v curl >/dev/null 2>&1 || \
fail "curl not found, and $2 is not cached.
PortableGit ships curl, so a normal install has it. Otherwise download
$2 by hand from
$url
and re-run with $5_ZIP=<path to that file>."
echo "[*] downloading $2" >&2
# Fetch to a temp name and rename only after the digest matches, so an
# interrupted transfer or a captive-portal HTML page cannot leave a short
# file that the next run would treat as a valid cache hit.
#
# MSYS_NO_PATHCONV is exported above so adb's /data/... arguments stay
# literal. It also disables MSYS argument conversion, which leaves curl
# unable to open a POSIX output path: -o then fails with (23) while
# writing. Pass curl a native Windows path instead, which is exactly what
# hostpath is for.
tmp="$CACHE/.$2.part"
rm -f "$tmp"
if ! curl -fL --retry 3 --retry-delay 2 --connect-timeout 30 \
-o "$(hostpath "$tmp")" "$url"; then
rm -f "$tmp"
fail "download failed: $url
If this machine is offline, fetch $2 by hand from that URL and re-run with
$5_ZIP=<path to the file you downloaded>."
fi
mv -f "$tmp" "$dest" 2>/dev/null || cp -f "$tmp" "$dest"
rm -f "$tmp"
echo "[*] downloaded $2" >&2
fi
if [ "${SKIP_VERIFY:-0}" != "1" ] && command -v sha256sum >/dev/null 2>&1; then
got="$(sha256sum "$dest" | cut -d' ' -f1)"
if [ "$got" != "$6" ]; then
fail "$2 sha256 mismatch
expected $6
got $got
The download was corrupted or replaced. Delete $dest and re-run, or fetch the
asset by hand from $url"
fi
fi
printf '%s' "$dest"
}
NEO_ZIP="$(resolve_zip "${NEOZYGISK_ZIP:-}" NeoZygisk-v2.4-289-release.zip \
JingMatrix/NeoZygisk v2.4 NEOZYGISK \
93a1425c67bb89f58a0dcb9fc823ec93f6472214f221e667a70b67c6a6e061a1)"
VEC_ZIP="$(resolve_zip "${VECTOR_ZIP:-}" Vector-v2.2-3080-Release.zip \
JingMatrix/Vector v2.2 VECTOR \
9ee8323575d615f7b3f1076ff60b2a63a49390ef11881b52632311a37f6f79cc)"
echo "[*] pushing NeoZygisk and Vector"
wait_device 60 || fail "device lost before push"
adb_retry 4 "push NeoZygisk.zip" adb_ push "$(hostpath "$NEO_ZIP")" "$DEV/NeoZygisk.zip" \
|| fail "push NeoZygisk.zip failed"
adb_retry 4 "push Vector.zip" adb_ push "$(hostpath "$VEC_ZIP")" "$DEV/Vector.zip" \
|| fail "push Vector.zip failed"
# ksud module install can exit non-zero on a first install even when the module
# lands, so verify by the installed directory. A module installs into
# modules_update until the next boot; accept either. Installing also patches
# binaries on-device, which can take a while, so report when it is done.
install_module() { # $1=zip $2=module dir name $3=label
# ksud can return before the module tree is fully written, and the old
# 3x~2s check gave up after ~6s — too short for the 24 MB Vector module on a
# busy device right after KernelSU late-load. Install, then poll the dir.
_t0="$(date +%s)"
_tries=1
while [ "$_tries" -le 2 ]; do
rootq "/data/adb/ksud module install $1 >/dev/null 2>&1" >/dev/null
_p=0
while [ "$_p" -lt 20 ]; do
_got="$(rootq "if [ -d /data/adb/modules/$2 ] || [ -d /data/adb/modules_update/$2 ]; then echo installed; fi" | tr -d '\r' || true)"
if printf '%s' "$_got" | grep -q installed; then
echo " $3 installed ($(( $(date +%s) - _t0 ))s)"
return 0
fi
sleep 2
_p=$((_p + 1))
done
if [ "$_tries" -lt 2 ]; then
echo " $3 not visible yet (attempt $_tries/2), waiting"
wait_device 60 || true
fi
_tries=$((_tries + 1))
done
fail "$3 install failed (no /data/adb/modules{,s_update}/$2)"
}
install_module "$DEV/NeoZygisk.zip" zygisksu "NeoZygisk"
install_module "$DEV/Vector.zip" zygisk_vector "Vector"
echo "[*] clean NeoZygisk restart"
rootq 'pkill -f "[V]ectorDaemon"; pkill -f "[v]ectord"; pkill -f "[z]ygisk-ptrace"; pkill -f "[z]ygiskd"; true' >/dev/null
sleep 3
# Wipe the on-disk state so a cp64.sock left by an earlier session cannot pass
# for a fresh one, then let post-fs-data set up neozygisk + the intake monitor.
# post-fs-data detaches a child that inherits stdio, so bound it and treat its
# status as advisory. Both can lose the race with a device that just had
# KernelSU late-loaded, so retry until the monitor is actually alive.
_i=0; mon=0
while [ "$_i" -lt 3 ]; do
_i=$((_i + 1))
rootq 'rm -rf /data/adb/neozygisk' >/dev/null
sleep 2
rootq 'timeout 20 /data/adb/ksud post-fs-data >/dev/null 2>&1; echo pfd-rc=$?' >/dev/null
_p=0
while [ "$_p" -lt 12 ]; do
if rootq 'ps -A -o NAME' 2>/dev/null | tr -d '\r' | grep -qE '^zygisk-ptrace64$'; then
mon=1
break
fi
sleep 2
_p=$((_p + 2))
done
if [ "$mon" -eq 1 ]; then break; fi
if [ "$_i" -lt 3 ]; then echo " NeoZygisk monitor not up yet (attempt $_i/3); retrying"; fi
wait_device 60 || true
done
if [ "$mon" -ne 1 ]; then echo "[!] NeoZygisk monitor did not appear; continuing" >&2; fi
rootq "cp $NEO_ZPT $ZPT; chmod 755 $ZPT"
echo "[*] injecting live zygote (it will restart once)"
wait_device 60 || fail "device lost before inject"
Z="$(adb_ shell "pidof zygote64" 2>/dev/null | tr -d '\r' || true)"
[ -n "$Z" ] || fail "zygote64 not found"
rootq "timeout 30 $ZPT trace $Z >/dev/null 2>&1; echo trace-done" >/dev/null
sleep 3
wait_device 120 || echo "[!] device did not come back after injection; continuing" >&2
echo "[*] verifying the Zygisk stack"
# After the zygote restart the fresh socket and the two NeoZygisk processes can
# take a few seconds to appear, so poll instead of checking once. A socket from
# an earlier boot would otherwise pass even with nothing running.
_i=0; ready=0; zyg_procs=0; socks=""
while [ "$_i" -lt 60 ]; do
socks="$(rootq 'ls /data/adb/neozygisk/' 2>/dev/null | tr -d '\r' || true)"
zyg_procs="$(rootq 'ps -A -o NAME' 2>/dev/null | tr -d '\r' | grep -cE '^(zygiskd64|zygisk-ptrace64)$' || true)"
if printf '%s' "$socks" | grep -q 'cp64.sock' && [ "${zyg_procs:-0}" -ge 1 ]; then
ready=1
break
fi
sleep 2
_i=$((_i + 2))
done
if [ "$ready" -ne 1 ]; then
fail "Zygisk stack not up within ${_i}s (socket: $(printf '%s' "$socks" | tr '\n' ' '); zygisk procs: ${zyg_procs:-0})"
fi
echo " socket ok, zygisk processes: $zyg_procs"
echo "[*] SELinux permissive + starting vectord"
# Vector needs SELinux permissive; KernelSU restores Enforcing on load.
rootq 'setenforce 0' >/dev/null
enf="$(adb_ shell 'getenforce' 2>/dev/null | tr -d '\r')"
[ "$enf" = "Permissive" ] || fail "SELinux is $enf, Vector needs Permissive"
echo " SELinux: $enf"
# Clear the logcat buffers so the bridge evidence below is from this run. If the
# buffers cannot be cleared, fail rather than accept possibly-stale logs.
cleared=0
for c in 'logcat -b all -c' 'logcat -c'; do
root_rc "$c"
if [ "$RC" -eq 0 ]; then cleared=1; break; fi
done
[ "$cleared" -eq 1 ] || fail "cannot clear logcat (rc=$RC); bridge evidence freshness cannot be guaranteed"
# Absolute path is required: the daemon wrapper derives the daemon.apk
# classpath from $0, and the JVM rejects a relative apk path. `setsid` plus
# </dev/null detaches it from the su session (otherwise it dies when adb
# disconnects). Starting it can briefly disrupt adb, so it is fire-and-forget;
# readiness is confirmed by the poll below, which also waits out any blip.
rootq 'VDIR=/data/adb/modules/zygisk_vector; cd $VDIR && setsid nohup unshare -m $VDIR/daemon --system-server-max-retry=5 >/data/local/tmp/vectord.log 2>&1 </dev/null & echo started' >/dev/null
echo "[*] waiting for the Vector daemon (up to 180s)"
i=0; ready=0; status_json=""; bridge=""
while [ "$i" -lt 180 ]; do
# Require all three: a live vectord process, a success status, and a bridge
# line from this run. Status alone can be reported by a stale daemon.
live="$(rootq 'ps -A -o NAME' 2>/dev/null | tr -d '\r' | grep -cE '^vectord$' || true)"
root_rc '/data/adb/modules/zygisk_vector/cli --json status 2>/dev/null' || true
if [ "$RC" -eq 0 ]; then status_json="$REMOTE_OUT"; fi
sh_rc "logcat -d 2>/dev/null | grep -aE 'VectorZygiskBridge:.*(onTransact: action=|binder linked)' | tail -1" || true
if [ -n "$REMOTE_OUT" ]; then bridge="$REMOTE_OUT"; fi
if [ "${live:-0}" -ge 1 ] \
&& printf '%s' "$status_json" | grep -Eq '"success"[[:space:]]*:[[:space:]]*true' \
&& [ -n "$bridge" ]; then
ready=1
break
fi
if [ $((i % 15)) -eq 0 ]; then
_br="no"
if [ -n "$bridge" ]; then _br="yes"; fi
echo " starting up... (${i}s; vectord=${live:-0}, bridge=${_br})"
fi
sleep 3
i=$((i + 3))
done
[ "$ready" -eq 1 ] || fail "Vector not ready within ${i}s (need a live vectord, a success status and a bridge log line from this run)"
printf '%s\n' "$status_json"
printf '%s\n' "$bridge"
echo "[+] Vector is up. Hooks are NOT verified here; install and scope an Xposed"
echo " module and check its own log:"
echo " adb shell su -c '/data/adb/modules/zygisk_vector/cli modules enable <pkg>'"
echo " adb shell su -c '/data/adb/modules/zygisk_vector/cli scope set <pkg> <target>/0'"