DASCTF安恒七月赛

Ezinclude

源码处发现可疑链接,有两个参数tf,t经过大佬告诉是unix时间戳

f参数是文件名的base64,直接打开链接会得目标文件的内容,但t会过期只有五秒时间,写个脚本好测试

import requests
import re

url = 'http://183.129.189.60:10009/'

response = requests.get(url=url).text

text = re.findall(r'\b\d+\b',response)

value = "".join(text[1])

url_add = url+"image.php?t="+value+"&f=what_you_want"

response2 = requests.get(url=url_add).text

print(response2)

试了n久。。。没成功,后来大佬告诉是file:///../../../../../flag才成功,赛后看y1ng师傅的wp得知只要/../前面有内容/../就不会被过滤。。(吐血),直接whatever/../../../../../flagbase64传入

看下waf是怎么写的

<?php

        if(!isset($_GET['t']) || !isset($_GET['f'])){
                echo "you miss some parameters";
                exit();
        }

        $timestamp = time();

        if(abs($_GET['t'] - $timestamp) > 10){
                echo "what's your time?";
                exit();
        }

        $file = base64_decode($_GET['f']);

        if(substr($file, 0, strlen("/../")) === "/../" || substr($file, 0, strlen("../")) === "../" || substr($file, 0, strlen("./")) === "./" 
|| substr($file, 0, strlen("/.")) === "/." || substr($file, 0, strlen("//")) === "//") {
                echo 'You are not allowed to do that.';
        }
        else{
                echo file_get_contents('/var/www/html/img/'.$file);
        }

?>

substr截取的是从左边开始strlen()的长度,只要截取的这几位不是/../就不会触发waf。

SQli

找回显位常规操作,union查询直接可以得到数据库

关键是这个正则

过滤了in,or也就是information_schema不能用了,又过滤了stat和auto,这样information_schema相似作用的sys.schema_auto_increment_columns以及schema_table_statistics_with_buffer什么的都用不了的(参考:https://www.cnblogs.com/wangtanzhi/p/12594949.html

google找了蛮久没找到,后来看wp才想起来还有个sys.x$schema_flattened_keys,关键是我之前自己也记过。。。我也是醉了。。。继续union查询

最后因为得不到列名直接select * from flag(注意显示位的顺序和个数)

ps:后来瞄到一眼群里大佬说schema_tables_with_full_table_scans也可以,神奇的sys数据库

welcome to the misc world

下载附件

lsb隐写,linux安装zteg

gem install zsteg

分析red_bule.png,发现png

提取得到png,查看为压缩包密码

360压缩打开直接忽略NTFS隐写

输入密码查看flag.txt

base85解码

发表评论