CVE-2017-6362
High · 7.5CVSS
7.5
EPSS
5.1%
Published
Sep 7, 2017
CISA due date
—
Cloudanix analysis
A bug in a common image-handling library lets attackers crash programs that process certain PNG pictures, potentially disrupting services that rely on those programs.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Double free in gdImagePngPtr when processing a PNG palette containing zero colors, resulting in memory corruption that crashes the process.
Why it matters to the business
Applications relying on libgd for image handling can be crashed remotely, causing denial of service and potential downtime for image-dependent services.
How an attack unfolds
An attacker crafts a minimal PNG with an empty color palette and supplies it to any application that calls gdImagePngPtr; the double-free triggers on the second free of the same palette structure, crashing the process.
How to fix it
Upgrade libgd to the commit 8255231b68889597d04d451a72438ab92a405aba or later release containing the fix; rebuild and redeploy all dependent applications.
How to confirm the fix worked
Confirm the installed libgd version or commit hash is at or beyond 8255231b68889597d04d451a72438ab92a405aba; re-test the service with a zero-color-palette PNG to verify it no longer crashes.
Typical attack path
- Identify a network endpoint or file upload that invokes libgd PNG encoding
- Generate a PNG containing a zero-color palette
- Deliver the image to the target function via HTTP, file upload, or API
- Trigger gdImagePngPtr to cause the double free and crash
How to detect it
Review application and system logs for repeated crashes or segmentation faults during PNG encoding; correlate with inbound image uploads or API calls that process user-supplied PNG data.
What your security team should do
- Immediately update all instances of libgd to the fixed commit
- Scan internal codebases and containers for older libgd versions
- Add the fixed version to dependency pinning and CI build checks
- Monitor crash logs for segmentation faults during PNG processing until patches are deployed
The record
Double free vulnerability in the gdImagePngPtr function in libgd2 before 2.2.5 allows remote attackers to cause a denial of service via vectors related to a palette with no colors.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.4 | gd | 0 | 2.2.5-r0 |
| Alpine:v3.5 | gd | 0 | 2.2.5-r0 |
| Alpine:v3.6 | gd | 0 | 2.2.5-r0 |
| Debian:11 | libgd2 | 0 | 2.2.5-1 |
| Debian:12 | libgd2 | 0 | 2.2.5-1 |
| Debian:13 | libgd2 | 0 | 2.2.5-1 |
| Debian:14 | libgd2 | 0 | 2.2.5-1 |
| Debian:7 | libgd2 | 0 | 2.0.36~rc1~dfsg-6.1+deb7u10 |
| Debian:8 | libgd2 | 0 | 2.1.0-5+deb8u11 |
| Debian:9 | libgd2 | 0 | 2.2.4-2+deb9u2 |
| Mageia:5 | libgd | 0 | 2.2.5-1.mga5 |
| Mageia:5 | libwmf | 0 | 0.2.8.4-32.5.mga5 |
| Mageia:6 | libgd | 0 | 2.2.5-1.mga6 |
| Mageia:6 | libwmf | 0 | 0.2.8.4-37.1.mga6 |
| SUSE:Linux Enterprise Desktop 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Desktop 12 SP3 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Server 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Server 12 SP3 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Software Development Kit 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Software Development Kit 12 SP3 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Workstation Extension 12 SP2 | gd | 0 | 2.1.0-24.3.4 |
| SUSE:Linux Enterprise Workstation Extension 12 SP3 | gd | 0 | 2.1.0-24.3.4 |
| Ubuntu:14.04:LTS | libgd2 | 0 | 2.1.0-3ubuntu0.8 |
| Ubuntu:16.04:LTS | libgd2 | 0 | 2.1.1-4ubuntu0.16.04.8 |
| openSUSE:Tumbleweed | gd | 0 | 2.3.3-1.1 |
Related vulnerabilities
- CVE-2017-7890 The GIF decoding function gdImageCreateFromGifCtx in gd_gif_in.c in the GD Graphics… Also affects gd
- CVE-2016-10166 Integer underflow in the _gdContributionsAlloc function in gd_interpolation.c in the GD… Also affects gd
- CVE-2016-6132 The gdImageCreateFromTgaCtx function in the GD Graphics Library (aka libgd) before 2.2.3… Also affects gd
- CVE-2016-3074 Integer signedness error in GD Graphics Library 2.1.1 (aka libgd or libgd2) allows remote… Also affects gd
- CVE-2016-6911 The dynamicGetbuf function in the GD Graphics Library (aka libgd) before 2.2.4 allows… Also affects libgd2
- CVE-2013-7456 gd_interpolation.c in the GD Graphics Library (aka libgd) before 2.1.1, as used in PHP… Also affects libgd2
- CVE-2014-9709 The GetCode_ function in gd_gif_in.c in GD 2.1.1 and earlier, as used in PHP before… Also affects libgd2
- CVE-2014-2497 The gdImageCreateFromXpm function in gdxpm.c in libgd, as used in PHP 5.4.26 and earlier… Also affects libgd2