TUCoPS :: Web :: PHP :: b06-2539.htm

cURL Safe Mode Bypass PHP 4.4.2 and 5.1.4
cURL Safe Mode Bypass PHP 4.4.2 and 5.1.4
cURL Safe Mode Bypass PHP 4.4.2 and 5.1.4



-----BEGIN PGP SIGNED MESSAGE-----=0D
Hash: SHA1=0D
=0D
[cURL Safe Mode Bypass PHP 4.4.2 and 5.1.4]=0D
=0D
Author: Maksymilian Arciemowicz (cXIb8O3)=0D
Date:=0D
- -Written: 15.5.2006=0D
- -Public: 27.5.2006=0D
from SECURITYREASON.COM=0D
CVE-2006-2563=0D
=0D
- --- 0.Description ---=0D
PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.=0D
=0D
A nice introduction to PHP by Stig Sather Bakken can be found at http://www.zend.com/zend/art/intro.php on the Zend website. Also, much of the PHP Conference Material is freely available. =0D 
=0D
The PHP safe mode is an attempt to solve the shared-server security problem. It is architecturally incorrect to try to solve this problem at the PHP level, but since the alternatives at the web server and OS levels aren't very realistic, many people, especially ISP's, use safe mode for now.=0D
=0D
PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.=0D
These functions have been added in PHP 4.0.2. =0D
=0D
- --- 1. Safe Mode Bypass in cURL---=0D
General problem exists in cURL functions, because are changed safe_mode, strings 0 (\x00) are change to "_". Next bug exists in prefix file://, becaluse safe_mode checks only path at file:///. =0D
=0D
Example:=0D
- -Safe_Mode bypass exploit.1---=0D
=0D
- -Safe_Mode bypass exploit.1---=0D
=0D
Safe_mode checks only access only to __FILE__. But cURL include filethatyoudonthaveaccessto.php. So you can include any files from directory where script is.=0D
But in this exploit, you can only read files from directory where is this script. You can't use "/".=0D
=0D
There is another conception for an exploit: if you have an access to a directory (rights) where you want to read files. So, if you want to include files from "/home/czarnobyl/www/directoryWITHyourRIGHT/fileFROManotherUSER.php",=0D
you should make a dir like=0D
"/home/czarnobyl/www/directoryWITHyourRIGHT/fileFROManotherUSER.php_/":=0D
=0D
- -Safe_Mode bypass exploit.2---=0D
=0D
- -Safe_Mode bypass exploit.2---=0D
=0D
Safe mode checks access to file=0D
"file:///home/czarnobyl/www/directoryWITHyourRIGHT/fileFROManotherUSER.php_/../../../../../../YourFile.php"=0D
=0D
And cURL include only =0D
"file:///home/czarnobyl/www/directoryWITHyourRIGHT/fileFROManotherUSER.php"=0D
=0D
because \x00 are ending path to file.=0D
=0D
- --- 2. How to fix ---=0D
CVS=0D
http://cvs.php.net/viewcvs.cgi/php-src/ext/curl/=0D 
=0D
- --- 3. Greets ---=0D
=0D
For: sp3x=0D
and=0D
p_e_a, l5x, Infospec, pi3, eax=0D
=0D
- --- 4. Contact ---=0D
Author: SecurityReason.Com [ Maksymilian Arciemowicz ( cXIb8O3 ) ]=0D
Email: max [at] jestsuper [dot] pl or cxib [at] securityreason [dot] com=0D
GPG: http://securityreason.com/key/Arciemowicz.Maksymilian.gpg=0D 
SecurityReason.Com=0D
-----BEGIN PGP SIGNATURE-----=0D
Version: GnuPG v1.4.3 (FreeBSD)=0D
=0D
iD8DBQFEd4bS3Ke13X/fTO4RAsCvAJ9eTxATfJRZZ2/DEoinl4R3Y+DZgACgvHQk=0D
v8npsbXGJqmJRiAT9lnCyv8==0D
=mI80=0D
-----END PGP SIGNATURE-----=0D

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH