Linux: Use After Free
CVE-2022-49006 is a high-severity use after free vulnerability in Linux, with a CVSS 3.1 base score of 7.8 out of 10. It can be exploited with local access to the system by an attacker with a low-privileged account, without any action from a user. The record lists versions 1603feac154ff38514e8354e3079a455eb4801e2, be111ebd8868d4b7c041cb3c6102e1ae27d6dc1d, 417d5ea6e735e5d88ffb6c436cf2938f3f476dd1 as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.26% chance of exploitation within 30 days, which is low compared with other CVEs.
High severity with no evidence of exploitation so far.
What to do
- Update Linux to 1603feac154ff38514e8354e3079a455eb4801e2 or be111ebd8868d4b7c041cb3c6102e1ae27d6dc1d or 417d5ea6e735e5d88ffb6c436cf2938f3f476dd1 or c52d0c8c4f38f7580cff61c4dfe1034c580cedfd, whichever matches your release line, or a later version.
- Update Linux Kernel to 5.4.226 or 5.10.158 or 5.15.82 or 6.0.12, whichever matches your release line, or a later version.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| Linux | Linux | 77b44d1b7c28360910cdbd427fb62d485c08674c up to, but not including, 1603feac154ff38514e8354e3079a455eb4801e2; 77b44d1b7c28360910cdbd427fb62d485c08674c up to, but not including, be111ebd8868d4b7c041cb3c6102e1ae27d6dc1d; 77b44d1b7c28360910cdbd427fb62d485c08674c up to, but not including, 417d5ea6e735e5d88ffb6c436cf2938f3f476dd1; 77b44d1b7c28360910cdbd427fb62d485c08674c up to, but not including, c52d0c8c4f38f7580cff61c4dfe1034c580cedfd; 77b44d1b7c28360910cdbd427fb62d485c08674c up to, but not including, 4313e5a613049dfc1819a6dfb5f94cf2caff9452; 2.6.33 | 1603feac154ff38514e8354e3079a455eb4801e2, be111ebd8868d4b7c041cb3c6102e1ae27d6dc1d, 417d5ea6e735e5d88ffb6c436cf2938f3f476dd1, c52d0c8c4f38f7580cff61c4dfe1034c580cedfd, 4313e5a613049dfc1819a6dfb5f94cf2caff9452 |
| Linux | Linux Kernel | 2.6.33 up to, but not including, 5.4.226; 5.5 up to, but not including, 5.10.158; 5.11 up to, but not including, 5.15.82; 5.16 up to, but not including, 6.0.12; 6.1 | 5.4.226, 5.10.158, 5.15.82, 6.0.12 |
Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.
How the severity score breaks down
- Attack vector
- LocalThe attacker needs local access or must trick a user into running something.
- Attack complexity
- LowNo special conditions are needed; the attack works reliably.
- Privileges required
- LowA basic user account is enough.
- User interaction
- NoneNo action by a victim is required.
- Scope
- UnchangedImpact stays within the vulnerable component.
- Confidentiality
- HighAll data handled by the component can be read.
- Integrity
- HighData or code can be modified at will.
- Availability
- HighThe component can be taken down completely.
Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.
Official description
In the Linux kernel, the following vulnerability has been resolved: tracing: Free buffers when a used dynamic event is removed After 65536 dynamic events have been added and removed, the "type" field of the event then uses the first type number that is available (not currently used by other events). A type number is the identifier of the binary blobs in the tracing ring buffer (known as events) to map them to logic that can parse the binary blob. The issue is that if a dynamic event (like a kprobe event) is traced and is in the ring buffer, and then that event is removed (because it is dynamic, which means it can be created and destroyed), if another dynamic event is created that has the same number that new event's logic on parsing the binary blob will be used. To show how this can be an issue, the following can crash the kernel: # cd /sys/kernel/tracing # for i in `seq 65536`; do echo 'p:kprobes/foo do_sys_openat2 $arg1:u32' > kprobe_events # done For every iteration of the above, the writing to the kprobe_events will remove the old event and create a new one (with the same format) and increase the type number to the next available on until the type number reaches over 65535 which is the max number for the 16 bit type. After it reaches that number, the logic to allocate a new number simply looks for the next available number. When an dynamic event is removed, that number is then available to be reused by the next dynamic event created. That is, once the above reaches the max number, the number assigned to the event in that loop will remain the same. Now that means deleting one dynamic event and created another will reuse the previous events type number. This is where bad things can happen. After the above loop finishes, the kprobes/foo event which reads the do_sys_openat2 function call's first parameter as an integer. # echo 1 > kprobes/foo/enable # cat /etc/passwd > /dev/null # cat trace cat-2211 [005] .... 2007.849603: foo: (do_sys_openat2+0x0/0x130) arg1=4294967196 cat-2211 [005] .... 2007.849620: foo: (do_sys_openat2+0x0/0x130) arg1=4294967196 cat-2211 [005] .... 2007.849838: foo: (do_sys_openat2+0x0/0x130) arg1=4294967196 cat-2211 [005] .... 2007.849880: foo: (do_sys_openat2+0x0/0x130) arg1=4294967196 # echo 0 > kprobes/foo/enable Now if we delete the kprobe and create a new one that reads a string: # echo 'p:kprobes/foo do_sys_openat2 +0($arg2):string' > kprobe_events And now we can the trace: # cat trace sendmail-1942 [002] ..... 530.136320: foo: (do_sys_openat2+0x0/0x240) arg1= cat-2046 [004] ..... 530.930817: foo: (do_sys_openat2+0x0/0x240) arg1="������������������������������������������������������������������������������������������������" cat-2046 [004] ..... 530.930961: foo: (do_sys_openat2+0x0/0x240) arg1="������������������������������������������������������������������������������������������������" cat-2046 [004] ..... 530.934278: foo: (do_sys_openat2+0x0/0x240) arg1="������������������������������������������������������������������������������������������������" cat-2046 [004] ..... 530.934563: foo: (do_sys_openat2+0x0/0x240) arg1="��������������������������������������� ---truncated---
Source: the CVE record as published by its numbering authority, via NVD and CVE.org.
The underlying weakness: Use After Free
The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory belongs to the code that operates on the new pointer.
How developers prevent this class of flaw
- Choose a language that provides automatic memory management.
- When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.
Timeline
- CVE record published.
- CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: partial).
- Record last changed materially (score, affected products, status or references).
References
Patches and release notes
- git.kernel.org/stable/c/1603feac154ff38514e8354e3079a455eb4801e2
- git.kernel.org/stable/c/417d5ea6e735e5d88ffb6c436cf2938f3f476dd1
- git.kernel.org/stable/c/4313e5a613049dfc1819a6dfb5f94cf2caff9452
- git.kernel.org/stable/c/be111ebd8868d4b7c041cb3c6102e1ae27d6dc1d
- git.kernel.org/stable/c/c52d0c8c4f38f7580cff61c4dfe1034c580cedfd
Recent Use After Free vulnerabilities
- 7.0 High severity
- 7.0 High severity
- 7.8 High severity
- 7.8 High severity
- 7.8 High severity
- 7.8 High severity
Spotted an error? Tell us.