PHP Object Injection
Investigation
<?php
class Example {
public $file = 'example.txt';
public $msg = 'Hello World';
public function SomeFunc() {
// Some code ...
}
public function __destruct() {
file_put_contents(__DIR__ . '/' . $this->file,$this->msg,FILE_APPEND);
}
}
$data = unserialize($_GET['data']);
// Some code ...
?>Exploitation 1
1. Generate a Serialized Malicious Object
2. Download a Reverse Shell Script.
Exploitation 2
Automation
References
Last updated