Val Protocol (Moto LK Patcher): Bootloader Unlock & FRP Removal for Motorola MTK Devices
What Is Val Protocol?
- Extracts the lk payload from Motorola LK container images
- Locates relevant bootloader control-flow patterns inside the payload
- Applies selected research patches to the unlock flow
- Rebuilds the original multi-image container layout
- Updates the MTK certificate hash (CERT2) so the modified image can be flashed on devices that already allow custom LK flashing
What the Tool Targets (Scope)
- fastboot oem unlock <key> command handling
- FRP/OEM unlock gate checks
- Key/hash validation routines
- Unlock-flow partition erase calls
- Runtime serial number lookup through the bootloader serialno getter
- MTK CERT1/CERT2 image hash verification metadata
Why "Val Protocol"? The Story Behind the Name
Key Features
- LK subimage extraction from Motorola LK/LKS container images
- Automatic architecture detection — AArch64 or ARM32 Thumb, no manual selection needed
- Detailed static-analysis artifacts, including:
- String references
- Candidate flows
- FRP/OEM checker candidates
- Key validator candidates
- Partition erase operations
- Serial number runtime source
- Three high-level presets covering unlock-only, FRP-only, and unlock-plus-erase workflows
- Runtime serial number derivation for generated keys — no serial embedded in the image
- Full container rebuild preserving the original multi-image layout
- Automatic MTK CERT2 image hash updates after patching
- Post-patch verification — the rebuilt LK image is verified after signing
Inside the Project: Repository Layout
| File / Directory | Purpose |
|---|---|
lk_auto_patch.py | End-to-end analyzer, patcher, and repacker |
lk_static_analyzer.py | Static analysis and report generation |
lk_patch_partition.py | Patch implementation engine |
lk_keygen.py | 20-character key generator |
lk_repack_signed.py | Repack signed LK payload into a container |
liblk/ | Minimal LK/LKS container parser |
tools/build-part-img.py | Replace a subimage in an MTK partition image |
tools/sign_mtk_cert.py | Update MTK CERT2 hashes |
tools/verify_mtk_image.py | Verify MTK CERT1/CERT2 image metadata |
docs/ | Documentation and related project materials |
Bench note: The modular design means each stage (analyze → patch → repack → sign → verify) can be run and inspected separately. If a patch fails validation, you'll know exactly which stage broke — not just that "it didn't work."
What's Changed? Earlier Builds vs. the Current Release
The tool you can download today is noticeably more mature than the early experimental builds the developer described. Here's an honest side-by-side:
| Area | Earlier Builds | Current Release |
|---|---|---|
| Patch Layout Stability | Shifted with secret length, causing reboots, rejected commands, and boot failures | Stable layout regardless of secret length |
| Secret Handling | Only short, specific secrets worked reliably | Flexible — supports user-defined secrets of any length |
| Unlock Keys | Trial-and-error approaches | Runtime serial-number derivation; one patched LK per model/build while keys remain device-specific |
| Workflow Presets | Single experimental flow | Three presets: unlock-serial, erase-serial, unlock-serial-nvdata |
| Architecture Support | Manual handling | Automatic detection for AArch64 and ARM32 Thumb |
| Validation | No reliable pre-flash check | Rebuilt image verified after signing — Result: VALID |
| Device Coverage | Limited testing | Expanded Edge / G / Razr coverage, including 2024–2026 models |
Val Protocol vs. Traditional Motorola Unlock Methods
| Method | Bootloader Unlock | FRP Removal | Cost | Limitations |
|---|---|---|---|---|
| Official Motorola unlock request | Yes (eligible models) | No | Free | Many MTK models and carrier variants may not be eligible |
| Paid remote unlock services | Yes | Sometimes | Per device | Waiting times, trust concerns, and limited transparency |
| Generic MTK FRP tools | No | Varies | Varies | Usually do not modify the bootloader unlock state |
| Val Protocol | Yes — serial-derived key | Yes — erase-serial preset | Free (AGPL v3.0) | Pattern-based compatibility; requires a PC and Python |
Supported Devices: Full Compatibility List
Moto Edge Devices
| Model | Device Name |
|---|---|
| XT2205-3 | Moto Edge (2022) |
| XT2305-1 | Moto Edge (2023) |
| XT2139-1 | Moto Edge 20 Lite |
| XT2303-2 | Moto Edge 40 (2023) |
| XT2307-1 | Moto Edge 40 Neo 5G (2023) |
| XT2409-2 | Moto Edge 50 Neo 5G (2024) |
| XT2519-1 | Moto Edge (2025) |
| XT2505-3 | Moto Edge 60 |
| XT2509-1 | Moto Edge 60 Neo |
| XT2503-1 | Moto Edge 60 Fusion |
| XT2507-1 | Moto Edge 60 Pro |
| XT2607-2 | Moto Edge 70 Pro |
Moto G Devices
| Model | Device Name |
|---|---|
| XT2163-1 | Moto G Pure |
| XT2213-3 | Moto G 5G (2022) |
| XT2613-1 | Moto G (2026) |
| XT2513-1 | Moto G 5G (2025) |
| XT2173-3 | Moto G31 |
| XT2625-6 | Moto G37 |
| XT2167-1 | Moto G41 |
| XT2625-5 | Moto G47 5G |
| XT2149-1 | Moto G50 5G (2021) |
| XT2343-1 | Moto G54 5G |
| XT2435-1 | Moto G55 5G (2024) |
| XT2529-1 | Moto G56 5G (2025) |
| XT2133-1 | Moto G60s |
| XT2431-1 | Moto G64 5G |
| XT2529-3 | Moto G66j 5G |
| XT2621-3 | Moto G67 (2026) |
| XT2255-3 | Moto G72 |
| XT2237-1 | Moto G73 5G (2023) |
| XT2621-3 | Moto G77 5G |
| XT2527-2 | Moto G86 5G |
| XT2527-1 | Moto G86 5G |
| XT2527-6 | Moto G86 Power 5G |
| XT2271-5 | Moto G Play (2023) |
| XT2615-1 | Moto G Play (2026) |
| XT2165-5 | Moto G Power (2022) |
| XT2311-3 | Moto G Power 5G (2023) |
| XT2415-5 | Moto G Power 5G (2024) |
| XT2515-2 | Moto G Power 5G (2025) |
| XT2211-2 | Moto G Stylus (2022) |
| XT2317DL | Moto G Stylus (2023) |
Moto Razr Devices
| Model | Device Name |
|---|---|
| XT2453-1 | Moto Razr 50 / Moto Razr (2024) |
| XT2553-1 | Moto Razr 60 / Moto Razr (2025) |
Important: Compatibility Is Pattern-Based, Not Model-Name-Based
- The lk payload can be extracted
- The architecture is detected
- The unlock flow is found
- The FRP/OEM checker candidate is found
- The key validator candidate is found
- The unlock erase block is found (when the selected preset needs it)
- The serial number runtime source is found
- The rebuilt image verifies as Result: VALID
The Three Presets Explained
1. unlock-serial — Bootloader Unlock Only
-o "path/to/lk.unlock-serial.img" \
--preset unlock-serial \
--key-token-secret "YourSecret"
Runtime usage on the device:
fastboot oem unlock GENERATED_KEY
2. erase-serial — FRP Removal Without Unlocking
This is the preset for customers who only need FRP cleared. It reuses the fastboot oem unlock <key> flow, validates a serial-derived key, erases the selected partition (typically frp) in the unlock erase block — and returns before changing the bootloader unlock state. The phone stays locked; only the FRP partition is wiped.
The runtime command is still fastboot oem unlock GENERATED_KEY — the patched bootloader simply handles it differently.
3. unlock-serial-nvdata — Unlock + Redirected Erase
-o "path/to/lk.unlock-frp.img" \
--preset unlock-serial-nvdata \
--key-token-secret "YourSecret" \
Warning: Only use replacement partition names that fit in the original string space. Short names like frp and cache are typical safe examples. Long partition names will not fit and can break the flow.
How Runtime Serial Derivation Works
This is the cleverest part of the design. The current presets do not embed the target serial number into the LK image. Instead, the patched key validator calls the LK serial number getter at runtime and derives the validation condition from the serial the device reports itself.
The key is still generated off-device:
python lk_keygen.py --secret "YourSecret" --serialno "SERIAL_FROM_FASTBOOT" --count 1
The practical benefit: one patched LK image per supported model/build, while keys remain device-specific. A shop can prepare a patched LK for a given model once and generate per-device keys on the fly.
Practical Scenario: FRP Removal on a Moto G54 5G at the Bench
Let's ground this in a real repair situation.
The job: A customer brings in a Moto G54 5G (XT2343-1). The phone was factory-reset by a family member, and the Google account credentials are long forgotten. FRP is active, and the bootloader is locked. The customer wants the phone usable again — and doesn't want to pay remote-unlock server fees.
Step 1 — Prepare your environment. Install Python 3.11+ (64-bit) and the dependencies, then pull the stock firmware for the customer's exact build and locate the LK image inside it.
Step 2 — Patch the LK image. Since this customer only needs FRP removed (not custom ROM access), the erase-serial preset is the right choice:
Step 3 — Confirm the patch is valid. Check the console output. You want to see Result: VALID before anything touches the phone. If the analyzer can't find the required patterns, stop — this build isn't compatible.
Step 4 — Flash the patched LK. Boot the phone into bootloader mode and flash the rebuilt image back to the LK partition (fastboot flash lk lk.erase-frp.img — on some builds the partition appears as lk1/lk2).
Step 5 — Read the device serial number.
Step 6 — Generate the device-specific key using your secret and the serial you just read:
Step 7 — Run the unlock command with the generated 20-character key:
Step 8 — Finish the job. The patched bootloader validates the key, erases the frp partition, and returns with the unlock state untouched. Factory reset through recovery, and the phone sets up like new — no Google lock, no paid server.
Bench notes: Keep the original lk.img backed up for every device you service — it's your recovery path. Keys are derived per serial, so a key generated for one phone will never validate on another. And if the customer later wants custom ROMs, that's a separate job with the unlock-serial-nvdata preset.
Requirements & Installation
Val Protocol is deliberately lightweight on dependencies:
- Python 3.11+ (64-bit recommended)
- Capstone 5.x — installed in the active Python environment
Install everything with:
The project includes liblk locally, and the analyzer contains fallback logic for environments where a local capstone/ folder shadows the installed package. A CustomTkinter-based UI is also referenced in the project documentation for those who prefer a graphical interface over the command line.
Quick Start: The Full Workflow at a Glance
For technicians who just want the command sequence:
# 1. Patch the LK image with the serial-based unlock presetpython lk_auto_patch.py "path/to/lk.img" \
-o "path/to/lk.unlock-serial.img" \
--preset unlock-serial \
--key-token-secret "YourSecret"
# 2. Read the device serial number
fastboot getvar serialno
# 3. Generate a key for that serial number
python lk_keygen.py --secret "YourSecret" --serialno "SERIAL_FROM_FASTBOOT" --count 1
# 4. Use the generated key on the device
Expected Output: How to Confirm a Successful Patch
Knowing what a healthy patch looks like saves hours of guessing.
A successful AArch64 patch usually includes lines similar to:
Architecture : aarch64Serialno runtime: 0x...
Patch : FRP/OEM checker call skip
Patch : KEY derived token gate
Mode : EXPERIMENTAL runtime-serial-compact-inplace
Device : runtime serialno from LK
SerialFn: 0x...
A successful ARM32 Thumb patch usually includes:
Architecture : arm32_thumbSerialno runtime: 0x...
Patch : KEY derived token gate
Arch : arm32_thumb
Returns : success=... fail=...
If you don't see Result: VALID, do not flash the output image. The analyzer is telling you a required pattern wasn't found.
Safety and Legal Notice
This deserves its own section, because bootloader work is genuinely risky:
- Use this tool only on devices you own or are explicitly authorized to service.
- Bootloader modification can permanently brick devices, erase user data, affect warranty state, and violate local law or vendor terms if used without authorization.
- The project is intended for repair, interoperability research, recovery workflows, and controlled lab analysis.
- Always keep the original image and a known recovery path before flashing modified firmware.
No tool in this category is risk-free, and anyone who tells you otherwise is selling something.
Credits, Documentation & License
Val Protocol stands on the shoulders of prior public Motorola/MTK research. Special thanks to:
- kasnria001/pwnage24mtk
- R0rt1z2/liblk
- R0rt1z2/lkpatcher
Full details are in the project's ACKNOWLEDGEMENTS.md. The repository also ships with documentation covering the usage guide, architecture notes, analysis outputs, troubleshooting, the CustomTkinter UI, and a publishing checklist — worth reading before your first patch.
The project is released under the GNU Affero General Public License v3.0.
Frequently Asked Questions (FAQ)
What is Val Protocol (Moto LK Patcher)?
Which Motorola devices are supported?
Do I need a dongle, box, or paid credits?
Which preset should I use: unlock-serial, erase-serial, or unlock-serial-nvdata?
Can one generated key unlock multiple phones?
Can it brick my device?
Does it work on Windows or Linux?
Is using Val Protocol legal?
📺 Follow Daarvi.Tech on YouTube
Get the latest mobile servicing tools, firmware updates, GSM tutorials and useful tech guides. Subscribe to our YouTube channel for new updates.
▶ Subscribe on YouTube
0 Comments
"We’d love to hear from you.
Share your thoughts, questions, or technical insights below. Please keep the conversation relevant and respectful. We review all comments before publishing to ensure a quality experience for the DaarviSoft community. (Your email address will remain private.)"