Skip to content
Heist/ feed
Back to feed
Critical

Security advisory

Type: advisorySources: OSVCVE: CVE-2016-7126

The imagetruecolortopalette function in ext/gd/gd.c in PHP before 5.6.25 and 7.x before 7.0.10 does not properly validate the number of colors, which allows remote attackers to cause a denial of service (select_colors allocation error and out-of-bounds write) or possibly have unspecified other impact via a large value in the third argument.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2016-7126
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 12:13 UTC · Revision 1

Source evidence

CVE-2016-7126

core-osv · Original source

Published 12 Sept 2016, 01:59 UTC

The imagetruecolortopalette function in ext/gd/gd.c in PHP before 5.6.25 and 7.x before 7.0.10 does not properly validate the number of colors, which allows remote attackers to cause a denial of service (select_colors allocation error and out-of-bounds write) or possibly have unspecified other impact via a large value in the third argument.

osv:CVE-2016-7126
Complete source record
{
  "id": "11ad8f360f94d2779e934792415443532d9dac086dd6c6ca0e2d990af00d415c",
  "url": "https://osv.dev/vulnerability/CVE-2016-7126",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2016-7126",
    "summary": "The imagetruecolortopalette function in ext/gd/gd.c in PHP before 5.6.25 and 7.x before 7.0.10 does not properly validate the number of colors, which allows remote attackers to cause a denial of service (select_colors allocation error and out-of-bounds write) or possibly have unspecified other impact via a large value in the third argument.",
    "evidence": "osv:CVE-2016-7126",
    "products": [],
    "severity": "critical",
    "structured": {
      "id": "CVE-2016-7126",
      "aliases": [
        "CVE-2016-7126"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/php/php-src",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "last_affected": "38980c9ea4156ce52a53f9f3e1007ea3d787fa11"
                },
                {
                  "introduced": "60fffd296abce5fc071f3c173c25a2696cf683c6"
                },
                {
                  "last_affected": "9d582eba7448f1495fae62b13d95d2844ce6b28a"
                },
                {
                  "fixed": "28022c9b1fd937436ab67bb3d61f652c108baf96"
                },
                {
                  "fixed": "b6f13a5ef9d6280cf984826a5de012a32c396cd4"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:php:php:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "last_affected": "5.6.24"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.0:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.0"
                      },
                      {
                        "last_affected": "7.0.0"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.1:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.1"
                      },
                      {
                        "last_affected": "7.0.1"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.2:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.2"
                      },
                      {
                        "last_affected": "7.0.2"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.3:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.3"
                      },
                      {
                        "last_affected": "7.0.3"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.4:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.4"
                      },
                      {
                        "last_affected": "7.0.4"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.5:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.5"
                      },
                      {
                        "last_affected": "7.0.5"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.6:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.6"
                      },
                      {
                        "last_affected": "7.0.6"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.7:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.7"
                      },
                      {
                        "last_affected": "7.0.7"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.8:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.8"
                      },
                      {
                        "last_affected": "7.0.8"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:php:php:7.0.9:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "7.0.9"
                      },
                      {
                        "last_affected": "7.0.9"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "range": [
                      {
                        "fixed": "28022c9b1fd937436ab67bb3d61f652c108baf96"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "b6f13a5ef9d6280cf984826a5de012a32c396cd4"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "7.0.0",
            "7.0.1",
            "7.0.2",
            "7.0.3",
            "7.0.4",
            "7.0.5",
            "7.0.6",
            "7.0.7",
            "7.0.8",
            "7.0.9",
            "php-5.6.24",
            "php-5.6.24RC1",
            "php-7.0.9",
            "php-7.0.9RC1",
            "POST_PHP7_NSAPI_REMOVAL",
            "PRE_PHP7_NSAPI_REMOVAL",
            "PRE_PHP7_EREG_MYSQL_REMOVALS",
            "PRE_PHP7_REMOVALS",
            "POST_PHP7_REMOVALS",
            "POST_AST_MERGE",
            "PRE_AST_MERGE",
            "POST_64BIT_BRANCH_MERGE",
            "PRE_64BIT_BRANCH_MERGE",
            "POST_PHPNG_MERGE"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2016-7126.json",
            "vanir_signatures": [
              {
                "id": "CVE-2016-7126-37a5719d",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "1423120292150075174930076738454850065",
                    "130300145211973106865201718306067833063",
                    "114156461702382824948003249548063790626",
                    "303490943967551169907714634147984509327",
                    "6293361012273008610066674150071258249",
                    "256829445115917955086582364812563684294",
                    "242013541868604548179899499420591114683",
                    "265623023047335294992474708258410418763"
                  ]
                },
                "source": "https://github.com/php/php-src/commit/28022c9b1fd937436ab67bb3d61f652c108baf96",
                "target": {
                  "file": "ext/gd/gd.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2016-7126-3fc3a654",
                "digest": {
                  "length": 427,
                  "function_hash": "325062193662271322533705246369686017798"
                },
                "source": "https://github.com/php/php-src/commit/b6f13a5ef9d6280cf984826a5de012a32c396cd4",
                "target": {
                  "file": "ext/gd/gd.c",
                  "function": "PHP_FUNCTION"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2016-7126-86a80ea0",
                "digest": {
                  "length": 424,
                  "function_hash": "299071568899511311244268382442547669538"
                },
                "source": "https://github.com/php/php-src/commit/28022c9b1fd937436ab67bb3d61f652c108baf96",
                "target": {
                  "file": "ext/gd/gd.c",
                  "function": "PHP_FUNCTION"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2016-7126-b366f13d",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "126770928617531455781662552752888004178",
                    "58257154225830603464532399561035086982",
                    "303104341489329115172377785019776380272",
                    "199768340353813515127449508570815537454",
                    "60772165131950662515060433574910268521",
                    "199329124188777352462347349441414973366",
                    "284688032288111163403242911724434312678",
                    "298899640764450115373202566186393322591",
                    "305165316809197570935030791281659852177",
                    "311686819433610602352518584518528556735",
                    "139124176667830508980884283900175737527",
                    "256829445115917955086582364812563684294",
                    "242013541868604548179899499420591114683",
                    "265623023047335294992474708258410418763",
                    "225274767326011585740092982516881541658",
                    "257747541152950102621117789614092148544",
                    "110970857338032989952000504499983685680",
                    "78030080836351927601385261125585094966",
                    "76252000699847800932887920885543617170",
                    "316829082426001303344116015223512383278",
                    "180645478241532636408929824376354052557",
                    "264144932551395430872877363754696000201",
                    "126432268629793139837764355238639520480"
                  ]
                },
                "source": "https://github.com/php/php-src/commit/b6f13a5ef9d6280cf984826a5de012a32c396cd4",
                "target": {
                  "file": "ext/gd/gd.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T13:23:24Z"
          }
        }
      ],
      "modified": "2026-10-20T13:23:24.274804700Z",
      "provider": "osv",
      "references": [
        "https://security.gentoo.org/glsa/201611-22",
        "https://www.tenable.com/security/tns-2016-19",
        "https://bugs.php.net/bug.php?id=72697",
        "https://github.com/php/php-src/commit/28022c9b1fd937436ab67bb3d61f652c108baf96",
        "https://github.com/php/php-src/commit/b6f13a5ef9d6280cf984826a5de012a32c396cd4?w=1"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2016-7126",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 387600,
  "published_at": "2016-09-12T01:59:04.723+00:00"
}