Memory disclosure via mis-typed keyblob parameter
Published Aug 9, 2022 · Updated Mar 6, 2026
Arbitrary-address write in Huawei HW_KEYMASTER allows attackers to expose memory on affected HarmonyOS, EMUI, and Magic UI versions. The generate_keyblob path treats params[3] as a memory reference even when cmd_begin supplies a value parameter, so resort_key_characteristics writes a partially attacker-controlled parameter set to an arbitrary address. Reaching the trusted application requires an approved Huawei client; the demonstrated exploit instead patched the kernel whitelist, and Huawei reports confidentiality impact.
Summary
What happened
Arbitrary-address write in Huawei HW_KEYMASTER allows attackers to expose memory on affected HarmonyOS, EMUI, and Magic UI versions. The generate_keyblob path treats params[3] as a memory reference even when cmd_begin supplies a value parameter, so resort_key_characteristics writes a partially attacker-controlled parameter set to an arbitrary address. Reaching the trusted application requires an approved Huawei client; the demonstrated exploit instead patched the kernel whitelist, and Huawei reports confidentiality impact.
The record
- CVE
- CVE-2021-40040
- Published
- Aug 9, 2022
- Updated
- Mar 6, 2026
- Vendor
- Unknown vendor
- Product
- Unknown product
- Classifications
- Unavailable
- Attack vector
- network
- Privileges
- unauthenticated
Timeline
How it unfolded
- Aug 9, 2022CVE publishedPublication date reported by the CVE source.
- Mar 6, 2026Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
What conditions does exploitation require?
What is affected?
Affected products and versions are unavailable in this record.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
No sourced classifications are available.
Public exploit references
- HW_KEYMASTER generate_keyblob arbitrary-write demonstrationfunctional · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo