{"id":"CVE-2023-52879","aliases":["CVE-2023-52879"],"related":[],"kind":"vulnerability","state":"published","title":"tracing: Have trace_event_file have ref counters","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ntracing: Have trace_event_file have ref counters\n\nThe following can crash the kernel:\n\n # cd /sys/kernel/tracing\n # echo 'p:sched schedule' > kprobe_events\n # exec 5>>events/kprobes/sched/enable\n # > kprobe_events\n # exec 5>&-\n\nThe above commands:\n\n 1. Change directory to the tracefs directory\n 2. Create a kprobe event (doesn't matter what one)\n 3. Open bash file descriptor 5 on the enable file of the kprobe event\n 4. Delete the kprobe event (removes the files too)\n 5. Close the bash file descriptor 5\n\nThe above causes a crash!\n\n BUG: kernel NULL pointer dereference, address: 0000000000000028\n #PF: supervisor read access in kernel mode\n #PF: error_code(0x0000) - not-present page\n PGD 0 P4D 0\n Oops: 0000 [#1] PREEMPT SMP PTI\n CPU: 6 PID: 877 Comm: bash Not tainted 6.5.0-rc4-test-00008-g2c6b6b1029d4-dirty #186\n Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014\n RIP: 0010:tracing_release_file_tr+0xc/0x50\n\nWhat happens here is that the kprobe event creates a trace_event_file\n\"file\" descriptor that represents the file in tracefs to the event. It\nmaintains state of the event (is it enabled for the given instance?).\nOpening the \"enable\" file gets a reference to the event \"file\" descriptor\nvia the open file descriptor. When the kprobe event is deleted, the file is\nalso deleted from the tracefs system which also frees the event \"file\"\ndescriptor.\n\nBut as the tracefs file is still opened by user space, it will not be\ntotally removed until the final dput() is called on it. But this is not\ntrue with the event \"file\" descriptor that is already freed. If the user\ndoes a write to or simply closes the file descriptor it will reference the\nevent \"file\" descriptor that was just freed, causing a use-after-free bug.\n\nTo solve this, add a ref count to the event \"file\" descriptor as well as a\nnew flag called \"FREED\". The \"file\" will not be freed until the last\nreference is released. But the FREE flag will be set when the event is\nremoved to prevent any more modifications to that event from happening,\neven if there's still a reference to the event \"file\" descriptor.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ntracing: Have trace_event_file have ref counters\n\nThe following can crash the kernel:\n\n # cd /sys/kernel/tracing\n # echo 'p:sched schedule' > kprobe_events\n # exec 5>>events/kprobes/sched/enable\n # > kprobe_events\n # exec 5>&-\n\nThe above commands:\n\n 1. Change directory to the tracefs directory\n 2. Create a kprobe event (doesn't matter what one)\n 3. Open bash file descriptor 5 on the enable file of the kprobe event\n 4. Delete the kprobe event (removes the files too)\n 5. Close the bash file descriptor 5\n\nThe above causes a crash!\n\n BUG: kernel NULL pointer dereference, address: 0000000000000028\n #PF: supervisor read access in kernel mode\n #PF: error_code(0x0000) - not-present page\n PGD 0 P4D 0\n Oops: 0000 [#1] PREEMPT SMP PTI\n CPU: 6 PID: 877 Comm: bash Not tainted 6.5.0-rc4-test-00008-g2c6b6b1029d4-dirty #186\n Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014\n RIP: 0010:tracing_release_file_tr+0xc/0x50\n\nWhat happens here is that the kprobe event creates a trace_event_file\n\"file\" descriptor that represents the file in tracefs to the event. It\nmaintains state of the event (is it enabled for the given instance?).\nOpening the \"enable\" file gets a reference to the event \"file\" descriptor\nvia the open file descriptor. When the kprobe event is deleted, the file is\nalso deleted from the tracefs system which also frees the event \"file\"\ndescriptor.\n\nBut as the tracefs file is still opened by user space, it will not be\ntotally removed until the final dput() is called on it. But this is not\ntrue with the event \"file\" descriptor that is already freed. If the user\ndoes a write to or simply closes the file descriptor it will reference the\nevent \"file\" descriptor that was just freed, causing a use-after-free bug.\n\nTo solve this, add a ref count to the event \"file\" descriptor as well as a\nnew flag called \"FREED\". The \"file\" will not be freed until the last\nreference is released. But the FREE flag will be set when the event is\nremoved to prevent any more modifications to that event from happening,\neven if there's still a reference to the event \"file\" descriptor.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: rastreo: Tener trace_event_file tiene contadores de referencia. Lo siguiente puede bloquear el kernel: # cd /sys/kernel/tracing # echo 'p:sched Schedule' &gt; kprobe_events # exec 5&gt;&gt;events /kprobes/sched/enable # &gt; kprobe_events # exec 5&gt;&amp;- Los comandos anteriores: 1. Cambie el directorio al directorio tracefs 2. Cree un evento kprobe (no importa cuál) 3. Abra el descriptor de archivo bash 5 en el habilitar el archivo del evento kprobe 4. Eliminar el evento kprobe (también elimina los archivos) 5. Cerrar el descriptor del archivo bash 5 ¡Lo anterior provoca un bloqueo! BUG: desreferencia del puntero NULL del kernel, dirección: 0000000000000028 #PF: acceso de lectura del supervisor en modo kernel #PF: código_error(0x0000) - página no presente PGD 0 P4D 0 Ups: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 877 Comm: bash Not tainted 6.5.0-rc4-test-00008-g2c6b6b1029d4-dirty #186 Nombre del hardware: PC estándar QEMU (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01 /2014 RIP: 0010:tracing_release_file_tr+0xc/0x50. Lo que sucede aquí es que el evento kprobe crea un descriptor de \"archivo\" trace_event_file que representa el archivo en tracefs hasta el evento. Mantiene el estado del evento (¿está habilitado para la instancia dada?). Al abrir el archivo \"habilitar\" se obtiene una referencia al descriptor de \"archivo\" del evento a través del descriptor de archivo abierto. Cuando se elimina el evento kprobe, el archivo también se elimina del sistema tracefs, lo que también libera el descriptor de \"archivo\" del evento. Pero como el espacio del usuario todavía abre el archivo tracefs, no se eliminará por completo hasta que se llame al dput() final. Pero esto no es cierto con el descriptor de \"archivo\" de evento que ya está liberado. Si el usuario escribe o simplemente cierra el descriptor de archivo, hará referencia al descriptor de \"archivo\" del evento que acaba de liberarse, lo que provocará un error de uso después de la liberación. Para resolver esto, agregue un recuento de referencias al descriptor de \"archivo\" del evento, así como una nueva bandera llamada \"FREED\". El \"archivo\" no se liberará hasta que se publique la última referencia. Pero el indicador FREE se establecerá cuando se elimine el evento para evitar que se realicen más modificaciones en ese evento, incluso si todavía hay una referencia al descriptor de \"archivo\" del evento.","source":"nvd"}],"published":"2024-05-21T15:32:11.263Z","modified":"2026-08-05T09:11:48.431Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"type":"git","introduced":"e6807c873d8791ae5a5186ad05ec66cab926539a","fixed":"961c4511c7578d6b8f39118be919016ec3db1c1e","status":"affected"},{"type":"git","introduced":"407bf1c140f0757706c0b28604bcc90837d45ce2","fixed":"a98172e36e5f1b3d29ad71fade2d611cfcc2fe6f","status":"affected"},{"type":"git","introduced":"fa6d449e4d024d8c17f4288e0567d28ace69415c","fixed":"cbc7c29dff0fa18162f2a3889d82eeefd67305e0","status":"affected"},{"type":"git","introduced":"a46bf337a20f9edd3c8041b025639842280d0575","fixed":"2fa74d29fc1899c237d51bf9a6e132ea5c488976","status":"affected"},{"type":"git","introduced":"9beec04370132a7a6cd1aa9897f6fffc6262ff28","fixed":"2c9de867ca285c397cd71af703763fe416265706","status":"affected"},{"type":"git","introduced":"f5ca233e2e66dc1c249bf07eefa37e34a6c9346a","fixed":"9034c87d61be8cff989017740a91701ac8195a1d","status":"affected"},{"type":"git","introduced":"f5ca233e2e66dc1c249bf07eefa37e34a6c9346a","fixed":"bb32500fb9b78215e4ef6ee8b4345c5f5d7eafb4","status":"affected"},{"type":"semver","introduced":"5.4.258","fixed":"5.4.262","status":"affected"},{"type":"semver","introduced":"5.10.198","fixed":"5.10.202","status":"affected"},{"type":"semver","introduced":"5.15.134","fixed":"5.15.140","status":"affected"},{"type":"semver","introduced":"6.1.55","fixed":"6.1.64","status":"affected"},{"type":"semver","introduced":"6.5.5","fixed":"6.5.13","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.6","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.6","status":"unaffected"},{"type":"semver","introduced":"5.4.262","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.202","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.140","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.64","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.5.13","lastAffected":"6.5.*","status":"unaffected"},{"type":"semver","introduced":"6.6.1","lastAffected":"6.6.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.7","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"5.4.258","fixed":"5.4.262"},{"status":"affected","introduced":"5.10.198","fixed":"5.10.202"},{"status":"affected","introduced":"5.15.134","fixed":"5.15.140"},{"status":"affected","introduced":"6.1.55","fixed":"6.1.64"},{"status":"affected","introduced":"6.5.5","fixed":"6.5.13"},{"status":"affected","introduced":"6.6","fixed":"6.6.1"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/961c4511c7578d6b8f39118be919016ec3db1c1e","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a98172e36e5f1b3d29ad71fade2d611cfcc2fe6f","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cbc7c29dff0fa18162f2a3889d82eeefd67305e0","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2fa74d29fc1899c237d51bf9a6e132ea5c488976","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2c9de867ca285c397cd71af703763fe416265706","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9034c87d61be8cff989017740a91701ac8195a1d","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/bb32500fb9b78215e4ef6ee8b4345c5f5d7eafb4","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-05-21T16:59:47.559Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-52879","url":"https://www.cve.org/CVERecord?id=CVE-2023-52879","licence":"CVE Terms of Use","modified":"2026-08-05T09:11:48.431Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-52879","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-52879","licence":"Public domain","modified":"2026-08-04T10:18:47.223Z"}],"updatedAt":"2026-11-25T22:58:34.068Z","epss":{"score":0.00228,"percentile":0.14435,"date":"2026-12-02T12:00:21.000Z"}}