CVE-2025-39998
JSON

7.1high

scsi: target: target_core_configfs: Add length check to avoid buffer overflow

Severity
7.1high CVSS:3.1 by Linux
Exploit likelihood
0.18% (higher than 7% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

In the Linux kernel, the following vulnerability has been resolved: scsi: target: target_core_configfs: Add length check to avoid buffer overflow A buffer overflow arises from the usage of snprintf to write into the buffer "buf" in target_lu_gp_members_show function located in /drivers/target/target_core_configfs.c. This buffer is allocated with size LU_GROUP_NAME_BUF (256 bytes). snprintf(...) formats multiple strings into buf with the HBA name (hba->hba_group.cg_item), a slash character, a devicename (dev-> dev_group.cg_item) and a newline character, the total formatted string length may exceed the buffer size of 256 bytes. Since snprintf() returns the total number of bytes that would have been written (the length of %s/%sn ), this value may exceed the buffer length (256 bytes) passed to memcpy(), this will ultimately cause function memcpy reporting a buffer overflow error. An additional check of the return value of snprintf() can avoid this buffer overflow.

Affected

Product or packageVersionsReported by
Linux Linuxfrom c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before e6eeee5dc0d9221ff96d1b229b1d0222c8871b84, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before 764a91e2fc9639e07aac93bc70e387e6b1e33084, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before ddc79fba132b807ff775467acceaf48b456e008b, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before e73fe0eefac3e15bf88fb5b4afae4c76215ee4d4, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before f03aa5e39da7d045615b3951d2a6ca1d7132f881, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before 53c6351597e6a17ec6619f6f060d54128cb9a187, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before 4b292286949588bd2818e66ff102db278de8dd26, from c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 before a150275831b765b0f1de8b8ff52ec5c6933ac15d and 2 more
Not affected: before 2.6.38, from 5.4.301 up to 5.4.*, from 5.10.246 up to 5.10.*, from 5.15.195 up to 5.15.*, from 6.1.156 up to 6.1.*, from 6.6.110 up to 6.6.*
CVE List

Classification

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: scsi: target: target_core_configfs: Add length check to avoid buffer overflow A buffer overflow arises from the usage of snprintf to write into the buffer "buf" in target_lu_gp_members_show function located in /drivers/target/target_core_configfs.c. This buffer is allocated with size LU_GROUP_NAME_BUF (256 bytes). snprintf(...) formats multiple strings into buf with the HBA name (hba->hba_group.cg_item), a slash character, a devicename (dev-> dev_group.cg_item) and a newline character, the total formatted string length may exceed the buffer size of 256 bytes. Since snprintf() returns the total number of bytes that would have been written (the length of %s/%sn ), this value may exceed the buffer length (256 bytes) passed to memcpy(), this will ultimately cause function memcpy reporting a buffer overflow error. An additional check of the return value of snprintf() can avoid this buffer overflow.

NVD (es)

En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: scsi: target: target_core_configfs: Añadir comprobación de longitud para evitar desbordamiento de búfer Un desbordamiento de búfer surge del uso de snprintf para escribir en el búfer 'buf' en la función target_lu_gp_members_show ubicada en /drivers/target/target_core_configfs.c. Este búfer se asigna con un tamaño de LU_GROUP_NAME_BUF (256 bytes). snprintf(...) formatea múltiples cadenas en buf con el nombre del HBA (hba->hba_group.cg_item), un carácter de barra, un nombre de dispositivo (dev->dev_group.cg_item) y un carácter de nueva línea, la longitud total de la cadena formateada puede exceder el tamaño del búfer de 256 bytes. Dado que snprintf() devuelve el número total de bytes que se habrían escrito (la longitud de %s/%sn ), este valor puede exceder la longitud del búfer (256 bytes) pasada a memcpy(), lo que finalmente hará que la función memcpy informe un error de desbordamiento de búfer. Una comprobación adicional del valor de retorno de snprintf() puede evitar este desbordamiento de búfer.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-39998 changed 2026-10-15CVE Terms of Use
NVDCVE-2025-39998 changed 2026-10-19Public domain