Cloudanix VulnDB

CVE-2017-7890

Medium · 6.5

CVSS

6.5

EPSS

3.4%

Published

Aug 2, 2017

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A bug in image-handling software used by many websites can let attackers read pieces of private memory when a specially made picture file is processed.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Data Exposure
Component
Library
Class
Information Disclosure
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The GIF decoding function fails to initialize colorMap arrays, allowing a crafted GIF to read approximately 700 bytes of uninitialized stack memory and disclose sensitive process data over the network.

Why it matters to the business

Attackers may obtain credentials, session tokens, or internal configuration details from PHP-based applications that accept or process user-supplied GIF images, increasing the risk of follow-on compromise.

How an attack unfolds

An attacker supplies a malicious GIF image that triggers gdImageCreateFromGifCtx in libgd; because the color tables are not zeroed, stack contents are copied into the decoded image structure and returned to the caller, exposing sensitive memory.

How to fix it

Upgrade PHP to 5.6.31 or newer and 7.1.7 or newer; rebuild against a patched libgd if custom builds are used; consider disabling GIF support where image formats can be restricted.

How to confirm the fix worked

Confirm PHP version is at or above the fixed releases; attempt to process a test GIF crafted to exercise the colorMap path and verify no stack data appears in output or logs.

Typical attack path

  1. Identify a PHP application endpoint that accepts or renders GIF images
  2. Craft a GIF that leaves colorMap uninitialized
  3. Deliver the image via upload, URL parameter, or embedded resource
  4. Observe the response or error output for leaked stack bytes

How to detect it

Search web-server and application logs for GIF processing requests that coincide with unusually large or malformed image responses; inspect error logs or debug output for unexpected binary data fragments.

What your security team should do

  • Apply the PHP upgrades as the highest-priority action
  • Audit all code paths that invoke imagecreatefromgif or equivalent GD functions
  • Implement input sanitization or format whitelisting for image uploads
  • Review historical access logs for GIF processing endpoints

The record

The GIF decoding function gdImageCreateFromGifCtx in gd_gif_in.c in the GD Graphics Library (aka libgd), as used in PHP before 5.6.31 and 7.x before 7.1.7, does not zero colorMap arrays before use. A specially crafted GIF image could use the uninitialized tables to read ~700 bytes from the top of the stack, potentially disclosing sensitive information.

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+deb7u9
Debian:8 libgd2 0 2.1.0-5+deb8u10
Debian:9 libgd2 0 2.2.4-2+deb9u1
Mageia:5 libgd 0 2.2.4-1.2.mga5
Mageia:5 php 0 5.6.31-1.mga5
Mageia:6 libgd 0 2.2.4-3.1.mga6
Mageia:6 php 0 5.6.31-1.mga6
Red Hat:enterprise_linux:7::client php 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-bcmath 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-cli 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-common 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-dba 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-debuginfo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-devel 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-embedded 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-enchant 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-fpm 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-gd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-intl 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-ldap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-mbstring 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-mysql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-mysqlnd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-odbc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-pdo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-pgsql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-process 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-pspell 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-recode 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-snmp 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-soap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-xml 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::client php-xmlrpc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-bcmath 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-cli 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-common 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-dba 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-debuginfo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-devel 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-embedded 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-enchant 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-fpm 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-gd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-intl 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-ldap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-mbstring 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-mysql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-mysqlnd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-odbc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-pdo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-pgsql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-process 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-pspell 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-recode 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-snmp 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-soap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-xml 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::computenode php-xmlrpc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-bcmath 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-cli 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-common 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-dba 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-debuginfo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-devel 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-embedded 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-enchant 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-fpm 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-gd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-intl 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-ldap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-mbstring 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-mysql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-mysqlnd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-odbc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-pdo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-pgsql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-process 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-pspell 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-recode 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-snmp 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-soap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-xml 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::server php-xmlrpc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-bcmath 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-cli 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-common 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-dba 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-debuginfo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-devel 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-embedded 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-enchant 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-fpm 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-gd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-intl 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-ldap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-mbstring 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-mysql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-mysqlnd 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-odbc 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-pdo 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-pgsql 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-process 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-pspell 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-recode 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-snmp 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-soap 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-xml 0 0:5.4.16-43.el7_4.1
Red Hat:enterprise_linux:7::workstation php-xmlrpc 0 0:5.4.16-43.el7_4.1
Red Hat:rhel_software_collections:3::el6 rh-php70-php 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-bcmath 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-cli 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-common 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-dba 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-dbg 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-debuginfo 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-devel 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-embedded 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-enchant 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-fpm 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-gd 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-gmp 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-imap 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-intl 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-json 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-ldap 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-mbstring 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-mysqlnd 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-odbc 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-opcache 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-pdo 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-pgsql 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-process 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-pspell 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-recode 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-snmp 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-soap 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-tidy 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-xml 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-xmlrpc 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el6 rh-php70-php-zip 0 0:7.0.27-1.el6
Red Hat:rhel_software_collections:3::el7 rh-php70-php 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-bcmath 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-cli 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-common 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-dba 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-dbg 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-debuginfo 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-devel 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-embedded 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-enchant 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-fpm 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-gd 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-gmp 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-intl 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-json 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-ldap 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-mbstring 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-mysqlnd 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-odbc 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-opcache 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-pdo 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-pgsql 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-process 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-pspell 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-recode 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-snmp 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-soap 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-xml 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-xmlrpc 0 0:7.0.27-1.el7
Red Hat:rhel_software_collections:3::el7 rh-php70-php-zip 0 0:7.0.27-1.el7
SUSE:Linux Enterprise Desktop 12 SP4 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Module for Web and Scripting 12 php5 0 5.5.14-109.5.1
SUSE:Linux Enterprise Module for Web and Scripting 12 php7 0 7.0.7-50.9.2
SUSE:Linux Enterprise Server 11 SP4 php53 0 5.3.17-112.5.1
SUSE:Linux Enterprise Server 12 SP4 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Server 12 SP5 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 php53 0 5.3.17-112.5.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP4 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP5 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Software Development Kit 11 SP4 php53 0 5.3.17-112.5.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 php5 0 5.5.14-109.5.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 php7 0 7.0.7-50.9.2
SUSE:Linux Enterprise Software Development Kit 12 SP3 php5 0 5.5.14-109.5.1
SUSE:Linux Enterprise Software Development Kit 12 SP3 php7 0 7.0.7-50.9.2
SUSE:Linux Enterprise Software Development Kit 12 SP4 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Software Development Kit 12 SP5 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Workstation Extension 12 SP4 gd 0 2.1.0-24.17.1
SUSE:Linux Enterprise Workstation Extension 12 SP5 gd 0 2.1.0-24.17.1
Ubuntu:14.04:LTS libgd2 0 2.1.0-3ubuntu0.7
Ubuntu:16.04:LTS libgd2 0 2.1.1-4ubuntu0.16.04.7

Related vulnerabilities