Bug 1979668 (CVE-2021-36087) - CVE-2021-36087 libsepol: heap-based buffer overflow in ebitmap_match_any()
Summary: CVE-2021-36087 libsepol: heap-based buffer overflow in ebitmap_match_any()
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2021-36087
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1980280 1979669 1983528 1983529 1983530 1983531 1985492
Blocks: 1979670
TreeView+ depends on / blocked
 
Reported: 2021-07-06 16:58 UTC by Guilherme de Almeida Suckevicz
Modified: 2022-04-17 21:29 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-10 00:24:19 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2021:4513 0 None None None 2021-11-09 19:03:41 UTC

Description Guilherme de Almeida Suckevicz 2021-07-06 16:58:40 UTC
The CIL compiler in SELinux 3.2 has a heap-based buffer over-read in ebitmap_match_any (called indirectly from cil_check_neverallow). NOTE: bad0a746e9f4cf260dedba5828d9645d50176aac is cited in the OSV "fixed" field but does not have a code change.

References:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32675
https://github.com/google/oss-fuzz-vulns/blob/main/vulns/selinux/OSV-2021-585.yaml

Upstream patch:
https://github.com/SELinuxProject/selinux/commit/bad0a746e9f4cf260dedba5828d9645d50176aac

Comment 1 Guilherme de Almeida Suckevicz 2021-07-06 16:59:00 UTC
Created libsepol tracking bugs for this issue:

Affects: fedora-all [bug 1979669]

Comment 5 Garrett Tucker 2021-07-23 17:53:42 UTC
The issue was caused by a complex policy that would create and then delete an optional block. The deleted optional block would then try to be accessed. This caused the heap overflow. This was fixed in upstream patch by removing optional blocks about to be disabled. https://github.com/SELinuxProject/selinux/commit/340f0eb7f3673e8aacaf0a96cbfcd4d12a405521 and is the correct fix and code change.

Comment 6 Garrett Tucker 2021-07-23 19:07:19 UTC
selinux/libsepol is mostly local access and to perform this attack would require local access as compared to network access. An attacker would also require some form of privileges to write the policy file and compile the CIL. The availability impact is also low as this flaw would not cause a system wide or complete lack of availability. Instead the attack would only impact availability of selinux temporarily.

Comment 7 errata-xmlrpc 2021-11-09 19:03:39 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:4513 https://access.redhat.com/errata/RHSA-2021:4513

Comment 8 Product Security DevOps Team 2021-11-10 00:24:16 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-36087


Note You need to log in before you can comment on or make changes to this bug.