任务086:手动漏洞挖掘(二)
这个是我的看的教程的笔记。
里面是我自己实验的照片。
-
挖掘漏洞原则
挖掘漏洞原则是非常非常重要的
1.1.所有的变量
所有的变量都要去尝试,用各种各样的注入攻击手段尝试每一个变量每一个可以提交的数据的位置都要去尝试提交注入
1.2.所有的头
还要关住HTTP的头也是可以注入信息也可以完成相应的注入应为头也可以判断一个条件
重定要关注cookie(苦k)
1.3.逐个变量删除
应为在当前页面提交是不关注这些变量的按照逐个删除的方法来测试
叫没有用的变量删除这样我就不用这么麻烦在给没有用的变量测试了
下面是逐个删除没有用的变量
1.3.1下面这个是没有删除如何变量的可以正常访问网页的
蓝色是变量红色是变量值
下面是叫没有用的变量删除掉,如果删除有用的变量就会响应的结果就有变化
-
利用没有过滤字符在页面直接运行系统命令漏洞
级别低,实验靶机metasploitable-linux-2.0.0
这个页面是进行ping地址的
2.1.分析这个页面这个ping命令是从是从靶机发出来的,ping完然后返回给客户端
这个就发现这个ping和操作系统的ping一样会不会是会不会是服务器自己的主机ping的包返回过来的
比如程序员做出这个程序来他偷懒他直接调用系统命令来ping,应为ping自己做出来比较麻烦,程序员可能会调用系统命令直接返回给页面,
发现和系统ping包一样下面是对比
2.2.他他尽然是是直接运行操作系统的命令那么看看能不能运行其他命令
在系统里加个;就可以运行其他系统命令了;这个符合是在添加一个运行命令
看看这个目标页面也是可以的这样就拿到了在页面直接运行系统命令
2.3.注意了在BurpSuite工具里可以看见
在里请求是返回出现错误的是
可以分析我输入;这个符合在URL里是怎么显示的,发现是%3B这个就有可能编码了,发现是URL编码
-
实验靶机metasploitable-linux-2.0.0的ping后台源代码
安全级别低<?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>'; } } ?>
安全级别中
<?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>'; } }
?>