CVE-2023-21085 Overview
CVE-2023-21085 is an out-of-bounds write vulnerability in the Android operating system's NFC (Near Field Communication) subsystem. The vulnerability exists in the nci_snd_set_routing_cmd function within the nci_hmsgs.cc file, where a missing bounds check allows an attacker to write data beyond the allocated buffer boundaries. This flaw enables remote code execution from an adjacent network position without requiring any user interaction or additional execution privileges.
Critical Impact
This vulnerability allows adjacent network attackers to achieve remote code execution on affected Android devices without user interaction, potentially leading to complete device compromise.
Affected Products
- Google Android 11.0
- Google Android 12.0
- Google Android 12.1 (Android 12L)
- Google Android 13.0
Discovery Timeline
- 2023-04-19 - CVE-2023-21085 published to NVD
- 2025-02-05 - Last updated in NVD database
Technical Details for CVE-2023-21085
Vulnerability Analysis
This vulnerability is classified as CWE-787 (Out-of-Bounds Write), which occurs when the nci_snd_set_routing_cmd function in Android's NFC Interface (NCI) module fails to properly validate input boundaries before writing data to memory. The NCI layer handles communication between the Android host and the NFC Controller (NFCC), and routing commands are used to configure how NFC data is processed and forwarded.
The missing bounds check in the routing command handler allows malformed NFC messages to trigger memory corruption. Since NFC operates over short-range wireless communication, the attack vector is classified as adjacent network (proximal), meaning an attacker must be in physical proximity to the target device to exploit this vulnerability.
Root Cause
The root cause of CVE-2023-21085 is a missing bounds check in the nci_snd_set_routing_cmd function located in nci_hmsgs.cc. When processing NFC routing configuration commands, the function writes data to a buffer without first verifying that the data size does not exceed the buffer's allocated capacity. This oversight allows specially crafted NFC messages to write beyond buffer boundaries, corrupting adjacent memory regions.
Attack Vector
The attack requires adjacency to the target device through NFC communication range (typically within 4 centimeters). An attacker can craft malicious NFC packets containing oversized routing configuration data that, when processed by the vulnerable function, triggers the out-of-bounds write condition. Since no user interaction is required and no additional privileges are needed for exploitation, an attacker with appropriate hardware can silently compromise a vulnerable device by simply being in close proximity.
The attack scenario involves:
- Attacker positions themselves within NFC range of a target Android device
- Malicious NFC packets are transmitted containing crafted routing command data
- The nci_snd_set_routing_cmd function processes the data without bounds validation
- Memory corruption occurs, potentially allowing arbitrary code execution
- Attacker gains execution context on the target device
Detection Methods for CVE-2023-21085
Indicators of Compromise
- Unexpected NFC service crashes or restarts on Android devices
- Anomalous memory corruption signatures in system logs related to NCI or NFC components
- Unusual NFC activity or connections without user initiation
- System instability following NFC-enabled interactions
Detection Strategies
- Monitor Android system logs for crashes or exceptions originating from nci_hmsgs.cc or NFC-related components
- Implement mobile device management (MDM) solutions to track NFC service health and detect anomalies
- Deploy endpoint detection solutions capable of identifying memory corruption exploitation attempts
- Audit device firmware versions against known vulnerable Android releases (11.0, 12.0, 12.1, 13.0)
Monitoring Recommendations
- Enable verbose logging for NFC services on managed Android devices to capture potential exploitation attempts
- Implement network-level monitoring for environments where NFC-enabled devices operate
- Establish baseline behavior for NFC service operations to identify deviations
- Configure alerts for repeated NFC service failures which may indicate exploitation attempts
How to Mitigate CVE-2023-21085
Immediate Actions Required
- Apply the April 2023 Android security patch immediately to all affected devices
- For devices that cannot be immediately patched, consider disabling NFC functionality as a temporary measure
- Audit all Android devices in the organization to identify those running vulnerable versions (Android 11, 12, 12L, 13)
- Implement physical security measures to limit attacker proximity to critical devices
Patch Information
Google addressed this vulnerability in the Android Security Bulletin April 2023. The patch adds proper bounds checking to the nci_snd_set_routing_cmd function to prevent out-of-bounds write conditions. Organizations should ensure all Android devices are updated to security patch level 2023-04-01 or later.
The fix is tracked under Android ID A-264879662 and is included in all Android security updates released on or after April 1, 2023.
Workarounds
- Disable NFC on devices where it is not essential for business operations until patching is complete
- Implement strict physical access controls in environments with sensitive Android devices
- Use mobile device management (MDM) to enforce NFC disable policies on unpatched devices
- Consider network segmentation to isolate devices that cannot be immediately updated
# Disable NFC via ADB on managed devices (temporary workaround)
adb shell settings put global nfc_on 0
adb shell svc nfc disable
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


