Exploit database

GH-deb59086a0a69067da737a2a12bf7bc4

hycqaq/logitech-g-cloud-ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

164 sources

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

Repository files7

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

tools/find_ghostlock_bug.py

Python · 3,513 bytes
#!/usr/bin/env python3
"""
搜索真正的 GhostLock bug: current->pi_blocked_on = NULL
标准内核中: pi_blocked_on 在 current task_struct 的偏移
4.14 上通常是 0x48 (struct rt_mutex_waiter *)
模式: mrs xN, sp_el0; str xzr, [xN, #offset]
或通过 percpu current_task 变量
"""
import struct
from capstone import *

with open("E:/Claude/root/kernel","rb") as f: d=f.read()
tfo = 0x13C28
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM)
md.detail = True

def get_target(insn):
    raw = struct.unpack_from("<I", insn.bytes, 0)[0]
    if (raw & 0xFC000000) == 0x14000000:
        imm26 = raw & 0x03FFFFFF
        if imm26 & 0x02000000: imm26 |= ~0x03FFFFFF
        return insn.address + (imm26 << 2) + 4
    return None

# ================================================================
# 方法1: 搜索 str xzr, [xN, #imm] 在 mrs sp_el0 附近
# ================================================================
print("=" * 70)
print("  方法1: 搜索 str xzr, [current, #offset] 模式")
print("  (mrs xN, sp_el0 附近 + str xzr 到 task_struct 字段)")
print("=" * 70)

# 可能的 pi_blocked_on 偏移 (在 task_struct 中)
# 4.14 ARM64: pi_blocked_on 通常在 ~0x48 附近
# Qualcomm 可能有改动,搜索多个偏移
candidate_offsets = []

# 搜索: 在 0xC0000 (futex/rtmutex 区域) 搜索 
# mrs Xn, sp_el0 指令: 0xD538411X (X=n)
# 然后找附近的 str xzr, [Xn, #imm12]

found_patterns = []
for off in range(tfo + 0xC0000, tfo + 0x170000, 4):
    inst = struct.unpack_from("<I", d, off)[0]
    # mrs xN, sp_el0: d5 03 01 Nx (N = 0-30)
    if (inst & 0xFFFFFC1F) == 0xD5384110 and (inst & 0x1F) <= 28:
        rd = inst & 0x1F  # destination register
        # 在后续 8 条指令中搜索 str xzr, [xN, #imm12]
        for delta in range(4, 36, 4):
            if off + delta >= len(d) - 4: break
            next_inst = struct.unpack_from("<I", d, off + delta)[0]
            # str xzr, [Xm, #imm12]: 0xF9000000 | imm12<<10 | Xm<<5 | 0x1F
            if (next_inst & 0xFFC0001F) == 0xF900001F:
                imm12 = (next_inst >> 10) & 0xFFF
                rn = (next_inst >> 5) & 0x1F
                if rn == rd:
                    offset = imm12 * 8
                    if offset <= 0x100:  # 合理的 task_struct 偏移
                        if offset not in candidate_offsets:
                            candidate_offsets.append(offset)
                        if len(found_patterns) < 20:
                            ctx = d[off-4:off+delta+4]
                            print(f"\n  Found at 0x{off:x}:")
                            print(f"    mrs x{rd}, sp_el0 +{delta} bytes -> str xzr, [x{rd}, #{offset:#x}]")
                            for insn in md.disasm(ctx, off-4):
                                target = get_target(insn)
                                info = ""
                                if target and insn.mnemonic == "bl":
                                    info = f"  ❯ BL 0x{target:x}"
                                elif target and insn.mnemonic.startswith("b") and insn.mnemonic != "bl":
                                    info = f"  ❯ b 0x{target:x}"
                                marker = "  ***" if insn.address == off + delta else ""
                                print(f"    {insn.address:#x}: {insn.mnemonic:10s} {insn.op_str:35s}{marker}{info}")

print(f"\n  发现的 candidate pi_blocked_on 偏移: {[hex(o) for o in sorted(set(candidate_offsets))]}")
print(f"  总共找到 {len(found_patterns)} 处 'mrs + str xzr' 模式")