Bug 1305494 - php: exec function ignore length and look for NULL termination
Summary: php: exec function ignore length and look for NULL termination
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 1305565
Blocks: 1305564
TreeView+ depends on / blocked
Reported: 2016-02-08 12:31 UTC by Adam Mariš
Modified: 2019-09-29 13:43 UTC (History)
13 users (show)

Fixed In Version: php 5.6.18, php 5.5.32
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-07-27 20:28:37 UTC

Attachments (Terms of Use)

Description Adam Mariš 2016-02-08 12:31:55 UTC
It was reported that functions defined in ext/standard/exec.c which work with strings (escapeshellcmd, eschapeshellarg, shell_exec), all ignore the length of the PHP string and work with NULL termination instead. If the string is not NULL terminated (some function uses RETURN_STRINGL(buf, len, 0); where buf is not NULL terminated), running these functions will cause buffer overflow.

Upstream bug:


Upstream patch:


Comment 1 Adam Mariš 2016-02-08 15:14:00 UTC
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1305565]

Comment 2 Tomas Hoger 2016-07-27 20:28:37 UTC
Upstream does not believe this is real security problem.  PHP does not normally create strings which are not NULL terminated, making it unlikely to have untrusted, not NULL terminated inputs passed to the affected escaping functions.  Therefore, there's currently no plan to backport this fix to PHP versions in Red Hat products.

Note You need to log in before you can comment on or make changes to this bug.