Exploit database

GH-e6e5922ef9ac5cc7d4897803cb452516

zero2005x/rokid-rv101-research

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 files30

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

research/ghostlock_refs/extracted/honor/cve-2026-43499-honor-main/scripts/analyze/struct_check.py

Python · 4,483 bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Comprehensive struct offset verification against exploit source constants."""
import struct

k = open(r"D:\新建文件夹 (4)\root\545\unpacked\kernel.bin", "rb").read()
i = k.find(b"\x9f\xeb\x01\x00")
magic, version, flags, hdr_len, type_off, type_len, str_off, str_len = struct.unpack_from("<HBBIIIII", k, i)
ts = i + hdr_len + type_off
ss = i + hdr_len + str_off
strings = k[ss:ss+str_len]

def sname(o):
    if o == 0: return ""
    e = strings.find(b"\x00", o)
    return strings[o:e].decode(errors="replace")

K_STRUCT=4; K_UNION=5
types = {}  # id -> (kind, name, size, kflag, [(name, type_id, byte_offset)])
off = ts; end = ts + type_len; tid = 1
while off < end:
    no, info, sz = struct.unpack_from("<III", k, off)
    kind = (info>>24)&0x1f; vlen = info&0xffff; kflag = (info>>31)&1
    name = sname(no); off += 12
    members = []
    if kind in (K_STRUCT, K_UNION):
        for _ in range(vlen):
            mn, mt, mo = struct.unpack_from("<III", k, off); off += 12
            # BTF member offset is ALWAYS in bits
            members.append((sname(mn), mt, mo // 8))
    elif kind == 1: off += 4
    elif kind == 6: off += vlen*8
    elif kind == 19: off += vlen*12
    elif kind == 3: off += 12
    elif kind == 13: off += vlen*8
    elif kind == 14: off += 4
    elif kind == 15: off += vlen*12
    elif kind == 17: off += 4
    types[tid] = (kind, name, sz, kflag, members)
    tid += 1

def find_struct(name):
    for tid, (kind, nm, sz, kf, members) in types.items():
        if kind == K_STRUCT and nm == name and sz > 0:
            return tid, sz, members
    return None, None, None

def show(name, want_fields, src_map):
    tid, sz, members = find_struct(name)
    if tid is None:
        print(f"  struct {name}: NOT FOUND"); return
    md = dict((m[0], m[2]) for m in members)
    print(f"  struct {name} (size {sz:#x}):")
    for f in want_fields:
        src = src_map.get(f)
        act = md.get(f)
        if src is None:
            print(f"    {f:<22} src=--      BTF=0x{act:04x}" if act is not None else f"    {f:<22} src=--      BTF=NOT FOUND")
            continue
        if act is None:
            print(f"    {f:<22} src={src:#x}  BTF=NOT FOUND")
        else:
            mark = "OK" if act == src else "DIFF"
            print(f"    {f:<22} src={src:#06x} BTF=0x{act:04x}  [{mark}]")

# struct page
print("== struct page ==")
show("page", ["compound_head", "slab_cache", "type", "_mapcount", "flags"],
     {"compound_head": 0x08, "slab_cache": 0x18, "type": 0x30, "_mapcount": 0x04, "flags": 0x00})

# mm_struct (owner + size)
print("\n== mm_struct ==")
show("mm_struct", ["owner", "mm_users", "mm_count", "mmap", "mmap_base", "pgd"],
     {"owner": 1032, "mm_users": 0, "mm_count": 0, "mmap": 0, "mmap_base": 0, "pgd": 0})
tid, sz, members = find_struct("mm_struct")
print(f"  -> MM_STRUCT_SZ 源码=0x500 (1280), BTF size=0x{sz:x} ({sz})  {'DIFF' if sz != 0x500 else 'OK'}")

# seccomp
print("\n== struct seccomp ==")
show("seccomp", ["mode", "filter"], {"mode": 0x00, "filter": 0x08})

# seccomp_filter (SECCOMP_FILTER_COUNT_OFF=4)
print("\n== struct seccomp_filter ==")
show("seccomp_filter", ["usage", "refs"], {"usage": 0x04, "refs": 0x08})

# configfs structs: config_item (CFG_*_OFF)
print("\n== struct config_item ==")
show("config_item", ["ci_name", "ci_entry", "ci_parent", "ci_group", "ci_type", "ci_dentry"],
     {"ci_name": 0, "ci_entry": 0, "ci_parent": 0, "ci_group": 0, "ci_type": 0, "ci_dentry": 0})

print("\n== struct config_group ==")
show("config_group", ["cg_item", "cg_subsys", "default_groups", "default_groups_item"],
     {"cg_item": 0, "cg_subsys": 0, "default_groups": 0, "default_groups_item": 0})

print("\n== struct configfs_buffer (CFG_PAGE_OFF/NEEDS_READ_FILL/BIN_BUFFER...) ==")
# CFG_PAGE_OFF 16, CFG_NEEDS_READ_FILL_OFF 80, CFG_BIN_BUFFER_OFF 88, CFG_BIN_BUFFER_SIZE_OFF 96, CFG_CB_MAX_SIZE_OFF 100
show("configfs_buffer", ["page", "needs_read_fill", "bin_buffer", "bin_buffer_size", "cb_max_size"],
     {"page": 16, "needs_read_fill": 80, "bin_buffer": 88, "bin_buffer_size": 96, "cb_max_size": 100})

# futex_q (PSELECT_WAITER_WORD_SHIFT related?) - skip, complex

# vm_area_struct / mm_struct owner relationship done
print("\n== 补充: struct pipe_inode_info 源码 PIPE_INODE_INFO_STRUCT_SIZE=0xb8 ==")
tid, sz, members = find_struct("pipe_inode_info")
print(f"  BTF pipe_inode_info size = 0x{sz:x} ({sz})  {'OK' if sz == 0xb8 else 'DIFF'}")