[CISCN2019 华北赛区 Day1 Web5]CyberPunk


查看源代码,可能有文件包含漏洞,直接读取是不行的,要用filter伪协议:?file=php://filter/convert.base64-encode/resource=index.php同样还可以拿到change.php,delete.php,confirm.php的源码。
代码审计,可以发现对SQL注入的参数进行了很严的过滤,但既然是题目肯定会给你造漏洞,就找那些过滤方法不一样的参数就行了。user_name和phone都用黑名单过滤了,就address只经过了addslashes的转义,所以问题肯定出在address上,可以算是人为造出来的漏洞了。
以下是change.php和config.php的代码,也是我们利用的地方。
<?php
#change.php
require_once "config.php";
if(!empty($_POST["user_name"]) && !empty($_POST["address"]) && !empty($_POST["phone"]))
{
$msg = '';
$pattern = '/select|insert|update|delete|and|or|join|like|regexp|where|union|into|load_file|outfile/i';
$user_name = $_POST["user_name"];
$address = addslashes($_POST["address"]);
$phone = $_POST["phone"];
if (preg_match($pattern,$user_na

最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



