Skip to content

Zephyr JSON decoder incorrectly decodes array of array

High
ceolin published GHSA-289f-7mw3-2qf4 Oct 5, 2021

Package

zephyr (west)

Affected versions

>1.14.0, >2.5.0

Patched versions

2.7.0

Description

Impact

The Zephyr JSON decoder incorrectly decodes array of array structures.

When using JSON_OBJ_DESCR_ARRAY_ARRAY, the subarray is has the token type JSON_TOK_LIST_START, but then assigns to the object part of the union. arr_parse then takes the offset of the array-object (which has nothing todo with the list) treats it as relative to the parent object, and stores the length of the subarray in there.

For the unittest that means that the subarray length(=1) is stored where the name-pointer of the first element would be.
And in fact, the unittest only verifies the names of the second and third elements and just ignores the first one(which would fail the unit tests.

Patches

Fixed on master: #36340 (2.7.0)
Fixed on v2.6.0: #37816 (unreleased)
Fixed on v2.5.0: TBD
Fixed on v1.14: TBD

References

Original bug report: #33573

For more information

If you have any questions or comments about this advisory:

embargo: 2020-06-20

Severity

High
7.5
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2021-3510

Weaknesses

Credits