Skip to content
Memory corruption Write-up Advanced

Huawei TrustZone Tee_Fido_Main Vulnerability

The UnwrapKeyHandle function in Huawei's TrustZone FIDO trusted application stores extra TLV objects into a fixed-size array of ten entries without checking the count, overflowing a stack buffer. The authors did not attempt to trigger it because the overflow is too small relative to the stack frame to exploit.

blog.impalabs.com

Published on blog.impalabs.com

Alexandre Adamski](https://blog.impalabs.com/authors/alexandre-adamski.html) [{{media:2}}

The author, on blog.impalabs.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the parsing loop increments the tag counter and writes into the fixed ten-entry tlvs array without checking that the count stays below the array size.

Impact

A malicious caller could overwrite stack memory in the trusted application, but the authors found no way to exploit it because the overflow is small compared with the stack frame, and they did not attempt to trigger it.

What the attacker needed

Ability to send commands to the FIDO trusted app; key handle of at most 0x200 bytes; more than ten extra TLV objects

The fix

The text states the issue was fixed, though it does not describe the code change.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A trusted application runs in a special secure part of the phone's processor, separate from normal Android apps. It reads a list of items from the caller and copies them into a fixed-size box on the stack, a small scratch area for temporary data. It never checks whether the list is longer than the box, so extra items spill past the end and overwrite nearby memory.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.