Ad

CVE-2025-22083

HIGH CVSS 3.1: 7,8 EPSS 0.21%
Обновлено 15 октября 2026
Linux
Параметр Значение
CVSS 7,8 (HIGH)
Уязвимые версии 3.9.1 — 6.6.87
Устранено в версии 6.6.87
Тип уязвимости CWE-416 (Использование памяти после освобождения)
Поставщик Linux
Публичный эксплойт Нет

В ядре Linux устранена следующая уязвимость: vhost-scsi: исправлена обработка нескольких вызовов vhost_scsi_set_endpoint. Если vhost_scsi_set_endpoint вызывается несколько раз без vhost_scsi_clear_endpoint между ними, мы можем обнаружить несколько ошибок нашел Хаоран Чжан: 1. Использовать после освобождения, если tpgs не найдены: Это исправляет использование после освобождения, которое происходит, когда vhost_scsi_set_endpoint звонили более одного раза и звонки после первого звонка не находят tpgs, чтобы добавить его в файл vs_tpg.

Когда vhost_scsi_set_endpoint впервые находит tpgs добавить в массив vs_tpg match=true, поэтому сделаем: vhost_vq_set_backend (vq, vs_tpg); ... kfree (vs-> vs_tpg); vs->vs_tpg = vs_tpg; Если vhost_scsi_set_endpoint вызывается снова и tpgs не найдены match=false, поэтому мы пропускаем вызов vhost_vq_set_backend, оставляя указатель на vs_tpg, который мы затем освобождаем через: kfree (vs-> vs_tpg); vs->vs_tpg = vs_tpg; Если затем отправляется запрос scsi, мы делаем: vhost_scsi_handle_vq -> vhost_scsi_get_req -> vhost_vq_get_backend который видит vs_tpg, на котором мы только что выполнили kfree. 2. Удаление каталога Tpg зависает: Этот патч устраняет проблему, из-за которой мы не можем удалить LIO/целевой уровень. tpg (и структуры над ним, такие как цель) dir из-за счетчика ссылок падает до -1. Проблема в том, что если vhost_scsi_set_endpoint обнаруживает, что tpg уже в массиве vs->vs_tpg или если tpg был удален, поэтому target_dependent_item не работает, обработчик undependent goto сделает это target_undependent_item для всех tpg в массиве vs_tpg, удаляя их refcount равным 0.

На данный момент vs_tpg содержит оба добавленных нами tpg. в текущем вызове vhost_scsi_set_endpoint, а также в tpgs, которые мы добавили в предыдущие вызовы, которые также находятся в vs->vs_tpg. Позже, когда запустится vhost_scsi_clear_endpoint, это произойдет. target_undependent_item для всех tpg в vs->vs_tpg, которые будут удалены их пересчет до -1. Пользовательское пространство тогда не сможет удалить tpg. и зависнет, когда попытается выполнить rmdir в каталоге tpg. 3.

Утечка ТПГ: Это исправляет ошибку, из-за которой мы могли сливать tpgs и вызывать их невозможно удалить, поскольку целевое имя перезаписывается при vhost_scsi_set_endpoint вызывается несколько раз, но с разными целевые имена. Ошибка возникает, если пользователь вызвал VHOST_SCSI_SET_ENDPOINT и установил устройство vhost-scsi для сопоставления target/tpg, затем вызывает VHOST_SCSI_SET_ENDPOINT еще раз с новым целевым именем, имеющим tpgs, которые мы раньше не видел (у цели 1 есть tpg1, а у цели 2 есть tpg2). Когда это случается, что мы не удаляем старое целевое отображение tpg и просто перезаписываем целевое имя и массив vs->vs_tpg.

Позже, когда мы это сделаем vhost_scsi_clear_endpoint, нам передаются либо target1, либо target2 имя, и мы будем сопоставлять tpgs этой цели только при циклическом переборе vs->vs_tpg. Затем мы вернемся из функции, не делая target_undependent_item в tpgs. Из-за всех этих ошибок похоже, что можно позвонить vhost_scsi_set_endpoint несколько раз никогда не поддерживалось.

