security-advisory-tfv-11.rst 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Advisory TFV-11 (CVE-2023-49100)
  2. ================================
  3. +----------------+-------------------------------------------------------------+
  4. | Title | A Malformed SDEI SMC can cause out of bound memory read. |
  5. +================+=============================================================+
  6. | CVE ID | `CVE-2023-49100`_ |
  7. +----------------+-------------------------------------------------------------+
  8. | Date | Reported on 12 Oct 2023 |
  9. +----------------+-------------------------------------------------------------+
  10. | Versions | TF-A releases v1.5 to v2.9 |
  11. | Affected | LTS releases lts-v2.8.0 to lts-v2.8.11 |
  12. +----------------+-------------------------------------------------------------+
  13. | Configurations | Platforms with SDEI support |
  14. | Affected | |
  15. +----------------+-------------------------------------------------------------+
  16. | Impact | Denial of Service (secure world panic) |
  17. +----------------+-------------------------------------------------------------+
  18. | Fix Version | `a7eff3477`_ "fix(sdei): ensure that interrupt ID is valid" |
  19. +----------------+-------------------------------------------------------------+
  20. | Credit | Christian Lindenmeier `@_chli_`_ |
  21. | | Marcel Busch `@0ddc0de`_ |
  22. | | `IT Security Infrastructures Lab`_ |
  23. +----------------+-------------------------------------------------------------+
  24. This security advisory describes a vulnerability in the SDEI services, where a
  25. rogue Non-secure caller invoking a SDEI_INTERRUPT_BIND SMC call with an invalid
  26. interrupt ID causes out of bound memory read.
  27. SDEI_INTERRUPT_BIND is used to bind any physical interrupt into a normal
  28. priority SDEI event. The interrupt can be a private peripheral interrupt
  29. (PPI) or a shared peripheral interrupt (SPI).
  30. Refer to SDEI_INTERRUPT_BIND in the `SDEI Specification`_ for further details.
  31. The vulnerability exists when the SDEI client passes an interrupt ID which
  32. is not implemented by the GIC. This will result in a data abort exception
  33. or a EL3 panic depending on the GIC version used in the system.
  34. - **GICv2 systems:**
  35. .. code:: c
  36. Call stack:
  37. sdei_interrupt_bind(interrupt ID)
  38. -> plat_ic_get_interrupt_type(interrupt ID)
  39. -> gicv2_get_interrupt_group(interrupt ID)
  40. -> gicd_get_igroupr(distributor base, interrupt ID)
  41. -> gicd_read_igroupr(distributor base, interrupt ID).
  42. gicd_read_igroupr() will eventually do a MMIO read to an unimplemented IGROUPR
  43. register. Which may cause a data abort or an access to a random EL3 memory region.
  44. - **GICv3 systems:**
  45. .. code:: c
  46. Call stack:
  47. sdei_interrupt_bind(interrupt ID)
  48. -> plat_ic_get_interrupt_type(interrupt ID)
  49. -> gicv3_get_interrupt_group(interrupt ID, core ID)
  50. -> is_sgi_ppi(interrupt ID)
  51. is_sgi_ppi() will end up in an EL3 panic on encountering an invalid interrupt ID.
  52. The vulnerability is fixed by ensuring that the Interrupt ID provided by the
  53. SDEI client is a valid PPI or SPI, otherwise return an error code indicating
  54. that the parameter is invalid.
  55. .. code:: c
  56. /* Bind an SDEI event to an interrupt */
  57. static int sdei_interrupt_bind(unsigned int intr_num)
  58. {
  59. sdei_ev_map_t *map;
  60. bool retry = true, shared_mapping;
  61. /* Interrupt must be either PPI or SPI */
  62. if (!(plat_ic_is_ppi(intr_num) || plat_ic_is_spi(intr_num)))
  63. return SDEI_EINVAL;
  64. .. _CVE-2023-49100: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-49100
  65. .. _a7eff3477: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=a7eff3477dcf3624c74f5217419b1a27b7ebd2aa
  66. .. _IT Security Infrastructures Lab: https://www.cs1.tf.fau.de/
  67. .. _SDEI Specification: https://developer.arm.com/documentation/den0054/latest/
  68. .. _@_chli_: https://twitter.com/_chli_
  69. .. _@0ddc0de: https://twitter.com/0ddc0de