Direct naar de inhoud
⚡ Kritieke cyberalerts voor jouw sector & systemen — direct in je inbox. Aanmelden →
CVE's Videos Dagbriefing

← Terug naar CVE-database

CVE-2026-15890

MEDIUM · 5.3 CVSS Gepubliceerd: CWE-323

Beschrijving NL

De standaard AEAD nonce-provider voor de PSA Internal Trusted Storage-transformatiemodule, secure_storage_its_transform_aead_get_nonce() in subsys/secure_storage/src/its/transform/aead_get.c, slaat zijn nonce-teller op in niet-gesynchroniseerde functie-lokale statische variabelen (s_nonce en s_nonce_initialized). Elk ITS-SCHRIFT verkrijgt hier zijn AES-GCM of ChaCha20-Poly1305 nonce via secure_storage_its_transform_to_store(). Omdat de functie geen vergrendeling bevatte, racen twee threads die het tegelijkertijd aanroepen op de gedeelde statica: het initialisatiepad (psa_generate_random() gevolgd door memcpy()) en het niet-atomaire increment-then-copy-pad kunnen elk dezelfde nonce-waarde aan twee verschillende coderingsbewerkingen geven en kunnen stappen verliezen, zodat de teller waarden herhaalt die nooit zijn ontworpen om te herhalen. De ITS-LAAG (secure_storage_its_set() in subsys/secure_storage/src/its/implementation.c) voert zelf geen serialisatie uit, dus gelijktijdige same-UID-schrijvingen bereiken de racy-provider rechtstreeks. Het hergebruiken van een nonce met dezelfde sleutel onder AES-GCM of ChaCha20-Poly1305 is een catastrofale AEAD-fout: het lekt de XOR van de twee platte teksten (het slaat routinematig geheimen op, inclusief PSA-persistente sleutels) en onthult voor GCM de verificatiesleutel, waardoor vervalsing van opgeslagen items mogelijk wordt. Omdat de AEAD-sleutel is afgeleid per invoer-UID, is de beveiligingsrelevante botsing twee gelijktijdige schrijfacties naar dezelfde UID die beide dezelfde nonce ontvangen; een tegenstander die in staat is om de RAW-backingopslag te lezen, kan vervolgens het hergebruik exploiteren. Zowel DE back-ends van de winkel die worden geleverd met Zephyr, zms.c als de instellingen/NVS-back-end in settings.c, zijn loggestructureerde flash-winkels met uitgestelde afvalinzameling, dus een vermelding die wordt vervangen door een herschrijving blijft fysiek aanwezig in de partitie totdat de sector wordt teruggewonnen. Two same-UID schrijft dat race daarom beide ciphertexts in één keer leesbaar laat in het ruwe beeld, wat de voorwaarde is dat het nonce hergebruik exploiteerbaar moet zijn. De trigger blijft smal: beide ingebouwde sleutelproviders (DEVICE_ID_HASH en ENTRY_UID_HASH) zout de afgeleide sleutel met de invoer-UID, dus hergebruik over verschillende UID's is onschadelijk en de belichting vereist een applicatie die dezelfde UID gelijktijdig schrijft vanuit twee threads. De fix serialiseert de provider met een K_MUTEX_DEFINE(s_nonce_mutex) die wordt vastgehouden voor de duur van nonce-generatie.

Origineel (Engels) tonen

The default AEAD nonce provider for the PSA Internal Trusted Storage transform module, secure_storage_its_transform_aead_get_nonce() in subsys/secure_storage/src/its/transform/aead_get.c, stores its nonce counter in unsynchronized function-local static variables (s_nonce and s_nonce_initialized). Every ITS write obtains its AES-GCM or ChaCha20-Poly1305 nonce here via secure_storage_its_transform_to_store().

Because the function held no lock, two threads calling it concurrently race on the shared statics: the initialization path (psa_generate_random() followed by memcpy()) and the non-atomic increment-then-copy path can each hand the same nonce value to two distinct encryption operations, and can lose increments so the counter repeats values it was designed never to repeat. The ITS layer (secure_storage_its_set() in subsys/secure_storage/src/its/implementation.c) performs no serialization of its own, so concurrent same-UID writes reach the racy provider directly.

Reusing a nonce with the same key under AES-GCM or ChaCha20-Poly1305 is a catastrophic AEAD failure: it leaks the XOR of the two plaintexts (ITS routinely stores secrets, including PSA persistent keys) and, for GCM, exposes the authentication key, enabling forgery of stored entries. Because the AEAD key is derived per entry UID, the security-relevant collision is two concurrent writes to the same UID both receiving the same nonce; an adversary able to read the raw backing storage can then exploit the reuse.

Both ITS store back-ends shipped with Zephyr, zms.c and the settings/NVS back-end in settings.c, are log-structured flash stores with deferred garbage collection, so an entry superseded by a rewrite remains physically present in the partition until its sector is reclaimed. Two same-UID writes that race therefore leave both ciphertexts readable in the raw image at once, which is the condition the nonce reuse needs to be exploitable. The trigger remains narrow: both built-in key providers (DEVICE_ID_HASH and ENTRY_UID_HASH) salt the derived key with the entry UID, so reuse across different UIDs is harmless, and the exposure requires an application that writes the same UID concurrently from two threads.

The fix serializes the provider with a K_MUTEX_DEFINE(s_nonce_mutex) held for the duration of nonce generation.

References