CVE-2026-19184 in Zephyr
Summary
by MITRE • 10/05/2026
The NXP GAU ADC driver (drivers/adc/adc_mcux_gau_adc.c) validated the caller-supplied sequence->buffer_size, which is expressed in bytes, against the number of active channels, which is a sample count. It then stored that byte count directly in data->results_length and used it in mcux_gau_adc_read_samples() as the number of uint16_t slots available. Because each conversion result occupies sizeof(uint16_t) bytes, a buffer that was accepted as "large enough" could be written with up to twice its size in bytes, so every sample past the buffer's midpoint was written out of bounds.
adc_read() and adc_read_async() are Zephyr system calls. The syscall verifier in drivers/adc/adc_handlers.c only confirms that the caller owns buffer_size writable bytes (K_SYSCALL_MEMORY_WRITE); deciding whether that size is sufficient for the requested channels and extra_samplings is delegated entirely to the driver. On a build with CONFIG_USERSPACE=y, a user-mode thread that has been granted the ADC device object could therefore submit a deliberately half-sized buffer and cause the driver's work-queue handler — which runs in supervisor mode, outside the caller's MPU restrictions — to write ADC conversion results past the end of that buffer, at an address and for a length of the caller's choosing.
The overrun is bounded by the requested sequence: with sequence->options->extra_samplings set, the sampling loop walks the buffer pointer forward across every sampling, so the total overrun can reach the full size of the supplied buffer (kilobytes for a large extra_samplings). The written words are 16-bit ADC conversion results, so the content is only partially attacker-influenced (via the selected analog input, gain and resolution), but the destination and length are fully controlled — sufficient for kernel memory corruption, a crash, or a userspace-to-kernel privilege escalation. Builds without CONFIG_USERSPACE, or on SoCs other than NXP RW61x with the GAU ADC node enabled, are not exposed to the privilege boundary; there the same defect only causes a silent overflow when the application itself passes an undersized buffer.
The fix replaces the ad-hoc check with the shared adc_sequence_validate_buffer() helper (validating against num_channels * sizeof(uint16_t)), stores buffer_size / sizeof(uint16_t) in results_length, and corrects the loop bound to a post-decrement so exactly the available number of slots may be written.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 10/05/2026
The vulnerability identified within the NXP GAU ADC driver for Zephyr represents a critical integer interpretation error that leads to out-of-bounds memory writes with severe security implications. The core technical flaw stems from a fundamental mismatch in data type handling during buffer size validation. Specifically, the driver validates the caller-supplied sequence->buffer_size against the number of active channels, treating the byte count as if it were a sample count. This logical error causes the system to accept buffers that are significantly smaller than required for the requested ADC conversions. When the mcux_gau_adc_read_samples function executes, it interprets this incorrectly validated size directly as the number of uint16_t slots available in the buffer. Since each conversion result occupies two bytes, a buffer deemed sufficient by the flawed check is actually only half large enough to hold all resulting samples. Consequently, every sample written beyond the midpoint of the allocated buffer results in an out-of-bounds write operation.
The operational impact of this vulnerability is amplified significantly when Zephyr's userspace isolation features are enabled via CONFIG_USERSPACE=y. In such configurations, the syscall verifier located in adc_handlers.c performs a basic check to ensure that the caller owns at least buffer_size writable bytes using K_SYSCALL_MEMORY_WRITE. However, it delegates the responsibility of verifying whether this size is sufficient for the specific hardware configuration and sampling parameters entirely to the driver itself. This delegation creates a dangerous gap where user-mode threads can exploit the logic error by submitting deliberately undersized buffers. Because the ADC processing work-queue handler operates in supervisor mode, it executes outside the memory protection restrictions enforced on the calling userspace thread. This allows an attacker-controlled process to trigger kernel-space writes that bypass standard MPU protections, effectively bridging the privilege boundary between untrusted user space and trusted kernel space.
The severity of this vulnerability is further heightened by the controllability of the attack vector. While the content written into memory consists of 16-bit ADC conversion results which are only partially influenced by the attacker through analog input selection, gain settings, and resolution parameters, the destination address and write length are fully controlled by the user-supplied buffer size and sampling configuration. The overrun is bounded by the requested sequence options; if extra_samplings are configured, the sampling loop iterates across every sample, potentially causing an overflow that spans kilobytes of memory for large configurations. This capability enables kernel memory corruption, system crashes leading to denial-of-service conditions, or sophisticated userspace-to-kernel privilege escalation attacks where arbitrary code execution can be achieved by overwriting critical kernel structures such as function pointers or return addresses.
This vulnerability maps directly to CWE-190 Integer Overflow and CWE-787 Out-of-bounds Write within the Common Weakness Enumeration framework. From a tactical perspective, it aligns with ATT&CK technique T1055 Process Injection and potentially T1068 Privilege Escalation due to its ability to corrupt kernel memory from user space. The risk is mitigated in builds that do not enable CONFIG_USERSPACE or on SoCs other than the NXP RW61x where the GAU ADC node is enabled, as these configurations limit the impact to a silent buffer overflow within the application itself rather than crossing into supervisor mode. However, for targeted embedded systems utilizing this specific hardware and configuration, the risk remains critical.
The remediation strategy involves replacing the ad-hoc validation logic with the shared adc_sequence_validate_buffer helper function which correctly validates the buffer size against num_channels multiplied by sizeof(uint16_t). This ensures that the byte count accurately reflects the memory required for all expected samples. Additionally, the driver now stores results_length as buffer_size divided by sizeof(uint16_t), ensuring it represents a valid slot count rather than a raw byte count. The loop bound is also corrected to use a post-decrement mechanism, guaranteeing that exactly the number of available slots are written without exceeding boundaries. This fix aligns the validation logic with industry best practices for handling fixed-width data structures and prevents the misinterpretation of buffer capacities that led to the original vulnerability.