Skip to content
Heist/ feed
Back to feed
High

Heap buffer overflow in finfo_buffer

Type: advisorySources: OSV

In PHP versions 8.1.x below 8.1.8, when fileinfo functions, such as finfo_buffer, due to incorrect patch applied to the third party code from libmagic, incorrect function may be used to free allocated memory, which may lead to heap corruption.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-31627
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 05:17 UTC · Revision 1

Source evidence

Heap buffer overflow in finfo_buffer

core-osv · Original source

Published 28 Jul 2022, 05:50 UTC

In PHP versions 8.1.x below 8.1.8, when fileinfo functions, such as finfo_buffer, due to incorrect patch applied to the third party code from libmagic, incorrect function may be used to free allocated memory, which may lead to heap corruption.

osv:CVE-2022-31627
Complete source record
{
  "id": "52df9f600fb583b231d1176e37cca37bdb0ea689a80e1ac510e3562fa028ef87",
  "url": "https://osv.dev/vulnerability/CVE-2022-31627",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Heap buffer overflow in finfo_buffer",
    "summary": "In PHP versions 8.1.x below 8.1.8, when fileinfo functions, such as finfo_buffer, due to incorrect patch applied to the third party code from libmagic, incorrect function may be used to free allocated memory, which may lead to heap corruption.",
    "evidence": "osv:CVE-2022-31627",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2022-31627",
      "aliases": [
        "BIT-libphp-2022-31627",
        "BIT-php-2022-31627",
        "BIT-php-min-2022-31627",
        "CVE-2022-31627"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/php/php-src",
              "type": "GIT",
              "events": [
                {
                  "introduced": "381ba9f5d0edd0c9c8ec1dea7e21d513ad08b115"
                },
                {
                  "fixed": "8d84e44e7bef81b5b5d896ba1459304e94ec9b10"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:php:php:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "8.1.0"
                      },
                      {
                        "fixed": "8.1.8"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-31627.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:26.103956264Z",
      "provider": "osv",
      "references": [
        "https://bugs.php.net/bug.php?id=81723",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31627.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-31627",
        "https://security.gentoo.org/glsa/202209-20",
        "https://security.netapp.com/advisory/ntap-20220826-0008/"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-590"
        ],
        "cna_assigner": "php",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "8.1.X"
                  },
                  {
                    "fixed": "8.1.8"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StandardRange"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31627.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-31627",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 492666,
  "published_at": "2022-07-28T05:50:09.522+00:00"
}