Skip to content
Heist/ feed
Back to feed
Medium

Dompdf: Uncontrolled resource consumption based on declared BMP dimensions

Type: advisorySources: OSV

Dompdf is an HTML to PDF converter for PHP. Versions 3.15 and prior accept a BMP image and generates a PDF-compatible PNG based only on its declared header dimensions and never bounds width × height before the image is converted through GD. A 58-byte BMP whose header declares e.g. 6000×6000 is accepted and later drives imagecreatetruecolor($width, $height) (and PHP's native BMP decoder) to allocate the full pixel canvas. A payload can fit in a single HTTP request: the BMP can be inlined as a data:image/bmp;base64,… URI inside attacker-controlled HTML, so no upload, no remote fetch, and no chroot-reachable file is required. I measured a 169-byte request driving a dompdf render to ~412 MB peak RSS and ~4.8 s of CPU/wall time, versus ~34 MB for an identically-sized benign request — roughly a 12× memory amplification per request, repeatable and unauthenticated. This issue has been fixed in version 3.16.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-59941
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 03:38 UTC · Revision 1

Source evidence

Dompdf: Uncontrolled resource consumption based on declared BMP dimensions

core-osv · Original source

Published 28 Jul 2026, 20:42 UTC

Dompdf is an HTML to PDF converter for PHP. Versions 3.15 and prior accept a BMP image and generates a PDF-compatible PNG based only on its declared header dimensions and never bounds width × height before the image is converted through GD. A 58-byte BMP whose header declares e.g. 6000×6000 is accepted and later drives imagecreatetruecolor($width, $height) (and PHP's native BMP decoder) to allocate the full pixel canvas. A payload can fit in a single HTTP request: the BMP can be inlined as a data:image/bmp;base64,… URI inside attacker-controlled HTML, so no upload, no remote fetch, and no chroot-reachable file is required. I measured a 169-byte request driving a dompdf render to ~412 MB peak RSS and ~4.8 s of CPU/wall time, versus ~34 MB for an identically-sized benign request — roughly a 12× memory amplification per request, repeatable and unauthenticated. This issue has been fixed in version 3.16.

osv:CVE-2026-59941
Complete source record
{
  "id": "b181bee902321236a921a9167463d5b42ae72b17838e5abdc1be4f2f3c592732",
  "url": "https://osv.dev/vulnerability/CVE-2026-59941",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Dompdf: Uncontrolled resource consumption based on declared BMP dimensions",
    "summary": "Dompdf is an HTML to PDF converter for PHP. Versions 3.15 and prior accept a BMP image and generates a PDF-compatible PNG based only on its declared header dimensions and never bounds width × height before the image is converted through GD. A 58-byte BMP whose header declares e.g. 6000×6000 is accepted and later drives imagecreatetruecolor($width, $height) (and PHP's native BMP decoder) to allocate the full pixel canvas. A payload can fit in a single HTTP request: the BMP can be inlined as a data:image/bmp;base64,… URI inside attacker-controlled HTML, so no upload, no remote fetch, and no chroot-reachable file is required. I measured a 169-byte request driving a dompdf render to ~412 MB peak RSS and ~4.8 s of CPU/wall time, versus ~34 MB for an identically-sized benign request — roughly a 12× memory amplification per request, repeatable and unauthenticated. This issue has been fixed in version 3.16.",
    "evidence": "osv:CVE-2026-59941",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-59941",
      "aliases": [
        "CVE-2026-59941",
        "GHSA-8hg6-c449-896m"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/dompdf/dompdf",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "6d4b4eb8500f7a786da8868ba463a71b725a4005"
                },
                {
                  "fixed": "7c65e7bbeccf146b2409740405af73949ad129d0"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:dompdf_project:dompdf:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "3.1.6"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "7c65e7bbeccf146b2409740405af73949ad129d0"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "6d4b4eb8500f7a786da8868ba463a71b725a4005"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v3.1.6"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v3.1.5",
            "v3.1.4",
            "v3.1.3",
            "v3.1.2",
            "v3.1.1",
            "v3.1.0",
            "v3.0.2",
            "v3.0.1",
            "v3.0.0",
            "v2.0.3",
            "v2.0.2",
            "v2.0.1",
            "v2.0.0",
            "v1.2.2",
            "v1.2.1",
            "v1.2.0",
            "v1.1.1",
            "v1.1.0",
            "v1.0.2",
            "v1.0.1",
            "v1.0.0",
            "v0.8.6",
            "v0.8.5",
            "v0.8.4",
            "v0.8.3",
            "v0.8.2",
            "v0.8.1",
            "v0.8.0",
            "v0.7.0",
            "v0.7.0-beta3",
            "v0.6.2",
            "v0.6.1",
            "v0.6.0",
            "v0.6.0-b3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-59941.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:49.446517357Z",
      "provider": "osv",
      "references": [
        "https://github.com/dompdf/dompdf/releases/tag/v3.1.6",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59941.json",
        "https://github.com/dompdf/dompdf/security/advisories/GHSA-8hg6-c449-896m",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-59941",
        "https://github.com/dompdf/dompdf/commit/7c65e7bbeccf146b2409740405af73949ad129d0"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-400"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59941.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-59941",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 517815,
  "published_at": "2026-07-28T20:42:57.01+00:00"
}