Главный пользователь QEMU уже имеет проверки для предотвращения этого варианта использования. Итак, чтобы исправить проблемы, этот патч предотвращает вызов vhost_scsi_set_endpoint если он уже успешно добавил tpgs. Чтобы добавить, удалить или изменить tpg или целевое имя, вы должны выполнить vhost_scsi_clear_endpoint сначала.

Показать оригинальное описание (EN)

In the Linux kernel, the following vulnerability has been resolved: vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint If vhost_scsi_set_endpoint is called multiple times without a vhost_scsi_clear_endpoint between them, we can hit multiple bugs found by Haoran Zhang: 1. Use-after-free when no tpgs are found: This fixes a use after free that occurs when vhost_scsi_set_endpoint is called more than once and calls after the first call do not find any tpgs to add to the vs_tpg. When vhost_scsi_set_endpoint first finds tpgs to add to the vs_tpg array match=true, so we will do: vhost_vq_set_backend(vq, vs_tpg); ... kfree(vs->vs_tpg); vs->vs_tpg = vs_tpg; If vhost_scsi_set_endpoint is called again and no tpgs are found match=false so we skip the vhost_vq_set_backend call leaving the pointer to the vs_tpg we then free via: kfree(vs->vs_tpg); vs->vs_tpg = vs_tpg; If a scsi request is then sent we do: vhost_scsi_handle_vq -> vhost_scsi_get_req -> vhost_vq_get_backend which sees the vs_tpg we just did a kfree on. 2. Tpg dir removal hang: This patch fixes an issue where we cannot remove a LIO/target layer tpg (and structs above it like the target) dir due to the refcount dropping to -1. The problem is that if vhost_scsi_set_endpoint detects a tpg is already in the vs->vs_tpg array or if the tpg has been removed so target_depend_item fails, the undepend goto handler will do target_undepend_item on all tpgs in the vs_tpg array dropping their refcount to 0. At this time vs_tpg contains both the tpgs we have added in the current vhost_scsi_set_endpoint call as well as tpgs we added in previous calls which are also in vs->vs_tpg. Later, when vhost_scsi_clear_endpoint runs it will do target_undepend_item on all the tpgs in the vs->vs_tpg which will drop their refcount to -1. Userspace will then not be able to remove the tpg and will hang when it tries to do rmdir on the tpg dir. 3. Tpg leak: This fixes a bug where we can leak tpgs and cause them to be un-removable because the target name is overwritten when vhost_scsi_set_endpoint is called multiple times but with different target names. The bug occurs if a user has called VHOST_SCSI_SET_ENDPOINT and setup a vhost-scsi device to target/tpg mapping, then calls VHOST_SCSI_SET_ENDPOINT again with a new target name that has tpgs we haven't seen before (target1 has tpg1 but target2 has tpg2). When this happens we don't teardown the old target tpg mapping and just overwrite the target name and the vs->vs_tpg array. Later when we do vhost_scsi_clear_endpoint, we are passed in either target1 or target2's name and we will only match that target's tpgs when we loop over the vs->vs_tpg. We will then return from the function without doing target_undepend_item on the tpgs. Because of all these bugs, it looks like being able to call vhost_scsi_set_endpoint multiple times was never supported. The major user, QEMU, already has checks to prevent this use case. So to fix the issues, this patch prevents vhost_scsi_set_endpoint from being called if it's already successfully added tpgs. To add, remove or change the tpg config or target name, you must do a vhost_scsi_clear_endpoint first.

Характеристики атаки

Способ атаки
Локальный
Нужен локальный доступ
Сложность
Низкая
Легко эксплуатировать
Нужны права
Низкие
Нужны базовые права
Участие пользователя
Не требуется
Не нужно действие пользователя

Последствия

Конфиденциальность
Высокое
Полная утечка данных
Целостность
Высокое
Полная модификация данных
Доступность
Высокое
Полный отказ в обслуживании

Строка CVSS v3.1

Уязвимые продукты 7

Конфигурация От (включительно) До (исключительно)
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
3.9.1 6.6.87
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
6.7 6.12.23
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
6.13 6.13.11
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
6.14 6.14.2
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:3.9:-:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:3.9:rc7:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:3.9:rc8:*:*:*:*:*:*
— —