Skip to content
Memory corruption Write-up Advanced

(CVE-2021-0950) Android NFC [email protected] Writer mode Out-Of-Bounds Write leading to Information Disclosure

An out-of-bounds write in the Android NFC HAL library occurs when a supplied command's length is increased without proper validation, causing a three-byte overflow. This can be turned into a read past the end of a global buffer, and an attacker could combine it with other flaws to execute code in the NFC HIDL service.

starlabs.sg

Published on starlabs.sg

An Out-Of-Bounds Write bug was found in nfcncinxp.so. Specifically, in file "hardware/nxp/nfc/halimpl/hal/phNxpNciHalext.cc", function phNxpNciHalwriteext, due to lack of proper validation of the length of supplied command prior to increasing length of it, leading to 3 bytes overflow problem.

The author, on starlabs.sg

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 function increases the length of a command buffer without first checking that the supplied command length leaves enough room, so a three-byte write goes past the end of the buffer.

Impact

An attacker could turn the overflow into a read past the end of a global buffer and, in conjunction with other vulnerabilities, execute arbitrary code in the context of the NFC HIDL service.

What the attacker needed

Ability to send crafted NFC commands

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.

This is a memory safety bug in a part of Android that handles near-field communication (NFC), the technology used for tap-to-pay and similar features. The code writes three bytes more than it should into a buffer, which can corrupt nearby memory and later cause the program to read data it should not. An attacker who can send crafted NFC commands might use this to leak information or, with other bugs, run their own code.

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.