2019--21省赛

wp:https://xz.aliyun.com/t/6458

2019-11-22蚂蚁金服(南邮)wp有了,微信

https://platform.d3ctf.io/#/

@d3ctf-Showhub

@d3ctf-EasyWeb

hint:source code is in attachments

注册成功

@d3ctf- d3guestbook

聊天题该死的流行

report:

@d3ctf-babyxss

@d3ctf-fake onelinephp

<?php ($_=@$_GET['orange']) && @substr(file($_)[0],0,6) === '@<?php' ? include($_) : highlight_file(__FILE__);

@d3ctf-ezts

 @d3ctf-ezupload

打开就只有这个php代码

<?php
class dir{
    public $userdir;
    public $url;
    public $filename;
    public function __construct($url,$filename) {
        $this->userdir = "upload/" . md5($_SERVER["HTTP_X_REAL_IP"]);
        $this->url = $url;
        $this->filename  =  $filename;
        if (!file_exists($this->userdir)) {
            mkdir($, true);
        }
    }
    public function checkdir(){
        if ($this->userdir != "upload/" . md5($_SERVER["HTTP_X_REAL_IP"])) {
            die('hacker!!!');
        }
    }
    public function checkurl(){
        $r = parse_url($this->url);
        if (!isset($r['scheme']) || preg_match("/file|php/i",$r['scheme'])){
            die('hacker!!!');
        }
    }
    public function checkext(){
        if (stristr($this->filename,'..')){
            die('hacker!!!');
        }
        if (stristr($this->filename,'/')){
            die('hacker!!!');
        }
        $ext = substr($);
        if (preg_match("/ph/i", $ext)){
            die('hacker!!!');
        }
    }
    public function upload(){
        $this->checkdir();
        $this->checkurl();
        $this->checkext();
        $content = file_get_contents($,);
        if (preg_match("/\<\?|value|on|type|flag|auto|set|\\\\/i", $content)){
            die('hacker!!!');
        }
        file_put_contents($this->userdir."/".$this->filename,$content);
    }
    public function remove(){
        $this->checkdir();
        $this->checkext();
        if (file_exists($this->userdir."/".$this->filename)){
            unlink($this->userdir."/".$this->filename);
        }
    }
    public function count($dir) {
        if ($dir === ''){
            $num = count(scandir($;
        }
        else {
            $num = count(scandir($dir)) - ;
        }
        ) {
            return "you have $num files";
        }
        else{
            return "you don't have file";
        }
    }
    public function __toString() {
        return implode(" ",scandir(__DIR__."/".$this->userdir));
    }
    public function __destruct() {
        $string = "your file in : ".$this->userdir;
        file_put_contents($this->filename.".txt", $string);
        echo $string;
    }
}

if (!isset($_POST['action']) || !isset($_POST['url']) || !isset($_POST['filename'])){
    highlight_file(__FILE__);
    die();
}

$dir = new dir($_POST['url'],$_POST['filename']);
if($_POST['action'] === "upload") {
    $dir->upload();
}
elseif ($_POST['action'] === "remove") {
    $dir->remove();
}
elseif ($_POST['action'] === "count") {
    if (!isset($_POST['dir'])){
        echo $dir->count('');
    } else {
        echo $dir->count($_POST['dir']);
    }
}

 

 安洵杯 2019-11-30

比赛:http;s://axb.d0g3.cn

题解+复盘:https://github.com/D0g3-Lab/i-SOON_CTF_2019

@安洵杯-easy_serialize_php

hint:反序列化

点击sourcecode,得到php代码

<?php

$function = @$_GET['f'];

function filter($img){
    $filter_arr = array('php','flag','php5','php4','fl1g');
    $filter = '/'.implode('|',$filter_arr).'/i';
    return preg_replace($filter,'',$img);
}

if($_SESSION){
    unset($_SESSION);
}

$_SESSION["user"] = 'guest';
$_SESSION['function'] = $function;

extract($_POST);

if(!$function){
    echo '<a href="index.php?f=highlight_file">source_code</a>';
}

if(!$_GET['img_path']){
    $_SESSION['img'] = base64_encode('guest_img.png');
}else{
    $_SESSION['img'] = sha1(base64_encode($_GET['img_path']));
}

$serialize_info = filter(serialize($_SESSION));

if($function == 'highlight_file'){
    highlight_file('index.php');
}else if($function == 'phpinfo'){
    eval('phpinfo();'); //maybe you can find something in here!
}else if($function == 'show_image'){
    $userinfo = unserialize($serialize_info);
    echo file_get_contents(base64_decode($userinfo['img']));
}

尝试url访问guest_img.png

一个base64,解码出来一句hi,here you want to find me?

没啥用

再尝试urlhttp://47.108.135.45:20355/?img_path=‘guest_img.png'还是不行

 @安洵杯-easy_web

源代码,左上表情包图片是一段base64

这一大串屁用没有,每张图都这样的,图片编码成base64而已,接出来前面一个PNG说明是png文件,别一看见==就激动解码,要解的是url里的那串

 

最后提示md5

思路应该是:首先扫一下目录,扫出一个img,555.png  

http://47.108.135.45:20355/index.php?img=TXpVek5UTTFNbVUzTURabE5qYz0&cmd= z这一段加上=或者俩=,两次base64,然后ascii,解码出一个555.png,然后不知怎么能得到原码,然后开始代码审计

 @安洵杯-iamthinking

根据hint的/public/访问

