from web vulnerability to exploit in 15 minutes
TRANSCRIPT
From Web Vulnerability to Exploit in 15 minutes
Pichaya Morimoto a.k.a. longcat
Code Mania 10
June 27, 2015
★ Impact of a Hacking Incident ★ PHP Object Serialization ★ PHP Magic Method★ DEMO: Teleport Portal ★ CodeIgniter’s Session Cookie★ Secure Code Review: POP Gadgets★ Inspect Requests by BurpSuite★ Write Exploit Code
○ Python○ Metasploit
Overview
2 นาที
5 นาที
3 นาที
5 นาที
รวม: 15 นาที
★ A1 Injection
★ A2 Broken Authentication and Session Management★ A3 Cross-Site Scripting (XSS)★ A4 Insecure Direct Object References...★ A10 Unvalidated Redirects and Forwards
OWASP Top 10 - 2013
SQL queries, LDAP queries, XPath queries, OS commands, program arguments, etc.
★ $number = 1234;★ $text = 'codemania';
★ $fruits = array('apple','banana','orange');
class FooController {public $foo='bar';function doX() { ... } }
★ $a = new FooController;
PHP Object Serialization
serialize([<คา]);
unserialize([คา>]);
★ $fruits = array('apple','banana','orange');
PHP Object Serialization
a:3:{i:0;s:5:"apple";i:1;s:6:"banana";i:2;s:6:"orange";}
O:13:"FooController":1:{s:3:"foo";s:3:"bar";}
class FooController {public $foo = 'bar';
}★ $a = new FooController;
serialize([<คา]);
PHP Object DeSerialization
User Input $_POST$_GET$_COOKIE$_SERVER...
class FooController {public $foo = 'bar';
}
$a = unserialize($_GET['a']);
unserialize([คา>]);
***?
__construct() __destruct()__sleep() __wakeup()__toString()__call(), __callStatic()__get(), __set()...
PHP Magic Method
POP Gadget
PHP Magic Method
__sleep: เวลา serialize แลวเอา ตัวแปรบางตัวออก
__wakeup: เวลา unserialize แลวเอา ตัวแปรอื่นมาใสแทน
__destruct: ถามีขอความเออเรอเก็บไวใหแสดงกอนจบการทํางาน
★ บางแอพพัฒนาจาก CI แลวคนเอาไปใชไมเปลี่ยน★ Offline Bruteforce★ รีวิวโคด / ขโมยโคด★ ชองโหวอื่นๆ
ไมรู Encryption Key ทําไง
Beyond: POP Chain
http://syssec.rub.de/media/emma/veroeffentlichungen/2014/09/10/POPChainGeneration-CCS14.pdf