The Linux Kernel versions 2.6.38 through 4.14 have a problematic use of pmd_mkdirty() in the touch_pmd() function inside the THP…
mitre·CWE-362·Published 2017-11-30
The Linux Kernel versions 2.6.38 through 4.14 have a problematic use of pmd_mkdirty() in the touch_pmd() function inside the THP implementation. touch_pmd() can be reached by get_user_pages(). In such case, the pmd will become dirty. This scenario breaks the new can_follow_write_pmd()'s logic - pmd can become dirty without going through a COW cycle. This bug is not as severe as the original "Dirty cow" because an ext4 file (or any other regular file) cannot be mapped using THP. Nevertheless, it does allow us to overwrite read-only huge pages. For example, the zero huge page and sealed shmem files can be overwritten (since their mapping can be populated using THP). Note that after the first write page-fault to the zero page, it will be replaced with a new fresh (and zeroed) thp.
The Linux Kernel versions 2.6.38 through 4.14 have a problematic use of pmd_mkdirty() in the touch_pmd() function inside the THP implementation. touch_pmd() can be reached by get_user_pages(). In such case, the pmd will become dirty. This scenario breaks the new can_follow_write_pmd()'s logic - pmd can become dirty without going through a COW cycle. This bug is not as severe as the original "Dirty cow" because an ext4 file (or any other regular file) cannot be mapped using THP. Nevertheless, it does allow us to overwrite read-only huge pages. For example, the zero huge page and sealed shmem files can be overwritten (since their mapping can be populated using THP). Note that after the first write page-fault to the zero page, it will be replaced with a new fresh (and zeroed) thp.
El kernel de Linux desde la versión 2.6.38 hasta la 4.14 presenta un uso problemático de pmd_mkdirty() en la función touch_pmd() dentro de la implementación THP. Se puede llegar a touch_pmd() con get_user_pages(). En ese caso, el pmd se ensuciaría. Este escenario rompe la nueva lógica de can_follow_write_pmd(). pmd puede contaminarse sin pasar por un ciclo COW. Este fallo no es tan severo como el error original "Dirty COW" porque un archivo ext4 (o cualquier otro archivo normal) no puede ser mapeado usando THP. Sin embargo, permite sobrescribir huge pages de solo lectura. Por ejemplo, los archivos shmem sellados y huge pages con ceros pueden sobrescribirse (ya que se pueden mapear con THP). Tenga en cuenta que después del primer error de escritura de página en la página con cero, se reemplazará por un nuevo thp (y con ceros).
| Version | Type | Source | Base | Exp | Impact | Vector |
|---|---|---|---|---|---|---|
| 2.0 | Primary | NVD | 6.9 | 3.4 | 10.0 | AV:L/AC:M/Au:N/C:C/I:C/A:C |
| 3.1 | Primary | NVD | 7.0 | 1.0 | 5.9 | CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H |