miniL被虐了QAQ太菜惹555 有精通php反序列化,sql注入的旁友可以暗搓搓交換下思路 不管怎樣還是思考了很多東西的,雖然沒有完全做出來吧,結合wp(鬼知道有木有呢)也得總結下
不過XX比賽對本階段的蒟蒻來說都無所謂 之後的學習就是刷關啦
包括攻防世界…之類的,sqli-lab,upload,xss之類的 總結一下dvwa之類的 菜不菜無所謂了,就是不要放棄~~!!!
PHP2
(攻防世界)
Can you anthenticate to this website?
其他什麼都沒有
index.phps源碼泄露(記在小本本上,Phps是php的源碼) 好腦洞
<?php
if("admin"===$_GET[id]) {
echo("<p>not allowed!</p>");
exit();
}
$_GET[id] = urldecode($_GET[id]);
if($_GET[id] == "admin")
{
echo "<p>Access granted!</p>";
echo "<p>Key: xxxxxxx </p>";
}
?>
Can you anthenticate to this website?
分析一下:傳入的id不能爲admin
同時傳入的id經過url解碼後==admin
實際上這個過程經過了2次url的解碼(瀏覽器一次,decode一次)
利用瀏覽器編碼和URLdecode結合利用的二次編碼注入繞過,payload構造爲%2561dmin,瀏覽器會先把非ASCII碼字符%25進行編碼變成%,然後urldecode將%61編碼爲a,最後形成了admin繞過
Web_php_unserialize
前面那道反序列化還挺簡單的→_→這兩天miniL被這個類型的這個吊錘了
<?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';
}
}
}
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");
}
?>
wakeup繞過 改變屬性的數量 就是只需要令序列化字符串中標識變量數量的值大於實際變量即可繞過
正則表達式繞過:使用+可以繞過preg_match() 正則匹配這裏匹配的是 O:4,我們用 O:+4 即可繞過。(這個方式適用於PHP < 5.6.25 和 PHP< 7.0.10。)
咕咕中,博主正在補作業
記錄一些知識點
private,protected修飾
魔術方法
__construct():當一個類被創建時自動調用
__destruct():當一個類被銷燬時自動調用
__invoke():當把一個類當作函數使用時自動調用
__tostring():當把一個類當作字符串使用時自動調用
__wakeup():當調用unserialize()函數時自動調用
__sleep():當調用serialize()函數時自動調用
__call():當要調用的方法不存在或權限不足時自動調用
__wakeup() 比__destruct() 提前執行