Bug #70405 [Com]: Exploit
[email protected] ("incubeftw at gmail dot com")
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=70405&edit=1 ID: 70405 Comment by: incubeftw at gmail dot com Reported by: incubeftw at gmail dot com Summary: Exploit Status: Not a bug Type: Bug Package: PHP Language Specification Operating System: Ubuntu 15.04 PHP Version: 7.0.0RC1 Block user comment: N Private report: N New Comment: Let's say a user manages to upload a file that views all classes and then he selects a target class and dumps it and achieving all data that is defined in that class especially if mysql credentials is defined within class private/protected/public methods. If I were you, I would make an option to disallow Class -> Array and var_dump/print_r on Class so we could choose that inside our php.ini whenever we would like. Previous Comments: ------------------------------------------------------------------------ [2015-09-02 10:14:25] [email protected] This is not a bug. The private and protected keywords are visibility modifiers, meaning they allow you to modify (or not) on certain properties. Checkout the documentation[1] for var_dump(), it is already explicitly written there that no matter the visibility modifiers are for properties, everything is read. The object to array cast is described here[2]. [1] http://php.net/var_dump [2] http://php.net/language.types.array#language.types.array.casting ------------------------------------------------------------------------ [2015-09-02 09:55:33] incubeftw at gmail dot com Description: ------------ You can access any variable READ-ONLY on every class by dumping it. Getting it's value is even easier since you can just cast it to an array and then dump it to file. It does NOT matter if it is a protected variable or not. Test script: --------------- <?php class A { private $mysqlUser = 'root'; protected $mysqlPassword = 'test'; private $mysqlDatabase = 'myDatabase'; } $classA = new A(); echo "<pre>"; // Exploit #1 var_dump($classA); // Exploit #2 foreach((array)$classA as $x => $y) { echo "X => ".$x." Y => ".$y."\n"; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70405&edit=1