Commit eaddfeb
committed
netfilter: ebtables: fix table blob use-after-free
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550
Upstream Status: commit e58a171
commit e58a171
Author: Florian Westphal <[email protected]>
Date: Fri Feb 17 23:20:06 2023 +0100
netfilter: ebtables: fix table blob use-after-free
We are not allowed to return an error at this point.
Looking at the code it looks like ret is always 0 at this
point, but its not.
t = find_table_lock(net, repl->name, &ret, &ebt_mutex);
... this can return a valid table, with ret != 0.
This bug causes update of table->private with the new
blob, but then frees the blob right away in the caller.
Syzbot report:
BUG: KASAN: vmalloc-out-of-bounds in __ebt_unregister_table+0xc00/0xcd0 net/bridge/netfilter/ebtables.c:1168
Read of size 4 at addr ffffc90005425000 by task kworker/u4:4/74
Workqueue: netns cleanup_net
Call Trace:
kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
__ebt_unregister_table+0xc00/0xcd0 net/bridge/netfilter/ebtables.c:1168
ebt_unregister_table+0x35/0x40 net/bridge/netfilter/ebtables.c:1372
ops_exit_list+0xb0/0x170 net/core/net_namespace.c:169
cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:613
...
ip(6)tables appears to be ok (ret should be 0 at this point) but make
this more obvious.
Fixes: c58dd2d ("netfilter: Can't fail and free after table replacement")
Reported-by: [email protected]
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>1 parent 637c557 commit eaddfeb
File tree
3 files changed
+3
-5
lines changed- net
- bridge/netfilter
- ipv4/netfilter
- ipv6/netfilter
3 files changed
+3
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1053 | 1053 | | |
1054 | 1054 | | |
1055 | 1055 | | |
1056 | | - | |
| 1056 | + | |
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1044 | 1044 | | |
1045 | 1045 | | |
1046 | 1046 | | |
1047 | | - | |
1048 | 1047 | | |
1049 | 1048 | | |
1050 | 1049 | | |
| |||
1090 | 1089 | | |
1091 | 1090 | | |
1092 | 1091 | | |
1093 | | - | |
| 1092 | + | |
1094 | 1093 | | |
1095 | 1094 | | |
1096 | 1095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | | - | |
1065 | 1064 | | |
1066 | 1065 | | |
1067 | 1066 | | |
| |||
1107 | 1106 | | |
1108 | 1107 | | |
1109 | 1108 | | |
1110 | | - | |
| 1109 | + | |
1111 | 1110 | | |
1112 | 1111 | | |
1113 | 1112 | | |
| |||
0 commit comments