New CVE entries in this week
A message that is not in the archive (sent off-list or not yet received): [email protected]
Masami Ichikawa
Acked-by Andrii NakryikoHi !
Quoted 19 lines · Masami Ichikawa via lists.cip-project.org
Hi !
It's this week's CVE report.
This week reported two new CVEs.
* New CVEs
CVE-2021-33098: Improper input validation in the Intel(R) Ethernet ixgbe driver for Linux before version 3.17.3 may allow an authenticated user to potentially enable denial of service via local access.
CVSS v3 score is 5.5 MEDIUM.
Intel released fixed version of driver kit. Not sure this CVE affects mainline's source code.
Fixed status
Intel released fixed version of driver kit.
Quoted 9 lines
CVE-2021-4001: bpf: Fix toctou on read-only map''s constant scalar tracking
CVSS v3 score is not provided.
This bug was introduced in 5.5-rc1 and fixed in 5.16-rc2. Patch for 5.15 is in stable-rt tree. Patch for 5.4(https://lore.kernel.org/stable/[email protected]/) and 5.10(https://lore.kernel.org/stable/[email protected]/) are failed to apply. However, this bug was introduced in 5.5-rc1 so 5.4 can be ignored? Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]
I attached a patch for 5.10.
Quoted 59 lines
* Updated CVEs
CVE-2021-3640: UAF in
sco_send_framefunction5.10 and 5.15 are fixed this week.
Fixed status
mainline: [
99c23da0eed4fd20cae8243f2b51e10e66aa0951] stable/5.10: [4dfba42604f08a505f1a1efc69ec5207ea6243de] stable/5.14: [2c2b295af72e4e30d17556375e100ae65ac0b896] stable/5.15: [b990c219c4c9d4993ef65ea9db73d9497e70f697] stable/5.4: [d416020f1a9cc5f903ae66649b2c56d9ad5256ab]CVE-2021-43975: atlantic: Fix OOB read and write in
hw_atl_utils_fw_rpc_waitThe mainline kernel was fixed in 5.16-rc2.
Fixed status
mainline: [
b922f622592af76b57cbc566eaeccda0b31a3496]Currently tracking CVEs
CVE-2021-31615: Unencrypted Bluetooth Low Energy baseband links in Bluetooth Core Specifications 4.0 through 5.2
There is no fix information.
CVE-2020-26555: BR/EDR pin code pairing broken
No fix information
CVE-2020-26556: kernel: malleable commitment Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26557: kernel: predictable Authvalue in Bluetooth Mesh Provisioning Leads to MITM
No fix information.
CVE-2020-26559: kernel: Authvalue leak in Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26560: kernel: impersonation attack in Bluetooth Mesh Provisioning
No fix information.
Regards,
--
Masami Ichikawa
Cybertrust Japan Co., Ltd.Email :[email protected]
:[email protected]
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7008): https://lists.cip-project.org/g/cip-dev/message/7008
Mute This Topic: https://lists.cip-project.org/mt/87295441/4520416
Group Owner: [email protected]
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129101/4520416/1465703922/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Regards,
Signature · 5 lines
Masami Ichikawa Cybertrust Japan Co., Ltd. Email :[email protected] :[email protected]
From d435a217fcbef826f7c3b684d530e70bdaee9142 Mon Sep 17 00:00:00 2001
From: Daniel Borkmann <[email protected]>
Date: Tue, 9 Nov 2021 18:48:08 +0000
Subject: [PATCH] bpf: Fix toctou on read-only map's constant scalar tracking
From: Daniel Borkmann <[email protected]>
commit 353050be4c19e102178ccc05988101887c25ae53 upstream
Commit a23740ec43ba ("bpf: Track contents of read-only maps as scalars") is checking whether maps are read-only both from BPF program side and user space side, and then, given their content is constant, reading out their data via map->ops->map_direct_value_addr() which is then subsequently used as known scalar value for the register, that is, it is marked as __mark_reg_known() with the read value at verification time. Before a23740ec43ba, the register content was marked as an unknown scalar so the verifier could not make any assumptions about the map content.
The current implementation however is prone to a TOCTOU race, meaning, the value read as known scalar for the register is not guaranteed to be exactly the same at a later point when the program is executed, and as such, the prior made assumptions of the verifier with regards to the program will be invalid which can cause issues such as OOB access, etc.
While the BPF_F_RDONLY_PROG map flag is always fixed and required to be specified at map creation time, the map->frozen property is initially set to false for the map given the map value needs to be populated, e.g. for global data sections. Once complete, the loader "freezes" the map from user space such that no subsequent updates/deletes are possible anymore. For the rest of the lifetime of the map, this freeze one-time trigger cannot be undone anymore after a successful BPF_MAP_FREEZE cmd return. Meaning, any new BPF_* cmd calls which would update/delete map entries will be rejected with -EPERM since map_get_sys_perms() removes the FMODE_CAN_WRITE permission. This also means that pending update/delete map entries must still complete before this guarantee is given. This corner case is not an issue for loaders since they create and prepare such program private map in successive steps.
However, a malicious user is able to trigger this TOCTOU race in two different
ways: i) via userfaultfd, and ii) via batched updates. For i) userfaultfd is used to expand the competition interval, so that map_update_elem() can modify the contents of the map after map_freeze() and bpf_prog_load() were executed. This works, because userfaultfd halts the parallel thread which triggered a map_update_elem() at the time where we copy key/value from the user buffer and this already passed the FMODE_CAN_WRITE capability test given at that time the map was not "frozen". Then, the main thread performs the map_freeze() and bpf_prog_load(), and once that had completed successfully, the other thread is woken up to complete the pending map_update_elem() which then changes the map content. For ii) the idea of the batched update is similar, meaning, when there are a large number of updates to be processed, it can increase the competition interval between the two. It is therefore possible in practice to modify the contents of the map after executing map_freeze() and bpf_prog_load().
One way to fix both i) and ii) at the same time is to expand the use of the map's map->writecnt. The latter was introduced in fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY") and further refined in 1f6cb19be2e2 ("bpf:
Prevent re-mmap()'ing BPF map as writable for initially r/o mapping") with the rationale to make a writable mmap()'ing of a map mutually exclusive with read-only freezing. The counter indicates writable mmap() mappings and then prevents/fails the freeze operation. Its semantics can be expanded beyond just mmap() by generally indicating ongoing write phases. This would essentially span any parallel regular and batched flavor of update/delete operation and then also have map_freeze() fail with -EBUSY. For the check_mem_access() in the verifier we expand upon the bpf_map_is_rdonly() check ensuring that all last pending writes have completed via bpf_map_write_active() test. Once the map->frozen is set and bpf_map_write_active() indicates a map->writecnt of 0 only then we are really guaranteed to use the map's data as known constants. For map->frozen being set and pending writes in process of still being completed we fall back to marking that register as unknown scalar so we don't end up making assumptions about it. With this, both TOCTOU reproducers from i) and ii) are fixed.
Note that the map->writecnt has been converted into a atomic64 in the fix in order to avoid a double freeze_mutex mutex_{un,}lock() pair when updating map->writecnt in the various map update/delete BPF_* cmd flavors. Spanning the freeze_mutex over entire map update/delete operations in syscall side would not be possible due to then causing everything to be serialized. Similarly, something like synchronize_rcu() after setting map->frozen to wait for update/deletes to complete is not possible either since it would also have to span the user copy which can sleep. On the libbpf side, this won't break d66562fba1ce ("libbpf: Add BPF object skeleton support") as the anonymous mmap()-ed "map initialization image" is remapped as a BPF map-backed mmap()-ed memory where for .rodata it's non-writable.
Reference: CVE-2021-4001
--- include/linux/bpf.h | 3 ++- kernel/bpf/syscall.c | 57 +++++++++++++++++++++++++++---------------- kernel/bpf/verifier.c | 17 ++++++++++++- 3 files changed, 54 insertions(+), 23 deletions(-)
include/linux/bpf.h +2 -1
@@ -173,7 +173,7 @@ struct bpf_map {atomic64_t usercnt;struct work_struct work;struct mutex freeze_mutex; -u64 writecnt;/* writable mmap cnt; protected by freeze_mutex */ +atomic64_t writecnt; };static inline bool map_value_has_spin_lock (const struct bpf_map *map)
@@ -1252,6 +1252,7 @@ void bpf_map_charge_move(struct bpf_map_memory *dst,void *bpf_map_area_alloc (u64 size,int numa_node);void *bpf_map_area_mmapable_alloc (u64 size,int numa_node);void bpf_map_area_free (void *base); +bool bpf_map_write_active (const struct bpf_map *map);void bpf_map_init_from_attr (struct bpf_map *map,union bpf_attr *attr); int generic_map_lookup_batch(struct bpf_map *map, const union bpf_attr *attr,
kernel/bpf/syscall.c +36 -21
145 lines not on this page · raw message
kernel/bpf/verifier.c +16 -1
@@ -3486,7 +3486,22 @@ static void coerce_reg_to_size(struct bpf_reg_state *reg, int size)static bool bpf_map_is_rdonly (const struct bpf_map *map) { -return (map->map_flags &BPF_F_RDONLY_PROG ) && map->frozen; +/* A map is considered read-only if the following condition are true: +* +* 1) BPF program side cannot change any of the map content. The +* BPF_F_RDONLY_PROG flag is throughout the lifetime of a map +* and was set at map creation time. +* 2) The map value(s) have been initialized from user space by a +* loader and then "frozen", such that no new map update/delete +* operations from syscall side are possible for the rest of +* the map's lifetime from that point onwards. +* 3) Any parallel/pending map update/delete operations from syscall +* side have been completed. Only after that point, it's safe to +* assume that map value(s) are immutable. +*/ +return (map->map_flags &BPF_F_RDONLY_PROG ) && +READ_ONCE (map->frozen) && + !bpf_map_write_active (map); }static int bpf_map_direct_read (struct bpf_map *map,int off,int size,u64 *val)
Signature · 1 line
2.33.1
Hi,
Quoted 11 lines
Quoted 9 lines
CVE-2021-4001: bpf: Fix toctou on read-only map''s constant scalar tracking
CVSS v3 score is not provided.
This bug was introduced in 5.5-rc1 and fixed in 5.16-rc2. Patch for 5.15 is in stable-rt tree. Patch for 5.4(https://lore.kernel.org/stable/[email protected]/) and 5.10(https://lore.kernel.org/stable/[email protected]/) are failed to apply. However, this bug was introduced in 5.5-rc1 so 5.4 can be ignored? Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]I attached a patch for 5.10.
Thanks, LGTM.
I think it would be better to add the comment of the conflict fixing.
e.g. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=1ada86999dc84b852fcc32962f4002e939f4beb7
Best regards,
Nobuhiro
________________________________________
差出人: [email protected] <[email protected]> が Masami Ichikawa <[email protected]> の代理で送信 送信日時: 2021年11月25日 14:16
宛先: [email protected]
件名: Re: [cip-dev] New CVE entries in this week
Hi !
Quoted 19 lines · Masami Ichikawa via lists.cip-project.org
Hi !
It's this week's CVE report.
This week reported two new CVEs.
* New CVEs
CVE-2021-33098: Improper input validation in the Intel(R) Ethernet ixgbe driver for Linux before version 3.17.3 may allow an authenticated user to potentially enable denial of service via local access.
CVSS v3 score is 5.5 MEDIUM.
Intel released fixed version of driver kit. Not sure this CVE affects mainline's source code.
Fixed status
Intel released fixed version of driver kit.
Quoted 9 lines
CVE-2021-4001: bpf: Fix toctou on read-only map''s constant scalar tracking
CVSS v3 score is not provided.
This bug was introduced in 5.5-rc1 and fixed in 5.16-rc2. Patch for 5.15 is in stable-rt tree. Patch for 5.4(https://lore.kernel.org/stable/[email protected]/) and 5.10(https://lore.kernel.org/stable/[email protected]/) are failed to apply. However, this bug was introduced in 5.5-rc1 so 5.4 can be ignored? Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]
I attached a patch for 5.10.
Quoted 50 lines
* Updated CVEs
CVE-2021-3640: UAF in
sco_send_framefunction5.10 and 5.15 are fixed this week.
Fixed status
mainline: [
99c23da0eed4fd20cae8243f2b51e10e66aa0951] stable/5.10: [4dfba42604f08a505f1a1efc69ec5207ea6243de] stable/5.14: [2c2b295af72e4e30d17556375e100ae65ac0b896] stable/5.15: [b990c219c4c9d4993ef65ea9db73d9497e70f697] stable/5.4: [d416020f1a9cc5f903ae66649b2c56d9ad5256ab]CVE-2021-43975: atlantic: Fix OOB read and write in
hw_atl_utils_fw_rpc_waitThe mainline kernel was fixed in 5.16-rc2.
Fixed status
mainline: [
b922f622592af76b57cbc566eaeccda0b31a3496]Currently tracking CVEs
CVE-2021-31615: Unencrypted Bluetooth Low Energy baseband links in Bluetooth Core Specifications 4.0 through 5.2
There is no fix information.
CVE-2020-26555: BR/EDR pin code pairing broken
No fix information
CVE-2020-26556: kernel: malleable commitment Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26557: kernel: predictable Authvalue in Bluetooth Mesh Provisioning Leads to MITM
No fix information.
CVE-2020-26559: kernel: Authvalue leak in Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26560: kernel: impersonation attack in Bluetooth Mesh Provisioning
No fix information.
Quoted 11 lines
Regards,
--
Masami Ichikawa
Cybertrust Japan Co., Ltd.Email :[email protected]
:[email protected]
Regards,
--
Masami Ichikawa
Cybertrust Japan Co., Ltd.
Email :[email protected]
:[email protected]
Hi !
Quoted 10 lines · Nobuhiro Iwamatsu
Hi,
Quoted 7 lines
Quoted 7 lines
CVE-2021-4001: bpf: Fix toctou on read-only map''s constant scalar tracking
CVSS v3 score is not provided.
This bug was introduced in 5.5-rc1 and fixed in 5.16-rc2. Patch for 5.15 is in stable-rt tree. Patch for 5.4(https://lore.kernel.org/stable/[email protected]/) and 5.10(https://lore.kernel.org/stable/[email protected]/) are failed to apply. However, this bug was introduced in 5.5-rc1 so 5.4 can be ignored? Fixed status
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
mainline: [
353050be4c19e102178ccc05988101887c25ae53]I attached a patch for 5.10.
Thanks, LGTM.
I think it would be better to add the comment of the conflict fixing.
e.g. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=1ada86999dc84b852fcc32962f4002e939f4beb7
Thank you ! I added a comment and sent patch to the stable list.
Quoted 125 lines
Best regards,
Nobuhiro________________________________________
差出人: [email protected] <[email protected]> が Masami Ichikawa <[email protected]> の代理で送信 送信日時: 2021年11月25日 14:16
宛先: [email protected]
件名: Re: [cip-dev] New CVE entries in this weekHi !
Quoted 19 lines · Masami Ichikawa via lists.cip-project.org
Hi !
It's this week's CVE report.
This week reported two new CVEs.
* New CVEs
CVE-2021-33098: Improper input validation in the Intel(R) Ethernet ixgbe driver for Linux before version 3.17.3 may allow an authenticated user to potentially enable denial of service via local access.
CVSS v3 score is 5.5 MEDIUM.
Intel released fixed version of driver kit. Not sure this CVE affects mainline's source code.
Fixed status
Intel released fixed version of driver kit.
Quoted 9 lines
CVE-2021-4001: bpf: Fix toctou on read-only map''s constant scalar tracking
CVSS v3 score is not provided.
This bug was introduced in 5.5-rc1 and fixed in 5.16-rc2. Patch for 5.15 is in stable-rt tree. Patch for 5.4(https://lore.kernel.org/stable/[email protected]/) and 5.10(https://lore.kernel.org/stable/[email protected]/) are failed to apply. However, this bug was introduced in 5.5-rc1 so 5.4 can be ignored? Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]I attached a patch for 5.10.
Quoted 50 lines
* Updated CVEs
CVE-2021-3640: UAF in
sco_send_framefunction5.10 and 5.15 are fixed this week.
Fixed status
mainline: [
99c23da0eed4fd20cae8243f2b51e10e66aa0951] stable/5.10: [4dfba42604f08a505f1a1efc69ec5207ea6243de] stable/5.14: [2c2b295af72e4e30d17556375e100ae65ac0b896] stable/5.15: [b990c219c4c9d4993ef65ea9db73d9497e70f697] stable/5.4: [d416020f1a9cc5f903ae66649b2c56d9ad5256ab]CVE-2021-43975: atlantic: Fix OOB read and write in
hw_atl_utils_fw_rpc_waitThe mainline kernel was fixed in 5.16-rc2.
Fixed status
mainline: [
b922f622592af76b57cbc566eaeccda0b31a3496]Currently tracking CVEs
CVE-2021-31615: Unencrypted Bluetooth Low Energy baseband links in Bluetooth Core Specifications 4.0 through 5.2
There is no fix information.
CVE-2020-26555: BR/EDR pin code pairing broken
No fix information
CVE-2020-26556: kernel: malleable commitment Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26557: kernel: predictable Authvalue in Bluetooth Mesh Provisioning Leads to MITM
No fix information.
CVE-2020-26559: kernel: Authvalue leak in Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26560: kernel: impersonation attack in Bluetooth Mesh Provisioning
No fix information.
Quoted 11 lines
Regards,
--
Masami Ichikawa
Cybertrust Japan Co., Ltd.Email :[email protected]
:[email protected]Regards,
--
Masami Ichikawa
Cybertrust Japan Co., Ltd.Email :[email protected]
:[email protected]-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7012): https://lists.cip-project.org/g/cip-dev/message/7012
Mute This Topic: https://lists.cip-project.org/mt/87295441/4520416
Group Owner: [email protected]
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129101/4520416/1465703922/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 5 lines
Masami Ichikawa Cybertrust Japan Co., Ltd. Email :[email protected] :[email protected]
Pavel Machek
Reviewed-byHi!
Quoted 5 lines
Quoted 3 lines
Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]I attached a patch for 5.10.
Thank you.
Looks good to me,
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi !
Quoted 7 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 3 lines
Fixed status
mainline: [
353050be4c19e102178ccc05988101887c25ae53]
Quoted 8 lines
Quoted 1 line
I attached a patch for 5.10.
Thank you.
Looks good to me,
Reviewed-by Pavel Machek <[email protected]>
Thank you for the review! I send patch to the stable list.\
Quoted 6 lines
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7013): https://lists.cip-project.org/g/cip-dev/message/7013
Mute This Topic: https://lists.cip-project.org/mt/87295441/4520416
Group Owner: [email protected]
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129101/4520416/1465703922/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Regards,
Signature · 5 lines
Masami Ichikawa Cybertrust Japan Co., Ltd. Email :[email protected] :[email protected]