Skip to content

[HELP] scan_lk.py reports 100% COMPATIBLE and correct sector, but RPMB erase/write silently doesn't persist on SK Hynix UFS (H9QT1G6DN6X132, MT6877) #13

Description

@LucaCraft89

Device model

Redmi Note 12 Pro+ 5G

Codename

rubypro

SoC

MT6877

Firmware version

HyperOS OS2.0.15.0.UMOEUXM

Which step failed?

Step 3 — seccfg unlock (da seccfg unlock)

Full terminal output

TOO LONG cannot post

Operating system

Fedora 44

USB port type

USB 2.0 (black port)

Did you use a preloader file?

No — let mtkclient auto-detect

What have you already tried?

Summary

Reporting a new hardware data point for the compatibility database, and a hardware-level blocker that isn't a problem with this repo's logic.

scan_lk.py correctly identified my device as COMPATIBLE (100/100), correctly found the magic string, correctly identified all 8 functions and the 3 fastboot OEM commands, on both lk_a.bin and lk_b.bin. The RPMB magic string was also found at the expected byte offsets via grep, matching the documented sector math exactly. Everything about the detection side worked perfectly.

However, actually erasing/overwriting the RPMB magic region does not work on this hardware — the RPMB write reports success at the mtkclient level but the underlying flash never changes. I've filed the mtkclient-side details as a separate issue there ([link once filed]), since it looks like an mtkclient RPMB-write bug rather than something wrong in this repo. Posting here too because it's relevant to the compatibility database and the "Other UFS types (unverified)" section of the README.

Device / Environment

  • SoC: MT6877 / MT6877V / MT8791N (Dimensity 900/1080/7050)
  • UFS chip: H9QT1G6DN6X132SK Hynix, MID 0xad
  • HyperOS device, HW code 0x959, Target config 0xe7, SBC/SLA/DAA all enabled
  • Exploit: Kamakiri, via mtkclient, mt6877_payload.bin

scan_lk.py output (both slots)

$ python3 scan_lk.py lk_a.bin
══════════════════════════════════════════════════════════
  LK BINARY SCAN REPORT — MTKClient Unlock Analyzer
══════════════════════════════════════════════════════════

  File size  : 8,388,608 bytes (8.0 MB)
  MD5        : c54a9fb0cc6f2ddf5ab558822e6b4746
  SHA256     : 604ce2891c3a8d658e5f1d00363e7358...

  ┌─────────────────────────────────────────┐
  │  VERDICT: COMPATIBLE                     │
  │  Score  : 100/100 (100%)                       │
  │  Method: RPMB erase (sector 57344) + sec│
  └─────────────────────────────────────────┘

  [MAGIC] Jz8PNRUF : ✓ FOUND
    @ 0x0013F254

  [RPMB] Type : UFS_Samsung_0x400000
    magic                : 0x3FE0
    lock_state_len       : 0x40E0
    signature_data       : 0x41E0

  [RSA]  Modulus : ✓ FOUND
    @ 0x000A85BC
    Key size: 2048 bits

  [SECCFG] Version : generic

  [FUNCTIONS] 8 detected:
    ✓ mi_check_magic: Checks RPMB magic — returns 0 (present) or 3 (absent)
    ✓ mi_get_lock_state: Reads RPMB lock state — overrides seccfg when magic present
    ✓ get_lock_state: Main lock state function — reads seccfg + RPMB
    ✓ seccfg_set_lock_state: Writes lock state to seccfg partition
    ✓ rpmb_read: Reads N bytes from RPMB
    ✓ rpmb_write: Writes N bytes to RPMB
    ✓ fastboot_oem_lks: Hidden fastboot OEM lock state commands
    ✓ verify_unlock_sig: RSA signature verification for unlock token

  [FASTBOOT] 3 OEM commands:
    ✓ oem lks @ 0x000AB428
    ✓ oem unlock @ 0x000AB49C
    ✓ oem lock @ 0x000AB4A8
══════════════════════════════════════════════════════════

lk_b.bin scan produced an identical verdict/score/functions (different MD5/SHA256: 56b82bad9a89f80f8262f1a87d004a80 / bd7e482599c681d1fc820a8ee38ca2af...), same magic offset 0x0013F254. Both slots agree, so this isn't the slot-mismatch issue documented elsewhere in the README (fire/MT6769Z case).

Note: the scanner labels the RPMB type as UFS_Samsung_0x400000 — this may be worth flagging in the report output for non-Samsung chips, since my actual UFS is SK Hynix and it's possible the offsets/frame layout constants baked in for "Samsung" don't transfer 1:1 to Hynix's actual RPMB controller behavior, even though the magic string itself was found at the matching location in the LK binary.

grep confirmation of magic location

$ grep -boa "Jz8PNRUF" rpmb_dump.bin
14680064:Jz8PNRUF
31457280:Jz8PNRUF

14680064 / 256 = 57344 — matches the scanner's predicted sector exactly. 31457280 / 256 = 122880 is a second, undocumented occurrence (possibly a backup/mirror copy — not currently covered in the README's sector reference table).

What went wrong

Following the documented Path A procedure exactly (RPMB erase both sectors → seccfg unlock), then verifying:

fastboot getvar unlocked → unlocked: no
fastboot oem lks         → lks = 1
fastboot getvar secure   → secure: yes

Never moved off the locked state, across:

  • initial erase + unlock
  • forced seccfg lock → unlock cycle (to rule out a "no-op because already unlocked" skip)
  • full cold power-off + fresh fastboot boot before every check (to rule out cached-state reads)
  • explicit zero-fill write instead of erase (to rule out an erase-specific mtkclient bug)

Every RPMB write/erase operation reported success with a consistent derived key, but a re-dump immediately after each operation showed the magic string still present, byte-for-byte unchanged, at both offsets. Full logs are in the mtkclient-side issue.

Ask

  • Should the "Other UFS types (unverified)" section / compatibility DB include a note that scan_lk.py detection succeeding doesn't guarantee the RPMB write itself will persist on non-Samsung UFS chips?
  • Is there a known-good SK Hynix device in the confirmed list I could cross-reference (I saw a Redmi Note 11 4G / fleur variant 2201117SY with SK Hynix UFS was confirmed via "Path B" in the XDA thread — mine scanned as full COMPATIBLE (Path A profile), not COMPATIBLE_SECCFG_ONLY, so Path B doesn't apply here as far as I can tell. Happy to be corrected.)
  • Willing to provide any further dumps/tests — device is dedicated to this debugging right now.

Related

  • mtkclient-side issue with full logs: [link once filed on bkerler/mtkclient]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions