Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2021-47128— bpf, lockdown, audit: Fix buggy SELinux lockdown permission checks

Quick assessment

Affected
Linux Linux
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于 bpf, lockdown, audit 模块存在有问题的 SELinux 锁定权限检查。

AI Predicted 7.5 Difficulty: Easy EPSS 0.18% · P7

Affected Version Matrix 8

VendorProduct Version RangeStatus
Linux Linux 59438b46471ae6cdfb761afc8c9beaf1e428a331< ff5039ec75c83d2ed5b781dc7733420ee8c985fc affected
59438b46471ae6cdfb761afc8c9beaf1e428a331< acc43fc6cf0d50612193813c5906a1ab9d433e1e affected
59438b46471ae6cdfb761afc8c9beaf1e428a331< ff40e51043af63715ab413995ff46996ecf9583f affected
5.6 affected
< 5.6 unaffected
5.10.43≤ 5.10.* unaffected
5.12.10≤ 5.12.* unaffected
5.13≤ * unaffected
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2021-47128

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
bpf, lockdown, audit: Fix buggy SELinux lockdown permission checks
Source: CVE Program / CVE List V5
Vulnerability Description
In the Linux kernel, the following vulnerability has been resolved: bpf, lockdown, audit: Fix buggy SELinux lockdown permission checks Commit 59438b46471a ("security,lockdown,selinux: implement SELinux lockdown") added an implementation of the locked_down LSM hook to SELinux, with the aim to restrict which domains are allowed to perform operations that would breach lockdown. This is indirectly also getting audit subsystem involved to report events. The latter is problematic, as reported by Ondrej and Serhei, since it can bring down the whole system via audit: 1) The audit events that are triggered due to calls to security_locked_down() can OOM kill a machine, see below details [0]. 2) It also seems to be causing a deadlock via avc_has_perm()/slow_avc_audit() when trying to wake up kauditd, for example, when using trace_sched_switch() tracepoint, see details in [1]. Triggering this was not via some hypothetical corner case, but with existing tools like runqlat & runqslower from bcc, for example, which make use of this tracepoint. Rough call sequence goes like: rq_lock(rq) -> -------------------------+ trace_sched_switch() -> | bpf_prog_xyz() -> +-> deadlock selinux_lockdown() -> | audit_log_end() -> | wake_up_interruptible() -> | try_to_wake_up() -> | rq_lock(rq) --------------+ What's worse is that the intention of 59438b46471a to further restrict lockdown settings for specific applications in respect to the global lockdown policy is completely broken for BPF. The SELinux policy rule for the current lockdown check looks something like this: allow <who> <who> : lockdown { <reason> }; However, this doesn't match with the 'current' task where the security_locked_down() is executed, example: httpd does a syscall. There is a tracing program attached to the syscall which triggers a BPF program to run, which ends up doing a bpf_probe_read_kernel{,_str}() helper call. The selinux_lockdown() hook does the permission check against 'current', that is, httpd in this example. httpd has literally zero relation to this tracing program, and it would be nonsensical having to write an SELinux policy rule against httpd to let the tracing helper pass. The policy in this case needs to be against the entity that is installing the BPF program. For example, if bpftrace would generate a histogram of syscall counts by user space application: bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @[comm] = count(); }' bpftrace would then go and generate a BPF program from this internally. One way of doing it [for the sake of the example] could be to call bpf_get_current_task() helper and then access current->comm via one of bpf_probe_read_kernel{,_str}() helpers. So the program itself has nothing to do with httpd or any other random app doing a syscall here. The BPF program _explicitly initiated_ the lockdown check. The allow/deny policy belongs in the context of bpftrace: meaning, you want to grant bpftrace access to use these helpers, but other tracers on the system like my_random_tracer _not_. Therefore fix all three issues at the same time by taking a completely different approach for the security_locked_down() hook, that is, move the check into the program verification phase where we actually retrieve the BPF func proto. This also reliably gets the task (current) that is trying to install the BPF tracing program, e.g. bpftrace/bcc/perf/systemtap/etc, and it also fixes the OOM since we're moving this out of the BPF helper's fast-path which can be called several millions of times per second. The check is then also in line with other security_locked_down() hooks in the system where the enforcement is performed at open/load time, for example, open_kcore() for /proc/kcore access or module_sig_check() for module signatures just to pick f ---truncated---
Source: CVE Program / CVE List V5
CVSS Information
N/A
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5
Vulnerability Title
Linux kernel 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于 bpf, lockdown, audit 模块存在有问题的 SELinux 锁定权限检查。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
Linux Linux 59438b46471ae6cdfb761afc8c9beaf1e428a331 ~ ff5039ec75c83d2ed5b781dc7733420ee8c985fc -
Linux Linux 5.6 -

II. Public POCs for CVE-2021-47128

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2021-47128

请登录查看更多情报信息。

Other References for CVE-2021-47128 (3)

Same Patch Batch · Linux · 2024-03-15 · 26 CVEs total

CVE-2021-47111 8.8 HIGH xen-netback: take a reference to the RX task thread
CVE-2021-47131 8.1 HIGH net/tls: Fix use-after-free after the TLS device goes down and up
CVE-2021-47135 7.8 HIGH mt76: mt7921: fix possible AOOB issue in mt7921_mcu_tx_rate_report
CVE-2021-47112 7.8 HIGH x86/kvm: Teardown PV features on boot CPU as well
CVE-2021-47129 7.8 HIGH netfilter: nft_ct: skip expectations for confirmed conntrack
CVE-2021-47123 7.8 HIGH io_uring: fix ltout double free on completion race
CVE-2021-47124 7.8 HIGH io_uring: fix link timeout refs
CVE-2021-47126 7.8 HIGH ipv6: Fix KASAN: slab-out-of-bounds Read in fib6_nh_flush_exceptions
CVE-2021-47132 7.5 HIGH mptcp: fix sk_forward_memory corruption on retransmission
CVE-2021-47130 7.5 HIGH nvmet: fix freeing unallocated p2pmem
CVE-2021-47109 7.5 HIGH neighbour: allow NUD_NOARP entries to be forced GCed
CVE-2021-47113 7.1 HIGH btrfs: abort in rename_exchange if we fail to insert the second ref
CVE-2021-47122 net: caif: fix memory leak in caif_device_notify
CVE-2021-47134 efi/fdt: fix panic when no valid fdt found
CVE-2021-47133 HID: amd_sfh: Fix memory leak in amd_sfh_work
CVE-2021-47127 ice: track AF_XDP ZC enabled queues in bitmap
CVE-2021-47125 sch_htb: fix refcount leak in htb_parent_to_leaf_offload
CVE-2021-47121 net: caif: fix memory leak in cfusbl_device_notify
CVE-2021-47120 HID: magicmouse: fix NULL-deref on disconnect
CVE-2021-47119 ext4: fix memory leak in ext4_fill_super

Showing top 20 of 26 CVEs. View all on vendor page &rarr; →

IV. Related Vulnerabilities

V. Comments for CVE-2021-47128

No comments yet


Leave a comment