Skip to content
Memory corruption Write-up Advanced

(CVE-2021-0956) Android NFC Out-Of-Bounds Write due to increase mNumTechList without bounds checking

An out-of-bounds write exists in Android's NFC stack when discovering and activating remote NFC endpoints, because the code appends endpoint information to arrays without checking bounds. An attacker within NFC range could trigger the flaw by presenting multiple endpoints or protocols, potentially causing memory corruption.

starlabs.sg

Published on starlabs.sg

There is a Out-Of-Bounds Write problem found in libnfcncijni.so, within the NFC endpoints discovering and activation. Specifically, in file packages/apps/Nfc/nci/jni/NfcTag.cpp, function NfcTag::discoverTechnologies (activation), when a new NFC endpoint is actived, its information is append to some arrays.

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 code increments the technology list count and writes entries without verifying the array capacity.

Impact

An attacker within NFC range could cause an out-of-bounds write, potentially leading to memory corruption or code execution, though the text only states the write may occur.

What the attacker needed

NFC hardware and Reader/Writer mode; attacker within NFC range; multiple endpoints or protocols

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.

NFC lets phones talk to nearby tags or other devices. When several tags or protocols appear at once, the phone's NFC software stores details about each one in a fixed-size list. This report says it never checks whether the list is full, so extra entries can spill over into memory and corrupt it.

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.