 @安洵杯-cssgame

@安洵杯-Membershop

简单注入一波

该页面js代码

<script>
$(document).keyup(function (e) {
    ) {
        var userName = $("#member").val();
        window.location.href='/login?userName='+userName;
    }
});
</script>

该页面另一段超长js

 @安洵杯-这不是文件上传

 @安洵杯-ez_ez

https://github.com/D0g3-Lab/i-SOON_CTF_2019

web赛题3的更多相关文章

  1. web赛题2

    @上海赛wp 微信 和 https://www.ctfwp.com/articals/2019unctf.html 后续公告https://unctf.buuoj.cn/notice.html 必看! ...

  2. web赛题

    @php反序列化漏洞https://www.freebuf.com/news/172507.html @巅峰极客wp https://www.anquanke.com/post/id/189142 @ ...

  3. 【天池大数据赛题解析】资金流入流出预测(附Top4答辩ppt)

    http://mp.weixin.qq.com/s?__biz=MzA3MDg0MjgxNQ==&mid=208451006&idx=1&sn=532e41cf020a0673 ...

  4. Hitcon 2016 Pwn赛题学习

    PS:这是我很久以前写的,大概是去年刚结束Hitcon2016时写的.写完之后就丢在硬盘里没管了,最近翻出来才想起来写过这个,索性发出来 0x0 前言 Hitcon个人感觉是高质量的比赛,相比国内的C ...

  5. CSDN 轻松周赛赛题:能否被8整除

    轻松周赛赛题:能否被8整除 题目详情 给定一个非负整数,问能否重排它的全部数字,使得重排后的数能被8整除. 输入格式: 多组数据,每组数据是一个非负整数.非负整数的位数不超过10000位. 输出格式 ...

  6. O准备如何苟进复赛圈?华为软挑开挂指南(附赛题预测)

    事先声明,这不是华为软挑的软广,我也不是海军. 这篇文章纯粹是心血来潮,原因是去年上传到github的参赛代码,前几天又有两个人star和fork了. 记得star热潮还是去年4月复赛刚结束的那几天, ...

  7. kaggle赛题Digit Recognizer:利用TensorFlow搭建神经网络(附上K邻近算法模型预测)

    一.前言 kaggle上有传统的手写数字识别mnist的赛题,通过分类算法,将图片数据进行识别.mnist数据集里面,包含了42000张手写数字0到9的图片,每张图片为28*28=784的像素,所以整 ...

  8. 天池新闻推荐比赛1:赛题理解+baseline

    天池新闻推荐比赛1:赛题理解+baseline 一.比赛信息 比赛链接: ​ https://tianchi.aliyun.com/competition/entrance/531842/inform ...

  9. 攻防世界Web刷题记录(进阶区)

    攻防世界Web刷题记录(进阶区) 1.baby_web 发现去掉URLhttp://111.200.241.244:51461/1.php后面的1.php,还是会跳转到http://111.200.2 ...

随机推荐

  1. JavaScript的7大基本类型

  2. MySQL 下载与安装使用教程

    MySQL 官网地址:https://www.mysql.com/ 等待下载完成 双击运行 如果有需要 我们可以新增一个用户出来 点击 Add User,不需要的话 直接 点击 next 默认的MyS ...

  3. [Python自学] day-17 (jQuery)

    一.jQuery简介 参考文档链接:http://jquery.cuishifeng.cn/ jQuery是JS的一个类库,是对DOM.BOM等的封装,方便我们来查找和操作元素. jQuery分为1. ...

  4. Luogu P1450 [HAOI2008]硬币购物 背包+容斥原理

    考虑如果没有个数的限制,那么就是一个完全背包,所以先跑一个完全背包,求出没有个数限制的方案数即可. 因为有个数的限制,所以容斥一下:没有1个超过限制的方案=至少0个超过限制-至少1个超过限制+至少2个 ...

  5. [Luogu] 等差数列

    https://www.luogu.org/problemnew/show/P4243#sub 自己的思路错了 #include <iostream> #include <cstdi ...

  6. Windows操作系统中的I/O(读/写 输入/输出)

    导言 写一个Windows平台下的应用程序大多时候都是离不开读写文件,网络通信的. 比如一个服务应用程序来说,它可能从网络适配器接受用户的请求,对请求进行处理计算,最终将用户端所需的数据返回,中间可能 ...

  7. OUC_Summer Training_ DIV2_#2之解题策略 715

    这是第一天的CF,是的,我拖到了现在.恩忽视掉这个细节,其实这一篇只有一道题,因为这次一共做了3道题,只对了一道就是这一道,还有一道理解了的就是第一篇博客丑数那道,还有一道因为英语实在太拙计理解错了题 ...

  8. 深入解析 composer 的自动加载原理

    PHP 自5.3的版本之后,已经重焕新生,命名空间.性状(trait).闭包.接口.PSR 规范.以及 composer 的出现已经让 PHP 变成了一门现代化的脚本语言.PHP 的生态系统也一直在演 ...

  9. P1439 【模板】最长公共子序列 LCS

    P1439 [模板]最长公共子序列 题解 1.RE的暴力DP O(n2) 我们设dp[i][j]表示,S串的第i个前缀和T串的第j个前缀的最长公共子序列. ◦          分情况: ◦      ...

  10. SRCNN代码分析

    代码是作者页面上下载的matlab版.香港中文大学汤晓鸥教授.Learning a Deep Convolutional Network for Image Super-Resolution. htt ...