CVE Vulnerabilities

CVE-2016-5095

Integer Overflow or Wraparound

Published: Aug 07, 2016 | Modified: Nov 28, 2016
CVSS 3.x
8.6
HIGH
Source:
NVD
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H
CVSS 2.x
7.5 HIGH
AV:N/AC:L/Au:N/C:P/I:P/A:P
RedHat/V2
5.1 LOW
AV:N/AC:H/Au:N/C:P/I:P/A:P
RedHat/V3
Ubuntu
LOW

Integer overflow in the php_escape_html_entities_ex function in ext/standard/html.c in PHP before 5.5.36 and 5.6.x before 5.6.22 allows remote attackers to cause a denial of service or possibly have unspecified other impact by triggering a large output string from a FILTER_SANITIZE_FULL_SPECIAL_CHARS filter_var call. NOTE: this vulnerability exists because of an incomplete fix for CVE-2016-5094.

Weakness

The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.

Affected Software

Name Vendor Start Version End Version
Php Php * 5.5.35 (including)
Php Php 5.6.0-alpha1 (including) 5.6.0-alpha1 (including)
Php Php 5.6.0-alpha2 (including) 5.6.0-alpha2 (including)
Php Php 5.6.0-alpha3 (including) 5.6.0-alpha3 (including)
Php Php 5.6.0-alpha4 (including) 5.6.0-alpha4 (including)
Php Php 5.6.0-alpha5 (including) 5.6.0-alpha5 (including)
Php Php 5.6.0-beta1 (including) 5.6.0-beta1 (including)
Php Php 5.6.0-beta2 (including) 5.6.0-beta2 (including)
Php Php 5.6.0-beta3 (including) 5.6.0-beta3 (including)
Php Php 5.6.0-beta4 (including) 5.6.0-beta4 (including)
Php Php 5.6.1 (including) 5.6.1 (including)
Php Php 5.6.2 (including) 5.6.2 (including)
Php Php 5.6.3 (including) 5.6.3 (including)
Php Php 5.6.4 (including) 5.6.4 (including)
Php Php 5.6.5 (including) 5.6.5 (including)
Php Php 5.6.6 (including) 5.6.6 (including)
Php Php 5.6.7 (including) 5.6.7 (including)
Php Php 5.6.8 (including) 5.6.8 (including)
Php Php 5.6.9 (including) 5.6.9 (including)
Php Php 5.6.10 (including) 5.6.10 (including)
Php Php 5.6.11 (including) 5.6.11 (including)
Php Php 5.6.12 (including) 5.6.12 (including)
Php Php 5.6.13 (including) 5.6.13 (including)
Php Php 5.6.14 (including) 5.6.14 (including)
Php Php 5.6.15 (including) 5.6.15 (including)
Php Php 5.6.16 (including) 5.6.16 (including)
Php Php 5.6.17 (including) 5.6.17 (including)
Php Php 5.6.18 (including) 5.6.18 (including)
Php Php 5.6.19 (including) 5.6.19 (including)
Php Php 5.6.20 (including) 5.6.20 (including)
Php Php 5.6.21 (including) 5.6.21 (including)
Php5 Ubuntu precise *
Php5 Ubuntu trusty *
Php5 Ubuntu upstream *
Php5 Ubuntu wily *

Potential Mitigations

  • Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
  • If possible, choose a language or compiler that performs automatic bounds checking.
  • Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
  • Use libraries or frameworks that make it easier to handle numbers without unexpected consequences.
  • Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++). [REF-106]
  • Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.
  • Use unsigned integers where possible. This makes it easier to perform validation for integer overflows. When signed integers are required, ensure that the range check includes minimum values as well as maximum values.
  • Understand the programming language’s underlying representation and how it interacts with numeric calculation (CWE-681). Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, “not-a-number” calculations, and how the language handles numbers that are too large or too small for its underlying representation. [REF-7]
  • Also be careful to account for 32-bit, 64-bit, and other potential differences that may affect the numeric representation.

References