Bug 1963977 (CVE-2021-28902)

Summary: CVE-2021-28902 libyang: NULL pointer dereference in read_yin_container()
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: mruprich, tkorbar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libyang 1.0.226 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in libyang. Missing checks in several read_yin_* functions lead to NULL pointer dereferences possibly allowing a remote attacker to crash an application that uses libyang with user-controlled YIN formats. The highest threat from this vulnerability is the service availability.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-28 12:28:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1963978, 1965252, 1965253    
Bug Blocks: 1964021    

Description Guilherme de Almeida Suckevicz 2021-05-24 14:10:10 UTC
In function read_yin_container() in libyang <= v1.0.225, it doesn't check whether the value of retval->ext[r] is NULL. In some cases, it can be NULL, which leads to the operation of retval->ext[r]->flags that results in a crash.

Reference:
https://github.com/CESNET/libyang/issues/1454

Comment 1 Guilherme de Almeida Suckevicz 2021-05-24 14:10:27 UTC
Created libyang tracking bugs for this issue:

Affects: fedora-all [bug 1963978]

Comment 2 Riccardo Schirone 2021-05-27 09:19:39 UTC
Upstream patch:
https://github.com/CESNET/libyang/commit/a3917d95d516e3de267d3cfa5d4d3715a90e8777