--- title: "PHP 5.2.4 ionCube Extension File-Read Bypass" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/php-tricks-esp/php-useful-functions-disable_functions-open_basedir-bypass/disable_functions-php-5.2.4-ioncube-extension-exploit.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/php-tricks-esp/php-useful-functions-disable_functions-open_basedir-bypass/disable_functions-php-5.2.4-ioncube-extension-exploit.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # PHP 5.2.4 ionCube Extension File-Read Bypass This historical proof of concept, credited to shinnai, targeted PHP 5.2.4 with ionCube Loader 6.5 on Windows. Even when `readfile` and `ioncube_read_file` were listed in `disable_functions`, the extension's file-reading function could be used to retrieve files outside the intended restriction. The original report was tested with `ioncube_loader_win_5.2.dll`; do not generalize the result to other PHP or ionCube versions without verification.[[1]](#references)[[2]](#references) The impact is an arbitrary file read in the PHP process context, which can expose PHP source, configuration files, or stored credentials. The original advisory also highlighted the extension's `ioncube_write_file` function as an additional surface, although this proof of concept demonstrates only the read primitive.[[1]](#references) ```php
ionCube output:

'; echo $ioncubeOutput; ?> ``` ## References - [1] [Exploit-DB 4517 - PHP 5.2.4 ionCube `ioncube_read_file` safe-mode/`disable_functions` bypass](https://gitlab.com/exploit-database/exploitdb/-/raw/main/exploits/windows/local/4517.php) - [2] [shinnai's historical security-research site](http://shinnai.altervista.org/)