Cloudanix VulnDB

CVE-2021-36084

Low · 3.3

CVSS

3.3

EPSS

0.5%

Published

Jul 1, 2021

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A bug in the tool that compiles SELinux security rules could let someone on the same computer crash the compiler by feeding it a specially made file.

Exploit Available
Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Denial Of Service
Component
Application
Class
Use After Free
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Use-after-free vulnerability in the CIL compiler's __cil_verify_classperms function (invoked via __cil_verify_classpermission and __cil_pre_verify_helper) allows a local attacker to trigger memory corruption or a crash when processing a malicious policy file.

Why it matters to the business

Local users or automated policy compilation processes could experience denial-of-service crashes or instability when handling untrusted SELinux policy sources, potentially disrupting system hardening or policy deployment workflows.

How an attack unfolds

An attacker crafts a malicious CIL policy file that triggers the use-after-free during verification of class permissions; when the file is compiled by the vulnerable CIL compiler (for example via semodule or checkpolicy), the freed memory is accessed, leading to a crash or limited memory corruption.

How to fix it

Upgrade selinuxproject/selinux to the commit f34d3d30c8325e4847a6b696fe7a3936a8a361f3 or later; rebuild and reinstall affected tools such as the CIL compiler and policy utilities; avoid compiling untrusted CIL policy files until patched.

How to confirm the fix worked

Confirm the installed SELinux tools were built from a source tree containing commit f34d3d30c8325e4847a6b696fe7a3936a8a361f3; test compilation of known-triggering CIL samples to verify absence of crashes; review build logs and package versions for the fix.

Typical attack path

  1. Identify or obtain access to a system using vulnerable SELinux CIL compiler
  2. Create a specially crafted CIL source file that exercises the verification path
  3. Invoke the compiler (directly or via policy management tools) on the malicious file
  4. Trigger the use-after-free resulting in crash or memory corruption

How to detect it

Review system and application logs for unexpected crashes or segmentation faults in CIL-related binaries (cil, checkpolicy, semodule) during policy compilation; look for repeated invocations of policy tools on files from untrusted sources.

What your security team should do

  • Apply the upstream commit f34d3d30c8325e4847a6b696fe7a3936a8a361f3 immediately on all systems that compile CIL policies
  • Restrict local compilation of untrusted SELinux policies until patched
  • Monitor for policy compilation failures or crashes in logs

The record

The CIL compiler in SELinux 3.2 has a use-after-free in __cil_verify_classperms (called from __cil_verify_classpermission and __cil_pre_verify_helper).

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:8 libsepol 0 2.9-3.el8
AlmaLinux:8 libsepol-devel 0 2.9-3.el8
AlmaLinux:8 libsepol-static 0 2.9-3.el8
Debian:11 libsepol 0 No fix
Debian:11 libsepol 0 3.1-1+deb11u1
Debian:12 libsepol 0 3.3-1
Debian:13 libsepol 0 3.3-1
Red Hat:enterprise_linux:8::baseos libsepol 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::baseos libsepol-debuginfo 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::baseos libsepol-debugsource 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::baseos libsepol-devel 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::baseos libsepol-static 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::crb libsepol 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::crb libsepol-debuginfo 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::crb libsepol-debugsource 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::crb libsepol-devel 0 0:2.9-3.el8
Red Hat:enterprise_linux:8::crb libsepol-static 0 0:2.9-3.el8
Rocky Linux:8 libsepol 0 0:2.9-3.el8
Ubuntu:18.04:LTS libsepol 0 2.7-1ubuntu0.1
Ubuntu:20.04:LTS libsepol 0 3.0-1ubuntu0.1
Ubuntu:22.04:LTS libsepol 0 3.3-1
Ubuntu:Pro:16.04:LTS libsepol 0 2.4-2ubuntu0.1~esm1

Related vulnerabilities