Exploit databaseDownload repository ZIP
GH-deb59086a0a69067da737a2a12bf7bc4
hycqaq/logitech-g-cloud-ghostlock-cve-2026-43499
Sources for CVE-2026-43499
164 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files7
hycqaq/logitech-g-cloud-ghostlock-cve-2026-43499Revision 5259347e9bf7
- ↑..Parent directory
- analyze_pi_state.py
- extract_kallsyms.py
- extract_symbols.py
- find_ghostlock_bug.py
- kgsl_uaf_test.c
- reanalysis.py
- trace_waiter.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/analyze_pi_state.py
Python · 5,172 bytes#!/usr/bin/env python3
"""
分析 SM7125 的三个关键 pi_state 生命周期函数:
1. attach_to_pi_owner — 分配 pi_state
2. fixup_pi_state_owner — 修改 pi_state owner
3. put_pi_state — 释放 pi_state
目标: 确认 pi_state 内存是否可被重用/控制
"""
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
def disasm(code, base, max_n=40, show_ret=False):
for i, insn in enumerate(md.disasm(code, base)):
if i >= max_n: break
t = get_target(insn)
info = ""
if insn.mnemonic == "bl":
info = f" ❯ BL 0x{t:x}"
elif insn.mnemonic.startswith("b") and t is not None and insn.mnemonic != "bl":
info = f" ❯ b 0x{t:x}"
if insn.mnemonic == "ret" and not show_ret:
print(f" ... ret")
break
print(f" 0x{insn.address:x}: {insn.mnemonic:10s} {insn.op_str:35s}{info}")
# ================================================================
# 1. attach_to_pi_owner @ 0x113578
# ================================================================
print("=" * 70)
print(" 1. attach_to_pi_owner (kallsyms 0x113578)")
print("=" * 70)
fo = tfo + 0x113578
code = d[fo:fo+0x200]
disasm(code, fo, 60, show_ret=True)
print()
# ================================================================
# 2. fixup_pi_state_owner @ 0x1136c8
# ================================================================
print("=" * 70)
print(" 2. fixup_pi_state_owner (kallsyms 0x1136c8)")
print("=" * 70)
fo = tfo + 0x1136c8
code = d[fo:fo+0x300]
disasm(code, fo, 80, show_ret=True)
print()
# ================================================================
# 3. put_pi_state @ 0x113418
# ================================================================
print("=" * 70)
print(" 3. put_pi_state (kallsyms 0x113418)")
print("=" * 70)
fo = tfo + 0x113418
code = d[fo:fo+0x200]
disasm(code, fo, 50, show_ret=True)
# ================================================================
# 4. 追踪 put_pi_state 的 BL 目标 — 看最终有没有 free
# ================================================================
print("\n" + "=" * 70)
print(" 4. put_pi_state BL 目标追踪")
print("=" * 70)
# 找到 put_pi_state 中所有 BL 的目标地址
fo_pps = tfo + 0x113418
bl_targets = set()
for off in range(fo_pps, fo_pps + 0x100, 4):
inst = struct.unpack_from("<I", d, off)[0]
if (inst & 0xFC000000) == 0x94000000:
imm = inst & 0x03FFFFFF
if imm & 0x02000000:
imm |= ~0x03FFFFFF
t = off + (imm << 2) + 4
bl_targets.add(t)
for t in sorted(bl_targets):
# 反汇编每个 BL 目标的前几条指令
code2 = d[t:t+0x20]
first = ""
for insn in md.disasm(code2, t):
first = f"{insn.mnemonic} {insn.op_str}"
break
# 检查这个函数里有没有 kfree / kmem_cache_free / call_rcu
has_free = False
for off2 in range(t, t + 0x200, 4):
if off2 >= len(d) - 4: break
inst2 = struct.unpack_from("<I", d, off2)[0]
if (inst2 & 0xFC000000) == 0x94000000:
imm = inst2 & 0x03FFFFFF
if imm & 0x02000000:
imm |= ~0x03FFFFFF
target2 = off2 + (imm << 2) + 4
# Check if targets kfree or kmem_cache_free
if target2 in (tfo + 0x1F7B68, tfo + 0x1F77A8):
has_free = True
break
# Also check for call_rcu: 搜索 adrp + add + bl pattern
print(f" BL 0x{t:x}: {first} {'⚡ HAS FREE!' if has_free else ''}")
# ================================================================
# 5. 搜索: pi_state 是否有 delayed free / rcu free
# ================================================================
print("\n" + "=" * 70)
print(" 5. 全局搜索: kmem_cache_free 的调用位置")
print("=" * 70)
kmem_cache_free_fo = tfo + 0x1F77A8
kfree_fo = tfo + 0x1F7B68
# 在 futex 相关区域搜索
futex_start = tfo + 0x110000
futex_end = tfo + 0x115000
found_free = []
for off in range(futex_start, futex_end, 4):
inst = struct.unpack_from("<I", d, off)[0]
if (inst & 0xFC000000) == 0x94000000:
imm = inst & 0x03FFFFFF
if imm & 0x02000000:
imm |= ~0x03FFFFFF
t = off + (imm << 2) + 4
if t == kmem_cache_free_fo:
found_free.append(("kmem_cache_free", off, t))
elif t == kfree_fo:
found_free.append(("kfree", off, t))
for name, addr, target in found_free:
# Show context
ctx = d[addr-12:addr+4]
for insn in md.disasm(ctx, addr-12):
marker = " ***" if insn.address == addr else ""
print(f" {insn.address:#x}: {insn.mnemonic:10s} {insn.op_str}{marker} -> {name}")
if not found_free:
print(" 在 futex 区域未找到 kfree/kmem_cache_free 调用")