• 2007-03-18

    blackhat-2007

    http://www.blackhat.com/html/bh-media-archives/bh-archives-2007.html#dc
  • the Month of PHP Bugs 

    http://www.php-security.org/ 

  • 2007-03-01

    whos is stupid!!!

    http://forum.milw0rm.com/showthread.php?p=35589&posted=1
  • http://honeynet.org/papers/webapp/
  • 2007-02-25

    又见fckeditor

    又见fckeditor
    文/superhei
    以前发过一个fckeditor的上传文件漏洞:http://superhei.blogbus.com/logs/2006/02/1916091.html
    我们看看新版本2.4的,还是被动过滤:

    config.php:

    $Config['AllowedExtensions']['File']    = array() ;
  • 新一代的webshell<Dynamic Function Evaluation>

    在次拜读大牛的的文档<Dynamic Evaluation Vulnerabilities in PHP applications>发现<Dynamic

    Function Evaluation>里
    可以做webshell那是太合适不过了 :)。

    Code:
    <?
    $func();
  • Metasploit的EvalPayload模块


    [基于Metasploit 2.x]

    Metasploit里面关于web app的执行代码的exp都是调用passthru来执行系统命令,这个有个很大的弊端就是受Safe Mode等的限制。于是就有了EvalPayload模块


    1、EvalPayload.pm http://60.190.243.111/superhei/Metasploit/EvalPayload....
  • http://www.securityfocus.com/columnists/432/Stefan Esser is the founder of both the Hardened-PHP Project and the PHP Security Response Team (which he recently left). Federico Biancuzzi discussed with him how the PHP Security Response Team works,...
  • [申明]本人和x木之流没有任何关系,本贴只是个人看法,请x木之流不要利用本文恶意攻击 :)。

    1.“一波未平,又起一波”:

    一波:xfocus vs x木
    又一波:xfocus vs 阿里巴巴

    2.抄饭结果:
    xfocus被ddos了
    x木红了
    超级x警用户多了
    .....

    [抄饭就是这样抄的]

    3.隐藏的0-day

    xfocus vs x木 :事件开始于 x木 黑了qq
    xfocus vs 阿里巴巴:阿里巴巴和qq有过过节

    [隐藏的0-day:qq]

    4.网络黑社会?
    请注意?,不要对号如坐。

    xfocus vs x木:qq称x木危险过qq,x木否认。
    xfocus vs 阿里巴巴:http://www.xfocus.net/articles/200701/901.html一文里提到
    -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      Disclosure Timeline:

        2006.12.10        漏洞被发现
        2006.12.11        通知厂商
        2006.12.22(左右)    厂商修复漏洞,但未发布任何更新信息以及安全公告
        2007.01.15        协商未果,此公告发布
    -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    里面的“协商”,到底是杂回事情呢,是不是也和x木和qq“协商”一样呢?


  • 浅谈web漏洞挖掘—特殊变量fuzz?

    目前对web应用程序漏洞的挖掘方法有:
    1. 纯粹的黑盒[如:AWVS、APPScan等]
    2. 纯粹的白盒[如:grep等]
    一些其他的方法如coolq大牛基于php内核编译器[这个思路早些跟boy说过,不过马来人比我还懒,谁叫按不懂c呢]。

    在《web代码安全边缘性问题》里,提到了一些代码“非主流?”一些漏洞模式,里面提到的查找方法主要是基于grep“静态”分析代码。这里我给大家介绍下我的“动静结合”的一些其他的思路。

    一、 实现思路
    基于http代理把构造的变量提交个目标。“动静结合”首先通过grep的静态分析出“可能”有问题的变量[静],然后构造这些变量通过我们的fuzz工具,也就是代理服务器提交给目标,如果通过浏览器[ie、ff等]触发。

    二、 特殊变量
    1. Header变量
    Header变量的问题在《web代码安全边缘性问题》提到过,很容易被忽视,那么我们基于http代理我们很容易植入我们的变量如:
    $headers{"X-Forwarded-For"} = "Test31425926’";
    a.对于基于sql的程序很容易造成sql注射如:
    Sablog-X Ver 1.1 getip() Vulnerability
    http://superhei.blogbus.com/logs/2006/09/3436056.html

    b.对于文本数据库很容易造成phpcode注射如:
    Bmb
    D:\>Findstr /S /I /N /dbig_smile:\phproot\bmb2007\bmb\ "Test31425926" *.php
    D:\phproot\bmb2007\bmb\:
    datafile\guest.php:2:<?php //|娓稿|1163859032|Test31425926?ˉ|f|0|Firefox 1.5.0.8|Windo
    ws XP|t||
    容易出现问题的header变量:X-Forwarded-For、User-Agent、CLIENT-IP … 还有Referer对限制来路的突破

    2. 全局变量
    a. zend_hash_del_key_or_index_vulnerability:
    http://www.hardened-php.net/hphp/ze...nerability.html
    b. php5-globals-vulnerability:http://www.ush.it/2006/01/25/php5-g...-vulnerability/
    c. 变量/数组变量未初始化

    在fuzz脚本里我们可以通过cookie提交。

    3. Upfile漏洞fuzz
    常见模式:
    1. 直接上传[没有任何过滤]
    2. 被动过滤[过滤不完全:php3 php4 asa cer …]
    3. Content-Type
    4. Null截断
    5. Apache文件解析特性
    6. PHP RFC1867 Vul
    7. 后缀大小写规则
    4. 二次攻击的fuzz
    二次攻击的主要类型是变量通过UPDATA或者INSERT提交给数据库[包括文本数据库],然后在提取造成二次攻击,如果我们通过fuzz脚本自动提交构造的变量,再通过浏览器正常的访问来探测触发。



    好久没发贴了,乱写一通 smile 感谢jb还没完成的代码,luoluo的c代码。。。。
  • 2007-01-20

    php6

    Php Hacking 一直和php的版本有着莫大的关系 php6:http://snaps.php.net/win32/
  • WordPress wp-trackback.php漏洞分析
          文/Superhei 2007/1/9
    1.Stefan Esser大牛2007/01/05发布的WordPress Trackback Charset Decoding SQL Injection Vulnerability [1]

    Code:wp-trackback.php

    $tb_url    = $_POST['url'];
    $title     = $_POST['title'];
    $excerpt   = $_POST['excerpt'];
    $blog_name = $_POST['blog_name'];
    $charset   = $_POST['charset'];
    .......
    if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
     $title     = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
     $excerpt   = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset);
     $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset);
    }
    .......
    $dupe = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_author_url = '$comment_author_url'");

    变量$charset编码post--->mb_convert_encoding()转换为get_settings('blog_charset') [utf-8]---->select

    se大牛的exp[2] 是用的uf7编码:'==>+-ACc- 饶过gpc,然后通过mb_convert_encoding转化为utf-8 '<==+-ACc-

    其实这个就是编码引起的2次攻击[3]饶过gpc引起的SqlInj。

    官方发布的补丁:2.0.6 wp-trackback.php

    // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding()
    $title     = stripslashes($_POST['title']);
    $excerpt   = stripslashes($_POST['excerpt']);
    $blog_name = stripslashes($_POST['blog_name']);
    .........
    // Now that mb_convert_encoding() has been given a swing, we need to escape these three
    $title     = $wpdb->escape($title);
    $excerpt   = $wpdb->escape($excerpt);
    $blog_name = $wpdb->escape($blog_name);

    变量经过stripslashes()--->mb_convert_encoding()--->escape()--->select

    我们看看escape() :wp-includes\wp-db.php

     function escape($string) {
      return addslashes( $string ); // Disable rest for now, causing problems
      if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
       return mysql_escape_string( $string );
      else
       return mysql_real_escape_string( $string, $this->dbh );
     }

    mysql_real_escape_string()在一定的条件下是可以绕过的:
    The addslashes() Versus mysql_real_escape_string() Debate  http://shiflett.org/archive/184
    村雨牛牛在xcon也说过,但是mysql支持gbk的情况还是比较少的。有兴趣的可以自己测试下 :)

    2.rgod于2007/01/08发布的WordPress <= 2.0.6 wp-trackback.php Zend_Hash_Del_Key_Or_Index / sql injection exploit [4]

    Code:wp-settings.php

    function unregister_GLOBALS() {
     if ( !ini_get('register_globals') )
      return;

     if ( isset($_REQUEST['GLOBALS']) )
      die('GLOBALS overwrite attempt detected');

     // Variables that shouldn't be unset
     $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
     
     $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
     foreach ( $input as $k => $v )
      if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) )
       unset($GLOBALS[$k]);
    }

    unregister_GLOBALS();

    这里unset了$_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, $_SESSION 等提交的变量。

    Code:wp-trackback.php

    if ( !intval( $tb_id ) ) //注意这个
     trackback_response(1, 'I really need an ID for this to work.');

    .................

    if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) {
     header('Content-Type: text/xml; charset=' . get_option('blog_charset') );

     $pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id");
    ......

    $tb_id没有’ 通过unset后存在end_Hash_Del_Key_Or_Index漏洞,导致注射。在分析时候提交:tb_id='&1740009377=1&496546471=1
    返回:I really need an ID for this to work 原来是在 :
    if ( !intval( $tb_id ) ) //这里拦住了。
     trackback_response(1, 'I really need an ID for this to work.');
     
    提交tb_id=1'&1740009377=1&496546471=1 成功触发,这里引发了一比较有意思的问题 :
    //test.php
    print intval($_REQUEST["id"]);
    ?>
    提交test.php?id=a1 得到 0,提交test.php?id=12a 得到 12。
    可以看出 intval是根据第1个字符来判断的,这样如果是像wp这样的判断:if ( !intval( $_ ) ) 还是有安全隐患的。

    参考:
    [1]:http://www.hardened-php.net/advisory_022007.141.html
    [2]:http://www.milw0rm.com/exploits/3095
    [3]:http://superhei.blogbus.com/files/1157120596.ppt
    [4]:http://retrogod.altervista.org/wordpress_206_zhdkoi_sql.html

  • 2006-12-21

    哪里都一样

    http://www.websense.com/securitylabs/blog/blog.php?BlogID=94

    http://www.websense.com/securitylabs/alerts/alert.php?AlertID=472

  • http://securityreason.com/achievement_securityalert/43

Tag