cve-2024-35970
Vulnerability from cvelistv5
Published
2024-05-20 09:41
Modified
2024-11-05 09:25
Summary
af_unix: Clear stale u->oob_skb.
Impacted products
Vendor Product Version
Linux Linux Version: 5.15
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "cvssV3_1": {
              "attackComplexity": "LOW",
              "attackVector": "NETWORK",
              "availabilityImpact": "LOW",
              "baseScore": 6.3,
              "baseSeverity": "MEDIUM",
              "confidentialityImpact": "LOW",
              "integrityImpact": "LOW",
              "privilegesRequired": "LOW",
              "scope": "UNCHANGED",
              "userInteraction": "NONE",
              "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L",
              "version": "3.1"
            }
          },
          {
            "other": {
              "content": {
                "id": "CVE-2024-35970",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-05-20T14:23:05.468197Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "problemTypes": [
          {
            "descriptions": [
              {
                "description": "CWE-noinfo Not enough information",
                "lang": "en",
                "type": "CWE"
              }
            ]
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-11-01T18:47:14.276Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T03:21:49.053Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/b4bc99d04c689b5652665394ae8d3e02fb754153"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/84a352b7eba1142a95441380058985ff19f25ec9"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/601a89ea24d05089debfa2dc896ea9f5937ac7a6"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/698a95ade1a00e6494482046902b986dfffd1caf"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/b46f4eaa4f0ec38909fb0072eea3aeddb32f954e"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "net/unix/af_unix.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "b4bc99d04c68",
              "status": "affected",
              "version": "314001f0bf92",
              "versionType": "git"
            },
            {
              "lessThan": "84a352b7eba1",
              "status": "affected",
              "version": "314001f0bf92",
              "versionType": "git"
            },
            {
              "lessThan": "601a89ea24d0",
              "status": "affected",
              "version": "314001f0bf92",
              "versionType": "git"
            },
            {
              "lessThan": "698a95ade1a0",
              "status": "affected",
              "version": "314001f0bf92",
              "versionType": "git"
            },
            {
              "lessThan": "b46f4eaa4f0e",
              "status": "affected",
              "version": "314001f0bf92",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "net/unix/af_unix.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.15"
            },
            {
              "lessThan": "5.15",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.156",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.87",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.28",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.8.*",
              "status": "unaffected",
              "version": "6.8.7",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.9",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\naf_unix: Clear stale u-\u003eoob_skb.\n\nsyzkaller started to report deadlock of unix_gc_lock after commit\n4090fa373f0e (\"af_unix: Replace garbage collection algorithm.\"), but\nit just uncovers the bug that has been there since commit 314001f0bf92\n(\"af_unix: Add OOB support\").\n\nThe repro basically does the following.\n\n  from socket import *\n  from array import array\n\n  c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)\n  c1.sendmsg([b\u0027a\u0027], [(SOL_SOCKET, SCM_RIGHTS, array(\"i\", [c2.fileno()]))], MSG_OOB)\n  c2.recv(1)  # blocked as no normal data in recv queue\n\n  c2.close()  # done async and unblock recv()\n  c1.close()  # done async and trigger GC\n\nA socket sends its file descriptor to itself as OOB data and tries to\nreceive normal data, but finally recv() fails due to async close().\n\nThe problem here is wrong handling of OOB skb in manage_oob().  When\nrecvmsg() is called without MSG_OOB, manage_oob() is called to check\nif the peeked skb is OOB skb.  In such a case, manage_oob() pops it\nout of the receive queue but does not clear unix_sock(sk)-\u003eoob_skb.\nThis is wrong in terms of uAPI.\n\nLet\u0027s say we send \"hello\" with MSG_OOB, and \"world\" without MSG_OOB.\nThe \u0027o\u0027 is handled as OOB data.  When recv() is called twice without\nMSG_OOB, the OOB data should be lost.\n\n  \u003e\u003e\u003e from socket import *\n  \u003e\u003e\u003e c1, c2 = socketpair(AF_UNIX, SOCK_STREAM, 0)\n  \u003e\u003e\u003e c1.send(b\u0027hello\u0027, MSG_OOB)  # \u0027o\u0027 is OOB data\n  5\n  \u003e\u003e\u003e c1.send(b\u0027world\u0027)\n  5\n  \u003e\u003e\u003e c2.recv(5)  # OOB data is not received\n  b\u0027hell\u0027\n  \u003e\u003e\u003e c2.recv(5)  # OOB date is skipped\n  b\u0027world\u0027\n  \u003e\u003e\u003e c2.recv(5, MSG_OOB)  # This should return an error\n  b\u0027o\u0027\n\nIn the same situation, TCP actually returns -EINVAL for the last\nrecv().\n\nAlso, if we do not clear unix_sk(sk)-\u003eoob_skb, unix_poll() always set\nEPOLLPRI even though the data has passed through by previous recv().\n\nTo avoid these issues, we must clear unix_sk(sk)-\u003eoob_skb when dequeuing\nit from recv queue.\n\nThe reason why the old GC did not trigger the deadlock is because the\nold GC relied on the receive queue to detect the loop.\n\nWhen it is triggered, the socket with OOB data is marked as GC candidate\nbecause file refcount == inflight count (1).  However, after traversing\nall inflight sockets, the socket still has a positive inflight count (1),\nthus the socket is excluded from candidates.  Then, the old GC lose the\nchance to garbage-collect the socket.\n\nWith the old GC, the repro continues to create true garbage that will\nnever be freed nor detected by kmemleak as it\u0027s linked to the global\ninflight list.  That\u0027s why we couldn\u0027t even notice the issue."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-11-05T09:25:58.371Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/b4bc99d04c689b5652665394ae8d3e02fb754153"
        },
        {
          "url": "https://git.kernel.org/stable/c/84a352b7eba1142a95441380058985ff19f25ec9"
        },
        {
          "url": "https://git.kernel.org/stable/c/601a89ea24d05089debfa2dc896ea9f5937ac7a6"
        },
        {
          "url": "https://git.kernel.org/stable/c/698a95ade1a00e6494482046902b986dfffd1caf"
        },
        {
          "url": "https://git.kernel.org/stable/c/b46f4eaa4f0ec38909fb0072eea3aeddb32f954e"
        }
      ],
      "title": "af_unix: Clear stale u-\u003eoob_skb.",
      "x_generator": {
        "engine": "bippy-9e1c9544281a"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2024-35970",
    "datePublished": "2024-05-20T09:41:58.524Z",
    "dateReserved": "2024-05-17T13:50:33.141Z",
    "dateUpdated": "2024-11-05T09:25:58.371Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2024-35970\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-05-20T10:15:11.860\",\"lastModified\":\"2024-11-01T19:35:23.483\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\naf_unix: Clear stale u-\u003eoob_skb.\\n\\nsyzkaller started to report deadlock of unix_gc_lock after commit\\n4090fa373f0e (\\\"af_unix: Replace garbage collection algorithm.\\\"), but\\nit just uncovers the bug that has been there since commit 314001f0bf92\\n(\\\"af_unix: Add OOB support\\\").\\n\\nThe repro basically does the following.\\n\\n  from socket import *\\n  from array import array\\n\\n  c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)\\n  c1.sendmsg([b\u0027a\u0027], [(SOL_SOCKET, SCM_RIGHTS, array(\\\"i\\\", [c2.fileno()]))], MSG_OOB)\\n  c2.recv(1)  # blocked as no normal data in recv queue\\n\\n  c2.close()  # done async and unblock recv()\\n  c1.close()  # done async and trigger GC\\n\\nA socket sends its file descriptor to itself as OOB data and tries to\\nreceive normal data, but finally recv() fails due to async close().\\n\\nThe problem here is wrong handling of OOB skb in manage_oob().  When\\nrecvmsg() is called without MSG_OOB, manage_oob() is called to check\\nif the peeked skb is OOB skb.  In such a case, manage_oob() pops it\\nout of the receive queue but does not clear unix_sock(sk)-\u003eoob_skb.\\nThis is wrong in terms of uAPI.\\n\\nLet\u0027s say we send \\\"hello\\\" with MSG_OOB, and \\\"world\\\" without MSG_OOB.\\nThe \u0027o\u0027 is handled as OOB data.  When recv() is called twice without\\nMSG_OOB, the OOB data should be lost.\\n\\n  \u003e\u003e\u003e from socket import *\\n  \u003e\u003e\u003e c1, c2 = socketpair(AF_UNIX, SOCK_STREAM, 0)\\n  \u003e\u003e\u003e c1.send(b\u0027hello\u0027, MSG_OOB)  # \u0027o\u0027 is OOB data\\n  5\\n  \u003e\u003e\u003e c1.send(b\u0027world\u0027)\\n  5\\n  \u003e\u003e\u003e c2.recv(5)  # OOB data is not received\\n  b\u0027hell\u0027\\n  \u003e\u003e\u003e c2.recv(5)  # OOB date is skipped\\n  b\u0027world\u0027\\n  \u003e\u003e\u003e c2.recv(5, MSG_OOB)  # This should return an error\\n  b\u0027o\u0027\\n\\nIn the same situation, TCP actually returns -EINVAL for the last\\nrecv().\\n\\nAlso, if we do not clear unix_sk(sk)-\u003eoob_skb, unix_poll() always set\\nEPOLLPRI even though the data has passed through by previous recv().\\n\\nTo avoid these issues, we must clear unix_sk(sk)-\u003eoob_skb when dequeuing\\nit from recv queue.\\n\\nThe reason why the old GC did not trigger the deadlock is because the\\nold GC relied on the receive queue to detect the loop.\\n\\nWhen it is triggered, the socket with OOB data is marked as GC candidate\\nbecause file refcount == inflight count (1).  However, after traversing\\nall inflight sockets, the socket still has a positive inflight count (1),\\nthus the socket is excluded from candidates.  Then, the old GC lose the\\nchance to garbage-collect the socket.\\n\\nWith the old GC, the repro continues to create true garbage that will\\nnever be freed nor detected by kmemleak as it\u0027s linked to the global\\ninflight list.  That\u0027s why we couldn\u0027t even notice the issue.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: af_unix: Borrar u-\u0026gt;oob_skb obsoleto. syzkaller comenz\u00f3 a informar un punto muerto de unix_gc_lock despu\u00e9s de la confirmaci\u00f3n 4090fa373f0e (\\\"af_unix: Reemplazar el algoritmo de recolecci\u00f3n de basura\\\"), pero simplemente descubre el error que ha estado ah\u00ed desde la confirmaci\u00f3n 314001f0bf92 (\\\"af_unix: Agregar soporte OOB\\\"). La reproducci\u00f3n b\u00e1sicamente hace lo siguiente. desde importaci\u00f3n de socket * desde matriz de importaci\u00f3n matriz c1, c2 = socketpair(AF_UNIX, SOCK_STREAM) c1.sendmsg([b\u0027a\u0027], [(SOL_SOCKET, SCM_RIGHTS, array(\\\"i\\\", [c2.fileno()])) ], MSG_OOB) c2.recv(1) # bloqueado porque no hay datos normales en la cola de recepci\u00f3n c2.close() # hecho as\u00edncrono y desbloquea recv() c1.close() # hecho as\u00edncrono y activa GC Un socket env\u00eda su descriptor de archivo a como datos OOB e intenta recibir datos normales, pero finalmente recv() falla debido al cierre as\u00edncrono(). El problema aqu\u00ed es el manejo incorrecto de OOB skb en Manage_oob(). Cuando se llama a recvmsg() sin MSG_OOB, se llama a Manage_oob() para verificar si el skb visto es skb OOB. En tal caso, Manage_oob() lo saca de la cola de recepci\u00f3n pero no borra unix_sock(sk)-\u0026gt;oob_skb. Esto est\u00e1 mal en t\u00e9rminos de uAPI. Digamos que enviamos \\\"hola\\\" con MSG_OOB y \\\"mundo\\\" sin MSG_OOB. La \u0027o\u0027 se maneja como datos OOB. Cuando se llama a recv() dos veces sin MSG_OOB, los datos OOB deber\u00edan perderse. \u0026gt;\u0026gt;\u0026gt; desde importaci\u00f3n de socket * \u0026gt;\u0026gt;\u0026gt; c1, c2 = socketpair(AF_UNIX, SOCK_STREAM, 0) \u0026gt;\u0026gt;\u0026gt; c1.send(b\u0027hello\u0027, MSG_OOB) # \u0027o\u0027 son datos OOB 5 \u0026gt;\u0026gt;\u0026gt; c1.send (b\u0027world\u0027) 5 \u0026gt;\u0026gt;\u0026gt; c2.recv(5) # Los datos OOB no se reciben b\u0027hell\u0027 \u0026gt;\u0026gt;\u0026gt; c2.recv(5) # La fecha OOB se omite b\u0027world\u0027 \u0026gt;\u0026gt;\u0026gt; c2.recv (5, MSG_OOB) # Esto deber\u00eda devolver un error b\u0027o\u0027. En la misma situaci\u00f3n, TCP en realidad devuelve -EINVAL para el \u00faltimo recv(). Adem\u00e1s, si no borramos unix_sk(sk)-\u0026gt;oob_skb, unix_poll() siempre establece EPOLLPRI aunque los datos hayan pasado por el recv() anterior. Para evitar estos problemas, debemos borrar unix_sk(sk)-\u0026gt;oob_skb al retirarlo de la cola de recepci\u00f3n. La raz\u00f3n por la que el antiguo GC no provoc\u00f3 el punto muerto es porque el antiguo GC depend\u00eda de la cola de recepci\u00f3n para detectar el bucle. Cuando se activa, el socket con datos OOB se marca como candidato de GC porque el recuento de archivos == recuento en vuelo (1). Sin embargo, despu\u00e9s de atravesar todos los sockets en vuelo, el socket todav\u00eda tiene un recuento positivo en vuelo (1), por lo que el socket queda excluido de los candidatos. Entonces, el antiguo GC pierde la oportunidad de recolectar basura en el socket. Con el antiguo GC, la reproducci\u00f3n contin\u00faa creando verdadera basura que kmemleak nunca liberar\u00e1 ni detectar\u00e1, ya que est\u00e1 vinculada a la lista global a bordo. Por eso ni siquiera pudimos notar el problema.\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"134c704f-9b21-4f2e-91b3-4a467353bcc0\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L\",\"attackVector\":\"NETWORK\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"LOW\",\"integrityImpact\":\"LOW\",\"availabilityImpact\":\"LOW\",\"baseScore\":6.3,\"baseSeverity\":\"MEDIUM\"},\"exploitabilityScore\":2.8,\"impactScore\":3.4}]},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/601a89ea24d05089debfa2dc896ea9f5937ac7a6\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/698a95ade1a00e6494482046902b986dfffd1caf\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/84a352b7eba1142a95441380058985ff19f25ec9\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/b46f4eaa4f0ec38909fb0072eea3aeddb32f954e\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/b4bc99d04c689b5652665394ae8d3e02fb754153\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


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.