В ядре Linux устранена следующая уязвимость:
iommu/amd: удалить скрытый внешний доступ в отладочных файлах IOMMU. В iommu_mmio_write() и iommu_capability_write() переменные
dbg_mmio_offset и dbg_cap_offset объявлены как int. Однако они
заполняются с помощью kstrtou32_from_user().
Если пользователь предоставляет
достаточно большое значение, оно может стать отрицательным целым числом. До этого патча реализация отладки AMD IOMMU уже была
защищены разными механизмами.
1. #define OFS_IN_SZ 8 обеспечивает длину пользовательской строки <= 8 байт, поэтому
например 0xffffffff не является допустимым вводом.
если (cnt > OFS_IN_SZ)
вернуть -ЭИНВАЛ;
2. Неявное повышение типа в iommu_mmio_write(), dbg_mmio_offset — int
и iommu->mmio_phys_end — это u64
if (dbg_mmio_offset > iommu->mmio_phys_end - sizeof(u64))
вернуть -ЭИНВАЛ;
3.
Обработчики шоу в настоящее время улавливают отрицательное число и
отказаться от выполнения чтения. Замените kstrtou32_from_user() на kstrtos32_from_user() для анализа
ввод и проверяйте отрицательные значения, чтобы явно предотвратить выход за пределы
доступ к памяти осуществляется напрямую в iommu_mmio_write() и
iommu_capability_write().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: iommu/amd: Remove latent out-of-bounds access in IOMMU debugfs In iommu_mmio_write() and iommu_capability_write(), the variables dbg_mmio_offset and dbg_cap_offset are declared as int. However, they are populated using kstrtou32_from_user(). If a user provides a sufficiently large value, it can become a negative integer. Prior to this patch, the AMD IOMMU debugfs implementation was already protected by different mechanisms. 1. #define OFS_IN_SZ 8 ensures the user string <= 8 bytes, so e.g. 0xffffffff isn't a valid input. if (cnt > OFS_IN_SZ) return -EINVAL; 2. Implicit type promotion in iommu_mmio_write(), dbg_mmio_offset is int and iommu->mmio_phys_end is u64 if (dbg_mmio_offset > iommu->mmio_phys_end - sizeof(u64)) return -EINVAL; 3. The show handlers would currently catch the negative number and refuse to perform the read. Replace kstrtou32_from_user() with kstrtos32_from_user() to parse the input, and check for negative values to explicitly prevent out-of-bounds memory accesses directly in iommu_mmio_write() and iommu_capability_write().
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 5
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.17
|
6.18.34
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.11
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc3:*:*:*:*:*:*
|
— | — |