cve-2023-52828
Vulnerability from cvelistv5
Published
2024-05-21 15:31
Modified
2024-08-02 23:11
Severity
Summary
bpf: Detect IP == ksym.end as part of BPF program
Impacted products
VendorProduct
LinuxLinux
LinuxLinux
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2023-52828",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-05-29T17:18:00.561172Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-06-04T17:23:49.325Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T23:11:35.966Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/6058e4829696412457729a00734969acc6fd1d18"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/cf353904a82873e952633fcac4385c2fcd3a46e1"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/aa42a7cb92647786719fe9608685da345883878f"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/327b92e8cb527ae097961ffd1610c720481947f5"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/821a7e4143af115b840ec199eb179537e18af922"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/66d9111f3517f85ef2af0337ece02683ce0faf21"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "kernel/bpf/core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "6058e4829696",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "cf353904a828",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "aa42a7cb9264",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "327b92e8cb52",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "821a7e4143af",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            },
            {
              "lessThan": "66d9111f3517",
              "status": "affected",
              "version": "1da177e4c3f4",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "kernel/bpf/core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.202",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.140",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.64",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.5.*",
              "status": "unaffected",
              "version": "6.5.13",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.3",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.7",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Detect IP == ksym.end as part of BPF program\n\nNow that bpf_throw kfunc is the first such call instruction that has\nnoreturn semantics within the verifier, this also kicks in dead code\nelimination in unprecedented ways. For one, any instruction following\na bpf_throw call will never be marked as seen. Moreover, if a callchain\nends up throwing, any instructions after the call instruction to the\neventually throwing subprog in callers will also never be marked as\nseen.\n\nThe tempting way to fix this would be to emit extra \u0027int3\u0027 instructions\nwhich bump the jited_len of a program, and ensure that during runtime\nwhen a program throws, we can discover its boundaries even if the call\ninstruction to bpf_throw (or to subprogs that always throw) is emitted\nas the final instruction in the program.\n\nAn example of such a program would be this:\n\ndo_something():\n\t...\n\tr0 = 0\n\texit\n\nfoo():\n\tr1 = 0\n\tcall bpf_throw\n\tr0 = 0\n\texit\n\nbar(cond):\n\tif r1 != 0 goto pc+2\n\tcall do_something\n\texit\n\tcall foo\n\tr0 = 0  // Never seen by verifier\n\texit\t//\n\nmain(ctx):\n\tr1 = ...\n\tcall bar\n\tr0 = 0\n\texit\n\nHere, if we do end up throwing, the stacktrace would be the following:\n\nbpf_throw\nfoo\nbar\nmain\n\nIn bar, the final instruction emitted will be the call to foo, as such,\nthe return address will be the subsequent instruction (which the JIT\nemits as int3 on x86). This will end up lying outside the jited_len of\nthe program, thus, when unwinding, we will fail to discover the return\naddress as belonging to any program and end up in a panic due to the\nunreliable stack unwinding of BPF programs that we never expect.\n\nTo remedy this case, make bpf_prog_ksym_find treat IP == ksym.end as\npart of the BPF program, so that is_bpf_text_address returns true when\nsuch a case occurs, and we are able to unwind reliably when the final\ninstruction ends up being a call instruction."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-05-29T05:18:01.230Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/6058e4829696412457729a00734969acc6fd1d18"
        },
        {
          "url": "https://git.kernel.org/stable/c/cf353904a82873e952633fcac4385c2fcd3a46e1"
        },
        {
          "url": "https://git.kernel.org/stable/c/aa42a7cb92647786719fe9608685da345883878f"
        },
        {
          "url": "https://git.kernel.org/stable/c/327b92e8cb527ae097961ffd1610c720481947f5"
        },
        {
          "url": "https://git.kernel.org/stable/c/821a7e4143af115b840ec199eb179537e18af922"
        },
        {
          "url": "https://git.kernel.org/stable/c/66d9111f3517f85ef2af0337ece02683ce0faf21"
        }
      ],
      "title": "bpf: Detect IP == ksym.end as part of BPF program",
      "x_generator": {
        "engine": "bippy-a5840b7849dd"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-52828",
    "datePublished": "2024-05-21T15:31:31.501Z",
    "dateReserved": "2024-05-21T15:19:24.251Z",
    "dateUpdated": "2024-08-02T23:11:35.966Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-52828\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-05-21T16:15:20.533\",\"lastModified\":\"2024-05-21T16:53:56.550\",\"vulnStatus\":\"Awaiting Analysis\",\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbpf: Detect IP == ksym.end as part of BPF program\\n\\nNow that bpf_throw kfunc is the first such call instruction that has\\nnoreturn semantics within the verifier, this also kicks in dead code\\nelimination in unprecedented ways. For one, any instruction following\\na bpf_throw call will never be marked as seen. Moreover, if a callchain\\nends up throwing, any instructions after the call instruction to the\\neventually throwing subprog in callers will also never be marked as\\nseen.\\n\\nThe tempting way to fix this would be to emit extra \u0027int3\u0027 instructions\\nwhich bump the jited_len of a program, and ensure that during runtime\\nwhen a program throws, we can discover its boundaries even if the call\\ninstruction to bpf_throw (or to subprogs that always throw) is emitted\\nas the final instruction in the program.\\n\\nAn example of such a program would be this:\\n\\ndo_something():\\n\\t...\\n\\tr0 = 0\\n\\texit\\n\\nfoo():\\n\\tr1 = 0\\n\\tcall bpf_throw\\n\\tr0 = 0\\n\\texit\\n\\nbar(cond):\\n\\tif r1 != 0 goto pc+2\\n\\tcall do_something\\n\\texit\\n\\tcall foo\\n\\tr0 = 0  // Never seen by verifier\\n\\texit\\t//\\n\\nmain(ctx):\\n\\tr1 = ...\\n\\tcall bar\\n\\tr0 = 0\\n\\texit\\n\\nHere, if we do end up throwing, the stacktrace would be the following:\\n\\nbpf_throw\\nfoo\\nbar\\nmain\\n\\nIn bar, the final instruction emitted will be the call to foo, as such,\\nthe return address will be the subsequent instruction (which the JIT\\nemits as int3 on x86). This will end up lying outside the jited_len of\\nthe program, thus, when unwinding, we will fail to discover the return\\naddress as belonging to any program and end up in a panic due to the\\nunreliable stack unwinding of BPF programs that we never expect.\\n\\nTo remedy this case, make bpf_prog_ksym_find treat IP == ksym.end as\\npart of the BPF program, so that is_bpf_text_address returns true when\\nsuch a case occurs, and we are able to unwind reliably when the final\\ninstruction ends up being a call instruction.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: bpf: Detectar IP == ksym.end como parte del programa BPF. Ahora que bpf_throw kfunc es la primera instrucci\u00f3n de llamada que no tiene sem\u00e1ntica de retorno dentro del verificador, esto tambi\u00e9n activa el c\u00f3digo muerto eliminaci\u00f3n de formas sin precedentes. Por un lado, cualquier instrucci\u00f3n que siga a una llamada a bpf_throw nunca se marcar\u00e1 como vista. Adem\u00e1s, si una cadena de llamadas termina lanz\u00e1ndose, cualquier instrucci\u00f3n posterior a la instrucci\u00f3n de llamada al subprog que finalmente se lance en las personas que llaman tampoco se marcar\u00e1 como vista. La forma tentadora de solucionar este problema ser\u00eda emitir instrucciones \u0027int3\u0027 adicionales que superen el jited_len de un programa y garantizar que, durante el tiempo de ejecuci\u00f3n, cuando se inicia un programa, podamos descubrir sus l\u00edmites incluso si la instrucci\u00f3n de llamada a bpf_throw (o a subprogs que siempre tirar) se emite como instrucci\u00f3n final en el programa. Un ejemplo de un programa de este tipo ser\u00eda este: do_something(): ... r0 = 0 salir foo(): r1 = 0 llamar a bpf_throw r0 = 0 salir de la barra (cond): si r1 != 0 ir a pc+2 llamar a hacer_algo exit call foo r0 = 0 // Nunca visto por el verificador exit // main(ctx): r1 = ... call bar r0 = 0 exit Aqu\u00ed, si terminamos lanzando, el seguimiento de pila ser\u00eda el siguiente: bpf_throw foo bar main En bar, la instrucci\u00f3n final emitida ser\u00e1 la llamada a foo, como tal, la direcci\u00f3n de retorno ser\u00e1 la instrucci\u00f3n posterior (que el JIT emite como int3 en x86). Esto terminar\u00e1 quedando fuera del jited_len del programa, por lo tanto, al desenrollarlo, no podremos descubrir que la direcci\u00f3n del remitente pertenece a ning\u00fan programa y terminaremos en p\u00e1nico debido al desenrollado poco confiable de la pila de programas BPF que nunca esperamos. Para remediar este caso, haga que bpf_prog_ksym_find trate IP == ksym.end como parte del programa BPF, de modo que is_bpf_text_address devuelva verdadero cuando ocurra tal caso, y podamos desenredarlo de manera confiable cuando la instrucci\u00f3n final termine siendo una instrucci\u00f3n de llamada.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/327b92e8cb527ae097961ffd1610c720481947f5\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/6058e4829696412457729a00734969acc6fd1d18\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/66d9111f3517f85ef2af0337ece02683ce0faf21\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/821a7e4143af115b840ec199eb179537e18af922\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/aa42a7cb92647786719fe9608685da345883878f\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/cf353904a82873e952633fcac4385c2fcd3a46e1\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...