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

  • 登出后返回测试

图片

漏洞挖掘原则

  • 所有变量

  • 所有头

  • Cookie中的变量

  • 逐个变量删除

漏洞的本质
  • 数据与指令混淆

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

命令执行

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

  • ;&& | || &

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

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

图片

  • 这时我们看源代码可以看到没有任何过滤措施
<?phpif( 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修改成中级别,发现命令不可用,因为已经对某些特殊符号进行了修改
<?phpif( 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>';            }}?>
  • 但是我们看到它只是对;以及&&进行过滤,其他的不行

图片

  • 如果改成高级别就很完善了
<?phpif( 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格式的

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值