Web渗透_手动漏洞挖掘

手动漏洞挖掘


  • 默认安装
    • 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
    • 登出后返回测试


Web渗透_手动漏洞挖掘


漏洞挖掘原则


  • 所有变量
  • 所有头
    • Cookie中的变量
  • 逐个变量删除


漏洞的本质


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


命令执行


  • 应用程序开发者直接调用操作系统的功能
  • ;&& | || &
  • 查看源码,过滤用户输入


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


Web渗透_手动漏洞挖掘


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


<?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 '
'.$cmd.'
'; } else { $cmd = shell_exec( 'ping -c 3 ' . $target ); echo '
'.$cmd.'
'; } } ?>


  • 如果你把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 '
'.$cmd.'
'; } else { $cmd = shell_exec( 'ping -c 3 ' . $target ); echo '
'.$cmd.'
'; } } ?>


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


Web渗透_手动漏洞挖掘


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


<?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 '
'.$cmd.'
'; } else { $cmd = shell_exec( 'ping -c 3 ' . $target ); echo '
'.$cmd.'
'; } } else { echo '
ERROR: You have entered an invalid IP
'; } } ?>


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

Web
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章