8.4high
kdb: Fix buffer overflow during tab-complete
- Severity
- 8.4high CVSS:3.1 by Linux
- Exploit likelihood
- 0.27% (higher than 20% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: kdb: Fix buffer overflow during tab-complete Currently, when the user attempts symbol completion with the Tab key, kdb will use strncpy() to insert the completed symbol into the command buffer. Unfortunately it passes the size of the source buffer rather than the destination to strncpy() with predictably horrible results. Most obviously if the command buffer is already full but cp, the cursor position, is in the middle of the buffer, then we will write past the end of the supplied buffer. Fix this by replacing the dubious strncpy() calls with memmove()/memcpy() calls plus explicit boundary checks to make sure we have enough space before we start moving characters around.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before fb824a99e148ff272a53d71d84122728b5f00992, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before ddd2972d8e2dee3b33e8121669d55def59f0be8a, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before cfdc2fa4db57503bc6d3817240547c8ddc55fa96, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before f636a40834d22e5e3fc748f060211879c056cd33, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before 33d9c814652b971461d1e30bead6792851c209e7, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before 107e825cc448b7834b31e8b1b3cf0f57426d46d5, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before f694da720dcf795dc3eb97bf76d220213f76aaa7, from 5d5314d6795f3c1c0f415348ff8c51f7de042b77 before e9730744bf3af04cda23799029342aa3cddbc454 and 1 more Not affected: before 2.6.35, from 4.19.316 up to 4.19.*, from 5.4.278 up to 5.4.*, from 5.10.219 up to 5.10.*, from 5.15.161 up to 5.15.*, from 6.1.94 up to 6.1.* | CVE List |
| linux linux_kernel | from 1da177e4c3f4 before fb824a99e148, from 1da177e4c3f4 before ddd2972d8e2d, from 1da177e4c3f4 before cfdc2fa4db57, from 1da177e4c3f4 before f636a40834d2, from 1da177e4c3f4 before 33d9c814652b, from 1da177e4c3f4 before 107e825cc448, from 1da177e4c3f4 before f694da720dcf, from 1da177e4c3f4 before e9730744bf3a and 7 more Not affected: from 4.19.316 up to 4.20, from 5.4.278 up to 5.5, from 5.10.219 up to 5.11, from 5.15.161 up to 5.16, from 6.1.94 up to 6.2, from 6.6.34 up to 6.7 | CVE List, NVD |
All scores
| Linux | 8.4high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| CISA-ADP | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: kdb: Fix buffer overflow during tab-complete Currently, when the user attempts symbol completion with the Tab key, kdb will use strncpy() to insert the completed symbol into the command buffer. Unfortunately it passes the size of the source buffer rather than the destination to strncpy() with predictably horrible results. Most obviously if the command buffer is already full but cp, the cursor position, is in the middle of the buffer, then we will write past the end of the supplied buffer. Fix this by replacing the dubious strncpy() calls with memmove()/memcpy() calls plus explicit boundary checks to make sure we have enough space before we start moving characters around.
NVD (es)
En el kernel de Linux, se resolvió la siguiente vulnerabilidad: kdb: corrige el desbordamiento del búfer durante la finalización de tabulación Actualmente, cuando el usuario intenta completar el símbolo con la tecla Tab, kdb usará strncpy() para insertar el símbolo completado en el búfer de comando. Desafortunadamente, pasa el tamaño del búfer de origen en lugar del destino a strncpy() con resultados predeciblemente horribles. Lo más obvio es que si el búfer de comando ya está lleno pero cp, la posición del cursor, está en el medio del búfer, entonces escribiremos más allá del final del búfer proporcionado. Solucione este problema reemplazando las dudosas llamadas strncpy() con llamadas memmove()/memcpy() más comprobaciones explícitas de los límites para asegurarnos de que tenemos suficiente espacio antes de comenzar a mover los personajes.
References
| https://git.kernel.org/stable/c/fb824a99e148ff272a53d71d84122728b5f00992 | mailing-list, patch | |
| https://git.kernel.org/stable/c/ddd2972d8e2dee3b33e8121669d55def59f0be8a | mailing-list, patch | |
| https://git.kernel.org/stable/c/cfdc2fa4db57503bc6d3817240547c8ddc55fa96 | mailing-list, patch | |
| https://git.kernel.org/stable/c/f636a40834d22e5e3fc748f060211879c056cd33 | mailing-list, patch | |
| https://git.kernel.org/stable/c/33d9c814652b971461d1e30bead6792851c209e7 | mailing-list, patch | |
| https://git.kernel.org/stable/c/107e825cc448b7834b31e8b1b3cf0f57426d46d5 | mailing-list, patch | |
| https://git.kernel.org/stable/c/f694da720dcf795dc3eb97bf76d220213f76aaa7 | mailing-list, patch | |
| https://git.kernel.org/stable/c/e9730744bf3af04cda23799029342aa3cddbc454 | mailing-list, patch | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-39480 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2024-39480 changed 2026-08-04 | Public domain |