CVE-2024-49869 Information
Description
In the Linux kernel the following vulnerability has been resolved:
btrfs: send: fix buffer overflow detection when copying path to cache entry
Starting with commit c0247d289e73 (trfs: send: annotate struct name_cache_entry with __counted_by()) we annotated the variable length array ame\ from the name_cache_entry structure with __counted_by() to improve overflow detection. However that alone was not correct because the length of that array does not match the ame_len\ field - it matches that plus 1 to include the NUL string terminator so that makes a fortified kernel think there’s an overflow and report a splat like this:
strcpy: detected buffer overflow: 20 byte write of buffer size 19
WARNING: CPU: 3 PID: 3310 at __fortify_report+0x45/0x50
CPU: 3 UID: 0 PID: 3310 Comm: btrfs Not tainted 6.11.0-prnet 1
Hardware name: CompuLab Ltd. sbc-ihsw/Intense-PC2 (IPC2) BIOS IPC2_3.330.7 X64 03/15/2018
RIP: 0010:__fortify_report+0x45/0x50
Code: 48 8b 34 (…)
RSP: 0018:ffff97ebc0d6f650 EFLAGS: 00010246
RAX: 7749924ef60fa600 RBX: ffff8bf5446a521a RCX: 0000000000000027
RDX: 00000000ffffdfff RSI: ffff97ebc0d6f548 RDI: ffff8bf84e7a1cc8
RBP: ffff8bf548574080 R08: ffffffffa8c40e10 R09: 0000000000005ffd
R10: 0000000000000004 R11: ffffffffa8c70e10 R12: ffff8bf551eef400
R13: 0000000000000000 R14: 0000000000000013 R15: 00000000000003a8
FS: 00007fae144de8c0(0000) GS:ffff8bf84e780000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fae14691690 CR3: 00000001027a2003 CR4: 00000000001706f0
Call Trace:
Fix this by not storing the NUL string terminator since we don’t actually need it for name cache entries this way ame_len\ corresponds to the actual size of the ame\ array. This requires marking the ame\ array field with __nonstring and using memcpy() instead of strcpy() as recommended by the guidelines at:
https://github.com/KSPP/linux/issues/90
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Reference
https://git.kernel.org/stable/c/843738ede6cb8b959fb22591fcbabe8b456d7216 https://git.kernel.org/stable/c/96c6ca71572a3556ed0c37237305657ff47174b7
Attack Complexity
LOW
Privileges Required
LOW
User Interaction Required
LOW
Scope
NONE
Confidentiality Impact
UNCHANGED
Integrity Impact
HIGH
Availability Impact
HIGH
Base Score
HIGH
Base Severity
7.8
Share on: