本人完全没入门web狗,写博客权当笔记,只适合完全没入门的小白看
第一道是web,题目是HCTF2018的第一题
先看hint.php,一般存放暗示
出现:flag not here, and flag in ffffllllaaaagggg
再看source.php,这是源码
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
$whitelist = ["source"=>"source.php","hint"=>"hint.php"];
if (! isset($page) || !is_string($page)) {
echo "you can't see it";
return false;
}
if (in_array($page, $whitelist)) {
return true;
}
$_page = mb_substr(
$page,
0,
mb_strpos($page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
$_page = urldecode($page);
$_page = mb_substr(
$_page,
0,
mb_strpos($_page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
echo "you can't see it";
return false;
}
}
if (! empty($_REQUEST['file'])
&& is_string($_REQUEST['file'])
&& emmm::checkFile($_REQUEST['file'])
) {
include $_REQUEST['file'];
exit;
} else {
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
}
?>
最后当以下三个条件同时为真时,file才能进入
1.$_request[‘file’]不为空
2.$_request[‘file’]是字符串
3.上面定义的checkfile方法返回值为真
emm::checkfile即前面中的class file中又进行了检验
! isset($page) || !is_string($page)
是否定义page变量是否为空,是否为字符串
in_array(**$**page, $whitelist
page必须为whitelist中一个,即hint,source
$_page = mb_substr($page,0,mb_strpos($page . '?', '?')
截取page变量直到?
in_array($_page, $whitelist)
_page必须为whitelist中一个,即hint,source
$_page = urldecode($page)
对page进行URL解码,之后检验类似
于是构造file参数:*hint.php?/../../../../../ffffllllaaaagggg*
…/…/…/…/是多次返回上级目录
即/index.php?file=hint.php?/…/…/…/…/…/ffffllllaaaagggg index为普遍意义的首页
得到 flag{60e3feee-706b-45cd-85af-2f61c4baf9a3}
第二道是密码学 网络安全攻防学习平台 - 基础关 第二题
题目:
再加密一次你就得到key啦~
加密之后的数据为xrlvf23xfqwsxsqf
再加密一次得到源码的加密ROT13
直接搜索解密的工具http://www.mxcz.net/tools/rot13.aspx
解密得keyis23ksdjfkfds
后面是xctf攻防平台的web基础题
第一题直接看源码
第二题利用火狐插件进行post操作
第三题为robots协议,百度一下,输入robots.txt
第四题index.php的备份文件百度后得知,直接加.bak
第五题看源码,disabled为html中禁用标签,对源码进行编辑删掉,刷新,按钮即可按下
(未完待续)