GHSL-2020-163: Use-After-Free (UAF) in NFCHost::GetNFC - CVE-2020-15970
A use-after-free flaw in Chrome's NFCHost::GetNFC allowed a dangling pointer to be triggered when a site's NFC permission was changed, potentially crashing a privileged Chrome process. The bug could be reached from a malicious website but required non-trivial user interactions.
In the GetNFC method of NFCHost, the NFCHost is passed into a callback as a raw pointer [1]:
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely each call to GetNFC created a new permission subscription that stored the same raw NFCHost pointer, but only the most recent subscription ID was saved and unsubscribed on destruction, leaving earlier callbacks with dangling pointers.
Impact
A malicious website could trigger a use-after-free in the browser, but the report notes it requires non-trivial user interactions and the origin trial ended, so the bug had no effect after that date.
What the attacker needed
Android device with Chrome; experimental flag or origin trial token; at least one other tab open; user grants NFC permission
The fix
The bug was fixed in Chrome version 86.0.4240.75.
How it was found
- Enable the experimental web platform features flag in Chrome and relaunch.
- Host the provided test pages on localhost and connect the Android device to the host machine.
- Open two tabs in Chrome, load the first test page in one tab, click the button and allow the NFC permission prompt.
- Wait about 10 seconds or until the page refreshes, then close that tab.
- Go to Settings > Site settings > All sites, select the localhost site and clear all permissions.
- Observe via logcat that a privileged Chrome process has crashed.
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 report has not been written yet. The Original tab links to the source.
A use-after-free happens when a program keeps a pointer to memory after that memory has been freed, and later uses it. Here, Chrome stored a pointer to an object in a callback but did not cancel all such callbacks when the object was destroyed, so changing a site permission could make Chrome use the freed object and crash.
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.