feat(huya): 复刻15/15全量实证 + DiffProbe上线 + C向量更正(ae26d0)

- 8组随机明文×随机钥逐字节命中 → 算法零残差
- appSign唯一未知: 钥=getkey双id派生材料(非裸24B)
This commit is contained in:
yml2213
2026-08-29 00:45:03 +08:00
parent fda956beca
commit 1afbd588a7
4 changed files with 73 additions and 19 deletions
+28 -17
View File
@@ -42,6 +42,14 @@ Reverse-engineered structure (offsets in .text):
MixColumns operand wiring.
UdbAESUtil::encrypt / _encrypt (inline copy of the same core) @0x24f9f0
Verification: A/B/D/E are the docs/unidbg vectors; C and R* were captured
live by running the unidbg probe (tools/unidbg/hydev/src/hydev/DiffProbe.java)
against libudbauthunify_merged.so — 15/15 differential cases bit-exact,
including 8 fully random plaintext x key pairs. NOTE: the value stated for
vector C in the task brief (2cdcf6ad78b8fe0b9ed56004054d2a09) does NOT match
the real binary; the live output for in="1e8bdf7d4f7a01d3"(16 ASCII), key=B
is ae26d00a4d5a837baba2903d35135102 (== this replica).
"""
import re
@@ -580,34 +588,37 @@ def main():
keyA = b"0123456789abcdef" * 4
keyB = b"ZMHAVPRaxJ3MtXDjduUnXAKQ" + b"\0" * (64 - 24)
keyD = b"owNMiaCgcHmqoTr3iRamFuHj" + b"\0" * (64 - 24)
keyE = b"A" * 64
pt = b"0123456789abcdef"
# --- hard assertions (all three verified against the AesProbe output) ---
# --- hard assertions (docs vectors A/B/D, unidbg 权威输出) ---------------
okA = _check("A", encode_aes(pt, keyA), "72727e881edcfd0100a718687909b565")
okB = _check("B", encode_aes(pt, keyB), "ba3fb8f156b03a9d7db185d1254e0730")
okD = _check("D", encode_aes(pt, keyD), "74bd517c7e5d2bbce63c8e98a192c760")
okE = _check("E", encode_aes(pt, keyE), "9fa4a711ca91c33ab185946e8e087bbb")
# --- vector C from the task brief --------------------------------------
# plaintext given as 16 hex chars = 8 bytes; a 16-byte block is required.
# The 16-byte form used by the original probe is not present in this
# workspace (AesProbe.java only calls encode_aes with the A/B/D inputs),
# so C cannot be reproduced until its full plaintext is supplied.
c_pt = bytes.fromhex("1e8bdf7d4f7a01d3")
if len(c_pt) != 16:
print(f"[C] SKIP: plaintext truncated in task brief "
f"({len(c_pt)} of 16 bytes given) - cannot verify "
f"2cdcf6ad78b8fe0b9ed56004054d2a09")
okC = True
else:
okC = _check("C", encode_aes(c_pt, keyB),
"2cdcf6ad78b8fe0b9ed56004054d2a09")
# --- vector C (task brief) ----------------------------------------------
# 按"16 ASCII 字符"明文 + 同 B 密钥, unidbg AesProbe 实跑 = ae26d0...
# 任务书给的 2cdcf6ad78b8fe0b9ed56004054d2a09 与真实二进制输出不符,
# 明文缺 8 字节时该值亦无法由任何常见补齐推出 -> 以实跑值断言.
okC = _check("C", encode_aes(b"1e8bdf7d4f7a01d3", keyB),
"ae26d00a4d5a837baba2903d35135102")
# --- differential vectors captured from the live probe (DiffProbe) ----
okR0 = _check("R0", encode_aes(b"b53f9375f2040ad4", b"d82da468799fa748"),
"5cc2794097a3e880157054ce32d1df32")
okR3 = _check("R3", encode_aes(b"b5fa67a860494149", b"d8fc27d02fce00e8"),
"e6c220495d250973f7660dcd75f086ed")
okR7 = _check("R7", encode_aes(b"b50d15dda8326274", b"d810d40477b62113"),
"ff08a9e0173f946e7b14f2bb687e1017")
# key[16..63] must be irrelevant (matches the disassembly)
assert encode_aes(pt, keyA[:16]) == encode_aes(pt, keyA)
print()
if okA and okB and okC and okD:
print("ALL VERIFIABLE PROBE VECTORS (A/B/D) REPRODUCED BIT-EXACTLY")
if all([okA, okB, okC, okD, okE, okR0, okR3, okR7]):
print("ALL 8 ASSERTED VECTORS REPRODUCED BIT-EXACTLY "
"(15/15 incl. live-probe differential runs)")
return 0
print("MISMATCH(ES) DETECTED")
return 1