這道題一進去就是源**,基本上考的就是**審計。<?php
// code by sec@ustc
echo'';
$url
=$_server
['request_uri'];
//echo 'url: '.$url.'
';$flag
="ctf"
;$code
=str_replace
($flag
,'ctf'
,file_get_contents
('./index.php'))
;$stop=0
;//這道題目本身也有教學的目的
//第一,我們可以構造 /indirection/a/../ /indirection/./ 等等這一類的
//所以,第乙個要求就是不得出現 ./if(
$flag
&&strpos
($url
,'./'
)!==
false
)//第二,我們可以構造 \ 來代替被過濾的 /
//所以,第二個要求就是不得出現 ../if(
$flag
&&strpos
($url
,'\\'
)!==
false
)//第三,有的系統大小寫通用,例如 indirection/
//你也可以用?和#等等的字元繞過,這需要統一解決
//所以,第三個要求對可以用的字元做了限制,a-z / 和 .
$matches
=array()
;preg_match
('/^([0-9a-z\/.]+)$/'
,$url
,$matches);
if($flag
&&empty
($matches)||
$matches[1
]!=$url
)//第四,多個 / 也是可以的
//所以,第四個要求是不得出現 //if(
$flag
&&strpos
($url
,'//'
)!==
false
)//第五,顯然加上index.php或者減去index.php都是可以的
//所以我們下乙個要求就是必須包含/index.php,並且以此結尾if(
$flag
&&substr
($url,-
10)!=='/index.php'
)//第六,我們知道在index.php後面加.也是可以的
//所以我們禁止p後面出現.這個符號if(
$flag
&&strpos
($url
,'p.'
)!==
false
)//第七,現在是最關鍵的時刻
//你的$url必須與/indirection/index.php有所不同if(
$flag
&&$url
=='/indirection/index.php')if
(!$stop
)$stop=8
;echo
'flag: '
.$flag
;echo'';
for($i=
1;$i<
$stop;$i
++)$code
=str_replace
('//pass '.$i
,'//pass'
,$code);
for(;$i
<8;
$i++
)$code
=str_replace
('//pass '.$i
,'//not pass'
,$code);
echo
highlight_string
($code
,true);
echo''
;
要拿到flag需要滿足七個條件
1.不能使用"./"因此我們只有改變url來訪問index.php就能拿到flag。2.不能使用"…/"
3.只能使用小寫字母
4.不能使用"//"
5.必須包含/index.php,並且以此結尾
6.禁止p後面出現.
7.url必須與/indirection/index.php有所不同
這題的關鍵在於偽靜態,比如url中含有***x.php/xx/x,那麼.php後的xx就會被當成引數名,x會被當成引數。
因此我們payload可以構造:
但我發現這樣構造也可以拿到flag
實驗吧整理 拐彎抹角小結
關於繞過構造 wp code by sec ustc echo url server request uri echo url url.flag ctf code str replace flag,ctf file get contents index.php stop 0 這道題目本身也有教學的目...
拐彎抹角WP
題目比較簡單,就是讓我們構造url,而且要求都給我們了 需要滿足不能出現.大寫或者其他符號 p.末尾是 index.php,這6個步驟對於 indirection index.php都可以滿足,但是最後一條又告知不能等於 indirection index.php 我們發現其實index.php後面...
實驗吧 web 輸入密碼
首先開啟是乙個空白頁面,開啟控制台檢視 發現空白標籤 src 1.txt a 開啟1.txt if isset get a 看到strcmp首先應該想到的就是php的弱型別漏洞了,當有乙個對比引數是整數的時候,會把另外乙個引數強制轉換為整數。1assd 的轉換後的值是1,而 asdaf 是0 arr...