See how php compares to other vendors in security performance
The mysqlnd wire protocol parser reads fields out of server packets before checking that the packet still holds enough bytes for them. A malicious or compromised MySQL server can send a truncated packet and make the client read past the end of the packet buffer, which is undefined behaviour and can crash the process.
Fixed (Broken Apache map value NULL check). (CVE-2026-7262)
Fixed (Null pointer dereference in phpmbcheckencoding() via mberegsearchinit()). (CVE-2026-7259)
Fixed CVE-2025-67899 (uriparser through 0.9.9 allows unbounded recursion and stack consumption).
In PHP versions:8.1. before 8.1.33, 8.2. before 8.2.29, 8.3. before 8.3.23, 8.4. before 8.4.10 some functions like fsockopen() lack validation that the hostname supplied does not contain null characters. This may lead to other functions like parseurl() treat the hostname in different way, thus opening way to security problems if the user code implements access checks before access using such functions.
In PHP versions 8.1. before 8.1.30, 8.2. before 8.2.24, 8.3. before 8.3.12, when using PHP-FPM SAPI and it is configured to catch workers output through catchworkersoutput = yes, it may be possible to pollute the final log or remove up to 4 characters from the log messages by manipulating log message content. Additionally, if PHP-FPM is configured to use syslog output, it may be possible to further remove log data using the same vulnerability.
Fixed bug (Logs from childrens may be altered). (CVE-2024-9026)
CVE-2023-0567[0]: PHP: Passwordverify() always return true with some hash
[0] https://security-tracker.debian.org/tracker/CVE-2023-0567 https://www.cve.org/CVERecord?id=CVE-2023-0567 https://github.com/php/php-src/security/advisories/GHSA-7fj2-8x79-rjf4
In PHP versions before 7.4.31, 8.0.24 and 8.1.11, the phar uncompressor code would recursively uncompress "quines" gzip files, resulting in an infinite loop.
https://bugs.php.net/bug.php?id=81726
An issue was discovered 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. xmlrpcdecode() can allow a hostile XMLRPC server to cause PHP to read memory outside of allocated areas in base64decodexmlrpc in ext/xmlrpc/libxmlrpc/base64.c.
Upstream commit: http://git.php.net/?p=php-src.git;a=commit;h=1cc2182bcc81e185c14837e659d12b268cb99d63 http://git.php.net/?p=php-src.git;a=commit;h=027f68ff10a439c5c331bcbfdd6eb2a5fca0948a
Reference: https://bugs.php.net/bug.php?id=77380
It was reported that php-fpm package is vulnerable to symlink attack:
ls -lad /var/log/php-fpm drwxrwx--- 2 apache root 4096 May 28 18:53 /var/log/php-fpm
https://git.centos.org/blob/rpms!php/4b401fd4915cda3a1a336902afad4e5321859c32/SPECS!php.spec#L1409
%attr(770,apache,root) %dir %{localstatedir}/log/php-fpm
After installing php-fpm package, any software running under apache user can create symlink /var/log/php-fpm/error.log pointing to any file. After starting php-fpm service - file pointed by symlink will be appended by php-fpm log output. If a file did not exist before - it will be created. This issue only exist for a short time - after php-fpm package install and before php-fpm process is started for the first time. Exiting working configurations are not affected by this issue.
Steps to reproduce: - make sure you don't have php-fpm leftovers: # rm -rf /var/log/php-fpm - install php-fpm: # dnf install php-fpm - as an 'apache' user create an evil symlink: # su -s /bin/bash - apache $ ln -s /root/.bashrc /var/log/php-fpm/error.log - start php-fpm process: # systemctl start php-fpm - look at the contents of /root/.bashrc file (php-fpm error log output will be appended there) # cat /root/.bashrc
It was reported that pcreexec in PHP pcre extension partially initialize a buffer when an invalid regex is processed, which can information disclosure.
A mitigation fix have been applied in PHP 5.4+ http://git.php.net/?p=php-src.git;a=commitdiff;h=c351b47ce85a3a147cfa801fa9f0149ab4160834
Upstream bug report (with a patch proposal): http://bugs.exim.org/showbug.cgi?id=1537
The PEARREST class in REST.php in PEAR in PHP through 5.6.0 allows local users to write to arbitrary files via a symlink attack on a (1) rest.cachefile or (2) rest.cacheid file in /tmp/pear/cache/, related to the retrieveCacheFirst and useLocalCache functions.
Stefan Esser discovered a type confusion issue affecting phpinfo(). Setting certain variables before running phpinfo() could allow a local attacker to leak memory from an arbitrary location. This could be an issue remotely in shared hosting environments if PHP code can be injected. The following post demonstrates reading an SSL private key in an environment using PHP 5.3, modphp, and modssl:
https://www.sektioneins.de/en/blog/14-07-04-phpinfo-infoleak.html
References: https://bugs.php.net/bug.php?id=67498 http://git.php.net/?p=php-src.git;a=commitdiff;h=3804c0d00fa6e629173fb1c8c61f8f88d5fe39b9
acinclude.m4, as used in the configure script in PHP 5.5.13 and earlier, allows local users to overwrite arbitrary files via a symlink attack on the /tmp/phpglibccheck file.
It was reported[1] to the full-disclosure mailing list that PHP's configure script uses a predictable filename in /tmp/, "/tmp/phpglibccheck". A local attacker could use this flaw to perform a symbolic link attack against a user building the source RPM or running the configure script.
[1] http://seclists.org/fulldisclosure/2014/Jun/21
On http://git.php.net/?p=php-src.git;a=blob;f=ext/soap/phpsdl.c;h=0ac4c2ed7a9bf87bb454db58ae3d969eef36f244;hb=HEAD#l3224
We see that php wdsl extension is reading predictible filename from a cache directory. The name is based on a configurable directory name, a prefix, and a md5, md5 derived for the file that would be cached ( or rather the url ).
So far, so good. However, default configuration is to use /tmp : http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-dir
so someone could connect to a shared php server ( not uncommon ), and if some php code is using this feature ( ie, using wsdl ), with cache enabled by default ,it could just pre-create the file in /tmp to have it used instead of the one intended to be used ( ie, a cache injection issue ). After a quick look, there is no check of owner or permission in getsdlfromcache.
I am not able to say if WSDL injection is a serious issue or not.
Fedora do have PrivateTmp in systemd file, that mitigate this issue ( provided someone do not use php to make the attack ). RHEL < 7 do not have it however.
So far, upstream was not notified, except our php maintainer for a quick sanity check. I assume this affect all php version since a few years.
pdosqlparser.re in the PDO extension in PHP before 5.3.14 and 5.4.x before 5.4.4 does not properly determine the end of the query string during parsing of prepared statements, which allows remote attackers to cause a denial of service (out-of-bounds read and application crash) via a crafted parameter value.
A security flaw was found in the way the comprinttypeinfo() routine of the PHP scripting language processed certain COM object arguments. If a PHP language based application remotely accepted untrusted comprinttypeinfo() arguments in order to print out a PHP class definition for a dispatchable interface, a remote attacker could provide a specially-crafted COM object, which once processed by the application could lead to that application crash, or, potentially arbitrary code execution with the privileges of the user running the application.
References: [1] https://isc.sans.edu/diary/PHP+5+4+Remote+Exploit+PoC+in+the+wild/13255 [2] http://packetstormsecurity.org/files/112851/php54-exec.txt [3] http://www.exploit-db.com/exploits/18861/ [4] http://www.reddit.com/r/netsec/comments/tuyp3/iscdiaryphp54remoteexploitpocinthewild/
CVE request: [5] http://www.openwall.com/lists/oss-security/2012/05/20/1
CVE assignment: [6] http://www.openwall.com/lists/oss-security/2012/05/20/2
Common Vulnerabilities and Exposures assigned an identifier CVE-2012-0831 to the following vulnerability:
Name: CVE-2012-0831 URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-0831 Assigned: 20120119 Reference: http://svn.php.net/viewvc?view=revision&revision=323016 Reference: https://launchpadlibrarian.net/92454212/php55.3.2-1ubuntu4.13.diff.gz Reference: UBUNTU:USN-1358-1 Reference: http://www.ubuntu.com/usn/USN-1358-1 Reference: http://www.securityfocus.com/bid/51954
PHP before 5.3.10 does not properly perform a temporary change to the magicquotesgpc directive during the importing of environment variables, which makes it easier for remote attackers to conduct SQL injection attacks via a crafted request, related to main/phpvariables.c, sapi/cgi/cgimain.c, and sapi/fpm/fpm/fpmmain.c.
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-4153 to the following vulnerability:
Name: CVE-2011-4153 URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-4153 Assigned: 20111021 Reference: http://archives.neohapsis.com/archives/bugtraq/2012-01/0092.html Reference: http://www.exploit-db.com/exploits/18370/ Reference: http://cxsecurity.com/research/103
PHP 5.3.8 does not always check the return value of the zendstrndup function, which might allow remote attackers to cause a denial of service (NULL pointer dereference and application crash) via crafted input to an application that performs strndup operations on untrusted string data, as demonstrated by the define function in zendbuiltinfunctions.c, and unspecified functions in ext/soap/phpsdl.c, ext/standard/syslog.c, ext/standard/browscap.c, ext/oci8/oci8.c, ext/comdotnet/comtypeinfo.c, and main/phpopentemporaryfile.c.
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-1471 to the following vulnerability:
Integer signedness error in zipstream.c in the Zip extension in PHP before 5.3.6 allows context-dependent attackers to cause a denial of service (CPU consumption) via a malformed archive file that triggers errors in zipfread function calls.
References: [1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1471 [2] http://bugs.php.net/bug.php?id=49072 [3] http://www.php.net/ChangeLog-5.php
Upstream patches / backports: [4] http://svn.php.net/viewvc/?view=revision&revision=287095 [5] http://svn.php.net/viewvc/?view=revision&revision=287102 [6] http://svn.php.net/viewvc/?view=revision&revision=307916 [7] http://svn.php.net/viewvc/?view=revision&revision=307917
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-1469 to the following vulnerability:
Unspecified vulnerability in the Streams component in PHP before 5.3.6 allows context-dependent attackers to cause a denial of service (application crash) by accessing an ftp:// URL during use of an HTTP proxy with the FTP wrapper.
References: [1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1469 [2] http://bugs.php.net/bug.php?id=54092 [3] http://www.php.net/ChangeLog-5.php
Upstream patch: [4] http://svn.php.net/viewvc/?view=revision&revision=308734
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-1466 to the following vulnerability:
Integer overflow in the SdnToJulian function in the Calendar extension in PHP before 5.3.6 allows context-dependent attackers to cause a denial of service (application crash) via a large integer in the first argument to the calfromjd function.
References: [1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1466 [2] http://bugs.php.net/bug.php?id=53574 [3] http://www.php.net/ChangeLog-5.php
Upstream patch: [4] http://svn.php.net/viewvc/?view=revision&revision=306475
Public PoC (from [2]): ====================== <?php for(;;) { $x = rand(0, 2147483640); echo "$x\n"; $dummy = calfromjd($x,0); $dummy = calfromjd($x,1); } ?>
It was reported that ZipArchive() would segfault when opening an empty archive with the FLUNCHANGED flag set [1]. This is corrected in upstream PHP 5.3.6 [2],[3].
[1] http://bugs.php.net/bug.php?id=53885 [2] http://www.php.net/ChangeLog-5.php#5.3.6 [3] http://svn.php.net/viewvc/?view=revision&revision=307867
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-1072 to the following vulnerability:
Name: CVE-2011-1072 URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1072 Assigned: 20110224 Reference: http://openwall.com/lists/oss-security/2011/02/28/3 Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=546164 Reference: http://news.php.net/php.pear.cvs/61264 Reference: http://pear.php.net/advisory-20110228.txt Reference: http://pear.php.net/bugs/bug.php?id=18056 Reference: http://security-tracker.debian.org/tracker/CVE-2011-1072 Reference: http://svn.php.net/viewvc?view=revision&revision=308687 Reference: http://www.securityfocus.com/bid/46605 Reference: http://secunia.com/advisories/43533 Reference: http://xforce.iss.net/xforce/xfdb/65721
The installer in PEAR before 1.9.2 allows local users to overwrite arbitrary files via a symlink attack on the package.xml file, related to the (1) downloaddir, (2) cachedir, (3) tmpdir, and (4) pear-build-download directories, a different vulnerability than CVE-2007-2519.
Note that PEAR 1.9.2 did not fully correct the issue, and MITRE assigned CVE-2011-1144 to that:
The installer in PEAR 1.9.2 and earlier allows local users to overwrite arbitrary files via a symlink attack on the package.xml file, related to the (1) downloaddir, (2) cachedir, (3) tmpdir, and (4) pear-build-download directories. NOTE: this vulnerability exists because of an incomplete fix for CVE-2011-1072.
References to the incomplete fix:
http://openwall.com/lists/oss-security/2011/03/01/9
So if we do update to 1.9.2 without the full fix, then CVE-2011-1144 applies as 1.9.2 contains an incomplete fix.
It also does not look like older versions of PEAR (e.g. 1.4.9 as found in Red Hat Enterprise Linux 5) are vulnerable as there is no specific download directory or temporary directory specifications used (downloaddir, tempdir), and the default cache directory is /var/cache/php-pear which is owned root:root and mode 0755 (not a world-writable /tmp).
Common Vulnerabilities and Exposures assigned an identifier CVE-2011-1072 to the following vulnerability:
Name: CVE-2011-1072 URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1072 Assigned: 20110224 Reference: http://openwall.com/lists/oss-security/2011/02/28/3 Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=546164 Reference: http://news.php.net/php.pear.cvs/61264 Reference: http://pear.php.net/advisory-20110228.txt Reference: http://pear.php.net/bugs/bug.php?id=18056 Reference: http://security-tracker.debian.org/tracker/CVE-2011-1072 Reference: http://svn.php.net/viewvc?view=revision&revision=308687 Reference: http://www.securityfocus.com/bid/46605 Reference: http://secunia.com/advisories/43533 Reference: http://xforce.iss.net/xforce/xfdb/65721
The installer in PEAR before 1.9.2 allows local users to overwrite arbitrary files via a symlink attack on the package.xml file, related to the (1) downloaddir, (2) cachedir, (3) tmpdir, and (4) pear-build-download directories, a different vulnerability than CVE-2007-2519.
Note that PEAR 1.9.2 did not fully correct the issue, and MITRE assigned CVE-2011-1144 to that:
The installer in PEAR 1.9.2 and earlier allows local users to overwrite arbitrary files via a symlink attack on the package.xml file, related to the (1) downloaddir, (2) cachedir, (3) tmpdir, and (4) pear-build-download directories. NOTE: this vulnerability exists because of an incomplete fix for CVE-2011-1072.
References to the incomplete fix:
http://openwall.com/lists/oss-security/2011/03/01/9
So if we do update to 1.9.2 without the full fix, then CVE-2011-1144 applies as 1.9.2 contains an incomplete fix.
It also does not look like older versions of PEAR (e.g. 1.4.9 as found in Red Hat Enterprise Linux 5) are vulnerable as there is no specific download directory or temporary directory specifications used (downloaddir, tempdir), and the default cache directory is /var/cache/php-pear which is owned root:root and mode 0755 (not a world-writable /tmp).
The installer in PEAR 1.9.2 and earlier allows local users to overwrite arbitrary files via a symlink attack on the package.xml file, related to the (1) downloaddir, (2) cachedir, (3) tmpdir, and (4) pear-build-download directories. NOTE: this vulnerability exists because of an incomplete fix for CVE-2011-1072.
An insufficient input validation flaws was discovered in the PHP's Exif extension that allows extracting Exif data from image files: http://thread.gmane.org/gmane.comp.security.oss.general/4198
An integer overflow causes PHP to not validate offsets read from the file properly, causing it to read behind the end of the buffer. This leads to PHP interpreter crash when reading specially crafted Exif data.
Before the code over-reading the buffer is reached, PHP needs to allocate a large amount of memory (based on the components / length value read from the file). This attempt triggers the integer overflow check in safeemalloc on 32bit platforms and requires the memorylimit for the script to be set to -1 (i.e. no limit is enforced by PHP) on 64bit platforms.
Upstream commits, which include reproducers: http://svn.php.net/viewvc?view=revision&revision=308316 http://svn.php.net/viewvc?view=revision&revision=308317
The follow-up commit replaces the use of hard-coded numeric constant with INT32MAX: http://svn.php.net/viewvc?view=revision&revision=308362
This fix should first appear in upstream version 5.3.6.
Kees Cook reported an information leak flaw in the PHP's XMLWriter, triggered by an invalid UTF-8 string passed to the writeAttribute method:
http://thread.gmane.org/gmane.comp.security.oss.general/4122 http://bugs.php.net/bug.php?id=52998 https://bugzilla.gnome.org/showbug.cgi?id=631551
In the initial report, it was unclear if this is PHP or libxml2 flaw. libxml2 upstream author's reply in the gnome bugzilla bug suggests this issue needs to be addressed in PHP, as the libxml2 API requires input to be valid UTF-8 and \0 terminated string.