PHP 5.4.3 (cli) Code Read Vulnerability?

Posted: June 15th, 2012 | Author: | Filed under: IT Related | Tags: , , | 2 Comments »

As posted on, cheki claimed that PHP 5.4.3 is vulnerable to code read vulnerability, where the PHP interpreter will fail to execute the file once ‘~’ symbol added to the end of the file name. Snipped from the PoC:

#Demo: [root@cheki]# curl
result: <!--?php phpinfo(); ?-->
#Target: http://localhost/index.php~
result: <!--?php phpinfo(); ?-->
[root@cheki]# curl
result: NULL
#Target: http://localhost/index.php
result: NULL

Ok.. Since I had a test machine (Ubuntu) SSHed earlier, so I stright away add a new PPA repo ( and install PHP 5.4.3. So here is my version to verify the PoC:

xanda@vostro:~$ php -v
PHP 5.4.3-4~precise+1 (cli) (built: May 17 2012 13:00:25) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
xanda@vostro:~$ curl
<form action="" method="post">
<input type="text" name="lala">
<input type="submit">
xanda@vostro:~$ curl
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL /index.php~ was not found on this server.</p>
<address>Apache/2.2.22 (Ubuntu) Server at Port 80</address>

Hurmmmm okkkk…. I haven’t tested on Fedora release 17 (Beefy Miracle) as claimed by the author, but I think this is… You name it..

Please take note that most of GUI based text editor (eg: Gedit) will (auto)save your edited file into a backup file with the same file name but ended with ‘~’… Just like in the PoC huh?

If anyone managed to test it on Fedora release 17 (Beefy Miracle), kindly drop me the result on the comment section. Thanks in advance

Cheers ūüôā

Mirror for the advisory:



1) @Netasq has given 2 workarounds for this issue.

    In case you can't update PHP to 5.4.4, a quick Apache fix ‪#security‬ (1/2)  Order allow,deny Deny from all

2) Its not listed here (or I’ve missed it?) :-