oss-sec mailing list archives
[CVE-2021-31829] Linux kernel protection of stack pointer against speculative pointer arithmetic can be bypassed to leak content of kernel memory
From: Piotr Krysiuk <piotras () gmail com>
Date: Tue, 4 May 2021 11:06:52 +0100
An issue has been discovered in the Linux kernel mechanism to mitigate speculative loads (Spectre mitigation). Unprivileged BPF programs running on affected systems can bypass the protection and execute speculative loads from the kernel stack. This can be abused to extract contents of the stack via side-channel. The extracted contents may include addresses of kernel structures that could be used to defeat Kernel Address Space Layout Randomization (KASLR) to facilitate exploitation of other vulnerabilities. The identified gap is that when protecting BPF stack pointer against speculative pointer arithmetic, the BPF stack area itself is not protected against speculative loads. This could be abused to perform speculative loads from any location within the BPF stack. And so any restricted data from the BPF stack could be disclosed, such as addresses of data structures referred by the BPF program. Further, the original content of kernel memory is not wiped when allocating the BPF stack, and could be disclosed as well. I developed a PoC that allows unprivileged local users to extract contents of 511 bytes from the BPF stack. The PoC has been shared privately with <security () kernel org> to assist with fix development. The patches are available from the BPF subsystem public git repository. The fix has dependency of another recent commit fixing a separate issue. The full patch series is as follows: * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/patch/?id=b9b34ddbe2076ade359cd5ce7537d5ed019e9807 * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/patch/?id=801c6058d14a82179a7ee17a4b532cac6fad067f # Discoverers Piotr Krysiuk <piotras () gmail com> # References CVE-2021-31829 (reserved via https://cveform.mitre.org/)
Current thread:
- [CVE-2021-31829] Linux kernel protection of stack pointer against speculative pointer arithmetic can be bypassed to leak content of kernel memory Piotr Krysiuk (May 04)