7

0CTF/TCTF 2020 wp

 2 years ago
source link: https://blog.szfszf.top/article/46/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

0CTF/TCTF 2020 wp

2020年07月, 2872 views, #php #CTF #writeups #XSS

0CTF/TCTF 2020 wp

比赛难度很高,虽然没做出几道,但是也苟进了线下,希望今年决赛不是线上的。

easyphp && noeasyphp

easyphp这道题在做题的间隙发现题目不稳定可以绕过open_basedir(题目是被人用php-fpm打炸了)

读取flag.so

flag.so中有flag

出题人不甘心就又出了一道noeasyphp。

仍然可以利用glob协议列根目录,但是读不了根目录的文件。

看了师傅们的wp,这道题的预期解是ffi加载flag.h,然后执行出题人定义的C函数,就能拿到flag,出题人定义的函数名在flag.h中,利用内存泄漏读出。师傅们tql

Wechat Generator

功能是可以在线根据内容生成图片,

生成的图片访问image/xxxxx/png得到png图片,访问image/xxxx/svg得到svg图片。

把svg图片下载下来,可以看到拼接了我们输入的内容

那么可以猜测是先生成svg再转换成png、jpg等其他格式,因为从png转换成的svg不会有这些细节。

随便输入previewid

得到的图片转换成png时报错

根据报错可以判定其为使用imagemagick进行的图片转换。

然后在再插入表情处发现了给svg图片注入xml标签的地方。插入script标签,当然因为csp无法执行。

根据上面的imagemagick的提示,尝试imagemagick漏洞,发现存在任意文件读取漏洞

利用方法:

<image width="800" height="800" href="text:/etc/passwd" />

fuzz一下读到源码 /app/app.py

根据源码,可以找到一个提交xss的地方,/SUp3r_S3cret_URL/0Nly_4dM1n_Kn0ws

此时我们看csp,js只允许运行引入的同源js

img-src * data:; default-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none'; base-uri 'self'

在源码中我们可以看到一个responceJSON函数,接受了一个callback参数,我们发现所有json响应包都可以有这个参数。

再回到我们一开始的因为previewid乱输导致的报错画面,发现可以注入双引号改变其内容:

previewid:

"};alert(1);{a:"

直接引入还是不行,因为error被双引号包裹了,不过可以利用原来的callback

此时引入这个内容就可以弹窗了,将其插入svg图片中

提交拿到flag

lottery

这题没做出来,最后一晚没熬住。

一位师傅提示我可能可以伪造enc,的确是可以看出来一些猫腻,根据规律尝试伪造了一下,发现直接拿两个enc的base64解码的128个字节的数据前后64字节数据调换一下可以伪造大部分,但是user_id的开头会有两位错位。

这道题在这个部分应该继续做下去,可以尝试注册多个有相同前两位的用户就可以伪造了。

Cloud Computing

云计算这道题,首先绕过waf的限制,绕过waf的方法不难,用数组就可以绕过

然后就是绕open_basedir, 看代码已知我们每个人都被限制在 sandbox/xxxx/中,所以构造payload绕过

读取/flag是一个img文件,里面藏那个了一张图片


Recommend

  • 8
    • www.wooyun.org 6 years ago
    • Cache

    0ctf writeup | WooYun知识库

    0ctf writeup felixk3y ·...

  • 8
    • phuker.github.io 3 years ago
    • Cache

    TCTF 2017 Final 部分 Web 题 Writeup

    近期洒家参加了 TCTF 决赛 RisingStar CTF,其中有几道 Web 题还是很有意思的,在此做一下详细的记录。 关于比赛¶ 说起来这还是洒家第...

  • 8
    • miaotony.xyz 2 years ago
    • Cache

    CTF | 2021 TCTF/0CTF Quals WriteUp

    2021 TCTF/0CTF Quals WriteUp 这是一篇放在草稿箱里已经长草的文章,清理的时候才想起来这篇由于没环境复现,后面一懒就忘记发了…… 噢,喵喵也不记得有没有写完了,就将就发一下吧(摊手

  • 4
    • ultramangaia.github.io 2 years ago
    • Cache

    0CTF 2018 Writeup

    Login meHi, I've been learning NodeJS for a day!!! I'm trying to make a simple login page with this awesome language, can you please check it out. var express = require('express') var app = express()...

  • 4
    • xuanxuanblingbling.github.io 2 years ago
    • Cache

    0CTF / TCTF 2021 tile

    0CTF / TCTF 2021 tile 发表于...

  • 3
    • xuanxuanblingbling.github.io 2 years ago
    • Cache

    0CTF / TCTF 2021 final - Secure JIT II

    0CTF / TCTF 2021 final - Secure JIT II 发表于...

  • 3
    • mem2019.github.io 2 years ago
    • Cache

    TCTF 2021 Promise

    TCTF 2021 Promise Sep 27, 2021 Last weekend we have participated TCTF 2021 Final and got 2nd place! Congratulation! I solved 3 cha...

  • 5
    • mem2019.github.io 2 years ago
    • Cache

    TCTF 2021 Secure Storage

    0x00 Overview Last weekend I played TCTF Qualifier online and spent all of my time on this challenge, but still failed to solve it in time. After the contest, I finally solved this challenge. This is a crazy nested challenge: we fir...

  • 5
    • ultramangaia.github.io 2 years ago
    • Cache

    0CTF 线下 Misc ZeroLottery Writeup

    Hello guys, welcome to the wonderful ethereum casino. We proudly present our first lottery game, ZeroLottery. Give me your lucky number, chances to get huge amount of money back! Every one can read the code, fair and honest. There is...

  • 4
    • guokeya.github.io 2 years ago
    • Cache

    0ctf/tctf 2022

    hessian-onlyjdk https://y4er.com/posts/wangdingbei-badbean-hessian2/ 开头就是网鼎杯的cve。 重写Hessian2Output

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK