CVE-2019-6977 in Canonical Ubuntu Linux and 4 more products
gdImageColorMatch in gd_color_match.c in the GD Graphics Library (aka LibGD) 2.2.5, as used in the imagecolormatch function in PHP before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1, has a heap-based buffer overflow. This can be exploited by an attacker who is able to trigger imagecolormat...
Affects 5 products from 5 vendors. Facts below cite their sources.
Remotely exploitable over the network, low complexity, no authentication required, requires user interaction, impact contained to the vulnerable component, full confidentiality impact, full integrity impact, full availability impact.
Affected products and versions
| Vendor | Product | Affected versions |
|---|---|---|
| Canonical | Ubuntu Linux | 14.04 16.04 18.04 18.10 |
| Debian | Debian Linux | 8.0 9.0 |
| Libgd | Libgd | 2.2.5 |
| Netapp | Storage Automation Store | All versions |
| Php | Php | 7.3.0 < 5.6.40 ≥ 7.0.0, < 7.1.26 ≥ 7.2.0, < 7.2.14 |
A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.
Fix and vendor advisory
Vendor PSIRT: [email protected]
Exploitation
| CISA known-exploited | Not in the CISA KEV catalog |
|---|---|
| Public exploit | Reported · reference |
Official description
gdImageColorMatch in gd_color_match.c in the GD Graphics Library (aka LibGD) 2.2.5, as used in the imagecolormatch function in PHP before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1, has a heap-based buffer overflow. This can be exploited by an attacker who is able to trigger imagecolormatch calls with crafted image data.
Source: NIST NVD / MITRE CVE.
Record details
| CVE ID | CVE-2019-6977 |
|---|---|
| BreachSpider ID | BS-2019-GLOBAL-161227-H |
| CVSS vector | CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| Published | 2019-01-27 |
| Last modified | 2026-06-17 |
| Weakness (CWE) | |
| Source | NVD |
Weakness definitions
CWE-787: Out-of-Bounds Write
Software writes data past buffer boundaries, corrupting memory and potentially enabling code execution.
Analysis AI-written, not human-reviewed
{ "executive_summary": "A heap-based buffer overflow vulnerability exists in the gdImageColorMatch function of the GD Graphics Library (LibGD) 2.2.5, as used in PHP versions before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1. This can be exploited by an attacker to execute arbitrary code via crafted image data.", "attack_vector_detail": "An attacker can exploit this vulnerability by providing specially crafted image data to the imagecolormatch function. This can lead to a heap-based buffer overflow, potentially allowing the execution of arbitrary code with the privileges of the affected application.", "affected_components": ["GD Graphics Library (LibGD) 2.2.5", "PHP before 5.6.40", "PHP 7.x before 7.1.26", "PHP 7.2.x before 7.2.14", "PHP 7.3.x before 7.3.1"], "exploitation_likelihood": "HIGH", "remediation
Questions
What is CVE-2019-6977?
{ "executive_summary": "A heap-based buffer overflow vulnerability exists in the gdImageColorMatch function of the GD Graphics Library (LibGD) 2.2.5, as used in PHP versions before 5.6.40, 7.x before 7.1.26, 7.2.x before 7.2.14, and 7.3.x before 7.3.1. This can be exploited by an attacker to execute arbitrary code via crafted image data.", "attack_vector_detail": "An attacker can exploit this vulnerability by providing specially crafted image data to the imagecolormatch function. This can le
What is the CVSS score for CVE-2019-6977?
CVE-2019-6977 has CVSS 8.8 (High). Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H. EPSS: 71.5%.
Is CVE-2019-6977 actively exploited?
Public exploit available for CVE-2019-6977. Exploitation risk elevated.
How do I remediate CVE-2019-6977?
Advisory: http://php.net/ChangeLog-5.php PSIRT: [email protected]
What systems are affected by CVE-2019-6977?
CVE-2019-6977 affects Canonical Ubuntu Linux; Debian Debian Linux; Libgd Libgd; Netapp Storage Automation Store; Php Php.
For developers and AI agents
Run this check from your own code or agent
REST API
curl -s https://breachspider.com/api/v1/assets/correlate-cves \
-H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assets":[{"asset_id":"dev-1","vendor":"Canonical","product":"Ubuntu Linux","version":"1.0"}]}'
MCP for AI agents
# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp
Free trial: 14 days, 750 device checks, no card.
Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-06-17.