中国电子商会信息工程测试专业委员会主办
今天是 2024年 04月 08日 星期一
中国电子商会信息工程测试专业委员会
Integrity archives
诚信档案
技术前沿 您的位置:主页 > 诚信档案 > 技术前沿 >
Web渗透_手动漏洞挖掘
2023-06-02 返回列表

手动漏洞挖掘

 

  • 默认安装

    • Windows默认安装漏洞

    • phpMyAdmin/setup

    • Ubuntu / Debian默认安装PHP5-cgi

    • 可直接访问 /cgi-bin/php5 和 /cgi-bin/php (爬不出来的目录)

 

身份认证

 

  • 常用弱口令 / 基于字典的密码爆破

  • 锁定账号

  • 信息收集

    • 手机号

    • 密码错误提示信息

  • 密码嗅探

 

会话session ID

 

  • Xss / cookie importer

  • SessionID in URL

  • 嗅探

  • SessionID 长期不变 / 永久不变

  • SessionID生成算法

    • Sequencer

    • 私有算法

    • 预判下一次登录时生成的SessionID

    • 登出后返回测试

 

图片

 

漏洞挖掘原则

 

  • 所有变量

  • 所有头

    • Cookie中的变量

  • 逐个变量删除

 

漏洞的本质

 

  • 数据与指令混淆

  • 对用户输入信息过滤不严判断失误,误将指令当数据

 

命令执行

 

  • 应用程序开发者直接调用操作系统功能

  • ;&& | || &

  • 查看源码,过滤用户输入

 

对用户输入没有进行筛选区分:

 

图片

 

  • 这时我们看源代码可以看到没有任何过滤措施

 

<?php

if( isset( $_POST[ 'submit' ] ) ) {

    $target = $_REQUEST[ 'ip' ];

    // Determine OS and execute the ping command.
    if (stristr(php_uname('s'), 'Windows NT')) { 
    
        $cmd = shell_exec( 'ping  ' . $target );
        echo '
<pre>'.$cmd.'</pre>';
        
    } else { 
    
        $cmd = shell_exec( 'ping  -c 3 ' . $target );
        echo '
<pre>'.$cmd.'</pre>';
        
    }
    
}
?>

 

  • 如果你把dvwa修改成中级别,发现命令不可用,因为已经对某些特殊符号进行了修改

 

<?php

if( isset( $_POST[ 'submit'] ) ) {

    $target = $_REQUEST[ 'ip' ];

    // Remove any of the charactars in the array (blacklist).
    $substitutions = array(
        '&&' => '',
        ';' => '',
    );

    $target = str_replace( array_keys( $substitutions ), $substitutions, $target );
    
    // Determine OS and execute the ping command.
    if (stristr(php_uname('s'), 'Windows NT')) { 
    
        $cmd = shell_exec( 'ping  ' . $target );
        echo '
<pre>'.$cmd.'</pre>';
        
    } else { 
    
        $cmd = shell_exec( 'ping  -c 3 ' . $target );
        echo '
<pre>'.$cmd.'</pre>';
        
    }
}

?>

 

  • 但是我们看到它只是对;以及&&进行过滤,其他的不行

 

图片

 

  • 如果改成高级别就很完善了

 

<?php

if( isset( $_POST[ 'submit' ] ) ) {

    $target = $_REQUEST["ip"];
    
    $target = stripslashes( $target );
    
    
    // Split the IP into 4 octects
    $octet = explode(".", $target);
    
    // Check IF each octet is an integer
    if ((is_numeric($octet[0])) && (is_numeric($octet[1])) && (is_numeric($octet[2])) && (is_numeric($octet[3])) && (sizeof($octet) == 4)  ) {
    
    // If all 4 octets are int's put the IP back together.
    $target = $octet[0].'.'.$octet[1].'.'.$octet[2].'.'.$octet[3];
    
    
        // Determine OS and execute the ping command.
        if (stristr(php_uname('s'), 'Windows NT')) { 
    
            $cmd = shell_exec( 'ping  ' . $target );
            echo '
<pre>'.$cmd.'</pre>';
        
        } else { 
    
            $cmd = shell_exec( 'ping  -c 3 ' . $target );
            echo '
<pre>'.$cmd.'</pre>';
        
        }
    
    }
    
    else {
        echo '
<pre>ERROR: You have entered an invalid IP</pre>';
    }
    
    
}

?>

 

上述代码既保证你输入的肯定是数字,也保证你肯定是xxx.xxx.xxx.xxx格式的

 

 

 

二维码
中国电子商会信息工程测试专业委员会 电话:010-87660482 传真:010-87660482 邮箱:ceietn@sina.com 地址:北京经济技术开发区博兴六路17号院1号楼3层(100176)
Copyright © 2021-2027 中国电子信息工程与测试网 版权所有 主办单位:中国电子商会信息工程测试专业委员会 技术支持:电设信科(北京)技术有限公司 备案号:京ICP备11002915号-001