cve-2023-52894
Vulnerability from cvelistv5
Published
2024-08-21 06:10
Modified
2024-11-04 14:54
Severity ?
Summary
usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()
Impacted products
Vendor Product Version
Linux Linux
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2023-52894",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-09-10T16:03:50.056364Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-09-12T17:33:13.931Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/usb/gadget/function/f_ncm.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "fef6b29671b6",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "63d161f29cd3",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "a21da7f7aae6",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "e92c70059178",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "a69c8dfb85b4",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "09e4507ec8ef",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "c6ec929595c7",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/usb/gadget/function/f_ncm.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThanOrEqual": "4.14.*",
              "status": "unaffected",
              "version": "4.14.304",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "4.19.*",
              "status": "unaffected",
              "version": "4.19.271",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.4.*",
              "status": "unaffected",
              "version": "5.4.230",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.165",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.90",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.8",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.2",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()\n\nIn Google internal bug 265639009 we\u0027ve received an (as yet) unreproducible\ncrash report from an aarch64 GKI 5.10.149-android13 running device.\n\nAFAICT the source code is at:\n  https://android.googlesource.com/kernel/common/+/refs/tags/ASB-2022-12-05_13-5.10\n\nThe call stack is:\n  ncm_close() -\u003e ncm_notify() -\u003e ncm_do_notify()\nwith the crash at:\n  ncm_do_notify+0x98/0x270\nCode: 79000d0b b9000a6c f940012a f9400269 (b9405d4b)\n\nWhich I believe disassembles to (I don\u0027t know ARM assembly, but it looks sane enough to me...):\n\n  // halfword (16-bit) store presumably to event-\u003ewLength (at offset 6 of struct usb_cdc_notification)\n  0B 0D 00 79    strh w11, [x8, #6]\n\n  // word (32-bit) store presumably to req-\u003eLength (at offset 8 of struct usb_request)\n  6C 0A 00 B9    str  w12, [x19, #8]\n\n  // x10 (NULL) was read here from offset 0 of valid pointer x9\n  // IMHO we\u0027re reading \u0027cdev-\u003egadget\u0027 and getting NULL\n  // gadget is indeed at offset 0 of struct usb_composite_dev\n  2A 01 40 F9    ldr  x10, [x9]\n\n  // loading req-\u003ebuf pointer, which is at offset 0 of struct usb_request\n  69 02 40 F9    ldr  x9, [x19]\n\n  // x10 is null, crash, appears to be attempt to read cdev-\u003egadget-\u003emax_speed\n  4B 5D 40 B9    ldr  w11, [x10, #0x5c]\n\nwhich seems to line up with ncm_do_notify() case NCM_NOTIFY_SPEED code fragment:\n\n  event-\u003ewLength = cpu_to_le16(8);\n  req-\u003elength = NCM_STATUS_BYTECOUNT;\n\n  /* SPEED_CHANGE data is up/down speeds in bits/sec */\n  data = req-\u003ebuf + sizeof *event;\n  data[0] = cpu_to_le32(ncm_bitrate(cdev-\u003egadget));\n\nMy analysis of registers and NULL ptr deref crash offset\n  (Unable to handle kernel NULL pointer dereference at virtual address 000000000000005c)\nheavily suggests that the crash is due to \u0027cdev-\u003egadget\u0027 being NULL when executing:\n  data[0] = cpu_to_le32(ncm_bitrate(cdev-\u003egadget));\nwhich calls:\n  ncm_bitrate(NULL)\nwhich then calls:\n  gadget_is_superspeed(NULL)\nwhich reads\n  ((struct usb_gadget *)NULL)-\u003emax_speed\nand hits a panic.\n\nAFAICT, if I\u0027m counting right, the offset of max_speed is indeed 0x5C.\n(remember there\u0027s a GKI KABI reservation of 16 bytes in struct work_struct)\n\nIt\u0027s not at all clear to me how this is all supposed to work...\nbut returning 0 seems much better than panic-ing..."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-11-04T14:54:42.667Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/fef6b29671b66dfb71f17e337c1ad14b5a2cedae"
        },
        {
          "url": "https://git.kernel.org/stable/c/63d161f29cd39c050e8873aa36e0c9fc013bb763"
        },
        {
          "url": "https://git.kernel.org/stable/c/a21da7f7aae618c785f7e4a275d43c06dc8412b6"
        },
        {
          "url": "https://git.kernel.org/stable/c/e92c70059178da751e5af7de02384b7dfadb5ec7"
        },
        {
          "url": "https://git.kernel.org/stable/c/a69c8dfb85b44be9cc223be07d35cc3a9baefbea"
        },
        {
          "url": "https://git.kernel.org/stable/c/09e4507ec8ef2d44da6ba4092b8ee2d81f216497"
        },
        {
          "url": "https://git.kernel.org/stable/c/c6ec929595c7443250b2a4faea988c62019d5cd2"
        }
      ],
      "title": "usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()",
      "x_generator": {
        "engine": "bippy-9e1c9544281a"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-52894",
    "datePublished": "2024-08-21T06:10:34.120Z",
    "dateReserved": "2024-08-21T06:07:11.013Z",
    "dateUpdated": "2024-11-04T14:54:42.667Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-52894\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-08-21T07:15:05.943\",\"lastModified\":\"2024-09-11T16:27:06.380\",\"vulnStatus\":\"Analyzed\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nusb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()\\n\\nIn Google internal bug 265639009 we\u0027ve received an (as yet) unreproducible\\ncrash report from an aarch64 GKI 5.10.149-android13 running device.\\n\\nAFAICT the source code is at:\\n  https://android.googlesource.com/kernel/common/+/refs/tags/ASB-2022-12-05_13-5.10\\n\\nThe call stack is:\\n  ncm_close() -\u003e ncm_notify() -\u003e ncm_do_notify()\\nwith the crash at:\\n  ncm_do_notify+0x98/0x270\\nCode: 79000d0b b9000a6c f940012a f9400269 (b9405d4b)\\n\\nWhich I believe disassembles to (I don\u0027t know ARM assembly, but it looks sane enough to me...):\\n\\n  // halfword (16-bit) store presumably to event-\u003ewLength (at offset 6 of struct usb_cdc_notification)\\n  0B 0D 00 79    strh w11, [x8, #6]\\n\\n  // word (32-bit) store presumably to req-\u003eLength (at offset 8 of struct usb_request)\\n  6C 0A 00 B9    str  w12, [x19, #8]\\n\\n  // x10 (NULL) was read here from offset 0 of valid pointer x9\\n  // IMHO we\u0027re reading \u0027cdev-\u003egadget\u0027 and getting NULL\\n  // gadget is indeed at offset 0 of struct usb_composite_dev\\n  2A 01 40 F9    ldr  x10, [x9]\\n\\n  // loading req-\u003ebuf pointer, which is at offset 0 of struct usb_request\\n  69 02 40 F9    ldr  x9, [x19]\\n\\n  // x10 is null, crash, appears to be attempt to read cdev-\u003egadget-\u003emax_speed\\n  4B 5D 40 B9    ldr  w11, [x10, #0x5c]\\n\\nwhich seems to line up with ncm_do_notify() case NCM_NOTIFY_SPEED code fragment:\\n\\n  event-\u003ewLength = cpu_to_le16(8);\\n  req-\u003elength = NCM_STATUS_BYTECOUNT;\\n\\n  /* SPEED_CHANGE data is up/down speeds in bits/sec */\\n  data = req-\u003ebuf + sizeof *event;\\n  data[0] = cpu_to_le32(ncm_bitrate(cdev-\u003egadget));\\n\\nMy analysis of registers and NULL ptr deref crash offset\\n  (Unable to handle kernel NULL pointer dereference at virtual address 000000000000005c)\\nheavily suggests that the crash is due to \u0027cdev-\u003egadget\u0027 being NULL when executing:\\n  data[0] = cpu_to_le32(ncm_bitrate(cdev-\u003egadget));\\nwhich calls:\\n  ncm_bitrate(NULL)\\nwhich then calls:\\n  gadget_is_superspeed(NULL)\\nwhich reads\\n  ((struct usb_gadget *)NULL)-\u003emax_speed\\nand hits a panic.\\n\\nAFAICT, if I\u0027m counting right, the offset of max_speed is indeed 0x5C.\\n(remember there\u0027s a GKI KABI reservation of 16 bytes in struct work_struct)\\n\\nIt\u0027s not at all clear to me how this is all supposed to work...\\nbut returning 0 seems much better than panic-ing...\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: usb: gadget: f_ncm: corrige potencial NULL ptr deref en ncm_bitrate() En el error interno de Google 265639009 hemos recibido un informe de fallo (hasta ahora) irreproducible de un aarch64 GKI 5.10. Dispositivo en ejecuci\u00f3n 149-android13. AFAICT, el c\u00f3digo fuente est\u00e1 en: https://android.googlesource.com/kernel/common/+/refs/tags/ASB-2022-12-05_13-5.10 La pila de llamadas es: ncm_close() -\u0026gt; ncm_notify() - \u0026gt; ncm_do_notify() con el bloqueo en: ncm_do_notify+0x98/0x270 C\u00f3digo: 79000d0b b9000a6c f940012a f9400269 (b9405d4b) El cual creo que se desmonta (no conozco el ensamblaje de ARM, pero me parece bastante sensato...): / / almac\u00e9n de media palabra (16 bits) presumiblemente en evento-\u0026gt;wLength (en el desplazamiento 6 de la estructura usb_cdc_notification) 0B 0D 00 79 strh w11, [x8, #6] // almac\u00e9n de palabra (32 bits) presumiblemente en req-\u0026gt;Longitud (en el desplazamiento 8 de la estructura usb_request) 6C 0A 00 B9 str w12, [x19, #8] // aqu\u00ed se ley\u00f3 x10 (NULL) desde el desplazamiento 0 del puntero v\u00e1lido x9 // En mi humilde opini\u00f3n, estamos leyendo \u0027cdev-\u0026gt;gadget\u0027 y obtener NULL // el gadget est\u00e1 de hecho en el desplazamiento 0 de la estructura usb_composite_dev 2A 01 40 F9 ldr x10, [x9] // cargando el puntero req-\u0026gt;buf, que est\u00e1 en el desplazamiento 0 de la estructura usb_request 69 02 40 F9 ldr x9, [x19 ] // x10 es nulo, falla, parece ser un intento de leer cdev-\u0026gt;gadget-\u0026gt;max_speed 4B 5D 40 B9 ldr w11, [x10, #0x5c] que parece alinearse con ncm_do_notify() caso NCM_NOTIFY_SPEED fragmento de c\u00f3digo: evento -\u0026gt;wLongitud = cpu_to_le16(8); solicitud-\u0026gt;longitud = NCM_STATUS_BYTECOUNT; /* Los datos SPEED_CHANGE son velocidades de subida/bajada en bits/seg. */ data = req-\u0026gt;buf + sizeof *event; datos[0] = cpu_to_le32(ncm_bitrate(cdev-\u0026gt;gadget)); Mi an\u00e1lisis de los registros y la compensaci\u00f3n de fallas de NULL ptr deref (no se puede manejar la desreferencia del puntero NULL del kernel en la direcci\u00f3n virtual 000000000000005c) sugiere en gran medida que la falla se debe a que \u0027cdev-\u0026gt;gadget\u0027 es NULL al ejecutar: datos[0] = cpu_to_le32(ncm_bitrate (cdev-\u0026gt;gadget)); que llama: ncm_bitrate(NULL) que luego llama: gadget_is_superspeed(NULL) que lee ((struct usb_gadget *)NULL)-\u0026gt;max_speed y entra en p\u00e1nico. AFAICT, si estoy contando bien, el desplazamiento de max_speed es de hecho 0x5C. (recuerde que hay una reserva GKI KABI de 16 bytes en la estructura work_struct) No me queda del todo claro c\u00f3mo se supone que funciona todo esto... pero devolver 0 parece mucho mejor que entrar en p\u00e1nico...\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H\",\"baseScore\":5.5,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"NONE\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":3.6}]},\"weaknesses\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-476\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionEndExcluding\":\"4.14.304\",\"matchCriteriaId\":\"E8A9B982-D3D6-49CA-BF0A-196ED7947B3A\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"4.15\",\"versionEndExcluding\":\"4.19.271\",\"matchCriteriaId\":\"D86DA289-B5BC-4629-BD56-AB453D481393\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"4.20\",\"versionEndExcluding\":\"5.4.230\",\"matchCriteriaId\":\"9DB7398D-9781-49C5-B2AE-1969B694B614\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.5\",\"versionEndExcluding\":\"5.10.165\",\"matchCriteriaId\":\"C6002D5B-9B6A-4788-B943-E3EE01E01303\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.11\",\"versionEndExcluding\":\"5.15.90\",\"matchCriteriaId\":\"E995CDA5-7223-4FDB-BAD3-81B22C763A43\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.16\",\"versionEndExcluding\":\"6.1.8\",\"matchCriteriaId\":\"A6AFE6C9-3F59-4711-B2CF-7D6682FF6BD0\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc1:*:*:*:*:*:*\",\"matchCriteriaId\":\"FF501633-2F44-4913-A8EE-B021929F49F6\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc2:*:*:*:*:*:*\",\"matchCriteriaId\":\"2BDA597B-CAC1-4DF0-86F0-42E142C654E9\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc3:*:*:*:*:*:*\",\"matchCriteriaId\":\"725C78C9-12CE-406F-ABE8-0813A01D66E8\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:6.2:rc4:*:*:*:*:*:*\",\"matchCriteriaId\":\"A127C155-689C-4F67-B146-44A57F4BFD85\"}]}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/09e4507ec8ef2d44da6ba4092b8ee2d81f216497\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/63d161f29cd39c050e8873aa36e0c9fc013bb763\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/a21da7f7aae618c785f7e4a275d43c06dc8412b6\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/a69c8dfb85b44be9cc223be07d35cc3a9baefbea\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/c6ec929595c7443250b2a4faea988c62019d5cd2\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/e92c70059178da751e5af7de02384b7dfadb5ec7\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/fef6b29671b66dfb71f17e337c1ad14b5a2cedae\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.