1
On the website of OWASP It explains this kind of flaw that makes code injection possible. But one part was not clear to me and if anyone who understands can clarify me. The excerpt says the following:
In order to successfully exploit a PHP Object Injection Vulnerability two conditions must be met:
The application must have a class which Implements a PHP Magic method (such as __wakeup or __destruct) that can be used to carry out Malicious Attacks, or to start a "POP chain".
-
All of the classes used During the Attack must be declared when the Vulnerable unserialize() is being called, otherwise Object autoloading must be supported for such classes.
That is, when he says that the application must implement a magic method so that there is success in the exploitation of this failure. He is referring to any and all classes in my application, or only the class of the object being serialized?
Ex:
let’s say I have an object
class Usuario{
...
}
and an object
class Setup{
function __construct() {
...
}
function __wakeup() {
...
}
}
And I was Serializing my obj $user
. An attacker could use the magic methods of the class Setup
for a possible attack? or these methods should exist in the class of the object being serialized. In this case the class Usuario
?
$user = new Usuario();
echo serialize($user);
Very good @Inkeliz! Thanks for the clarifications. However I don’t use the unserialize() Function directly. I have a include of a page header on several pages. On this header page I call an object just to fetch a get value. However, it was enough for Burp Suite to understand and classify this as 'Serialized Object in HTTP message'. I believe that when I use include calling a q page makes an obj the PHP itself uses the unserialize() Function behind the scenes. But he’s not sure if that’s it msm. :/
– alan