Skip to main content

Write UP kksi RE "kakaesi" ヽ(゚Д゚)ノ (day 45)



Ok lanjut lagi nih dapat soal KKSI dari senior buat dicobain kali ini menarik karena dikasih binari windows 64 bit


Mari kita kerjakan sama-sama. Pertama-tama jalankan binarinya di windows agar kita tahu cara kerja dari programnya.


oke cukup simpel cara kerjanya kita diminta untuk memasukan string dan program akan tertutup jika itu salah. Kita coba analisa string dari binarinya dulu mungkin ada petunjuk tentang flagnya.


saat diliat stringnya tidak ada petunjuk tentang flag tetapi bisa dilihat program ini mencoba memanggil library python27.dll dan banyak string yang mengindikasikan nama dari sebuah program python seperti .pyd, .pyz .

oke jadi saya pikir ini merupakan program python yang sudah di compile menjadi .exe dengan memakai tools pyinstaller (link:https://pypi.org/project/PyInstaller/)

agar kita bisa mendapatkan source code asli dari .exe ini kita perlu pakai dua tools ini yaitu https://sourceforge.net/projects/pyinstallerextractor/ agar bisa menngubah .exe -> .pyc dan https://sourceforge.net/projects/easypythondecompiler/ untuk mengubah .pyc -> .py


jalankan program pyinstxtractor seperti diatas untuk melakukan proses ekstraksi dari program .exe dan hasilnya akan ada satu direktori yang mempunyai prefix "_extracted" diujung nya

masuk kedalam direktori tersebut dan bisa dilihat ada beberapa program dan library python didalamnya.


source code .pyc yang sebenarnya ada di file bernama "kakaesi" tetapi masalahnya saat kita buka masih dalam bentuk binari agar bisa mengembalikan ke source code awal pertama-tama kita harus membetulkan header file dengan menambahkan "magic number" di awal file seperti dibawah.


ambil saja 7 bytes pertama dari program librarynya (dalam contoh ini saya pakai library __future__.pyc boleh pilih python mana saja asalkan ujungnya .pyc) dari binarinya yaitu (03 3F 0D 0A 00 00 00 00) lalu tambahkan di awal file "kakaesi" dan jangan lupa terakhir ubah ektensi file menjadi .pyc



setelah membetulkan file nya tinggal dimasukan ke tools easy python decompiler dan nanti akan mengeluarkan file bernama "kakaesi.pyc_dis"


selesai dan kita tinggal buka source code nya dengan text editor favorit kalian seperti dibawah ini.



Kalau dilihat sekilas menurut saya cukup jelas kalau programnya meminta tiga data untuk autentikasi yaitu username, password dan kode dan juga semuanya bisa kita dapatkan di source code 


yes kita dapat flagnya !

enjoy :)




Comments

Popular posts from this blog

Having fun analyzing nginx log to find malicious attacker in the net (ง'̀-'́)ง (day 37)

  What makes you sleepless at night? is it because of a ghost or scary stories? is it because you have an important meeting tomorrow? or is it because you have an exam? For me, what keeps me up all night is that I keep thinking about what happens to a website that I just created, is it safe from an attacker (certainly not) or did I missing some security adjustments that lead to vulnerability? well I'm not the best secure programmer in the world, I'm still learning and there is a big possibility that I can make a mistake but for me, a mistake can be a valuable investment to myself or yourself to be better so from this idea, I want to know more about what attackers casually do when attacking a website. Here in this post, I'm going to show you how I analyzed attack to the website that I have permission to design and also some interesting findings that I could get from the analysis Background: All of this analysis comes from the traffic that is targeted to th...

Utilize Pwntools for crafting ROP chain :') (day 69)

who doesn't like pwntools? it is a very versatile tool and can be customized according to our need using the python script but did you need to know that pwntools itself can help us to automatically craft a rop chain for us? so in this post, I will show you how to make rop chain less painful and make pwntools do all the heavy lifting. To demonstrate this I will use the binary challenge callme 64 bit from ropemporium link: https://ropemporium.com/challenge/callme.html Crashing the app: Like any other exploitation process, we need to crash the program by generating a long string pattern to determine the offset. based on the information from the above figure we can see that we required to provide 40 bytes of offset Fun stuff: now this where the fun stuff began write the following python script: as in the guideline of the challenged said we need to chain the function call by first to call the callme_one function, callme_two function and then callme_three funct...

Make writing shellcode in linux 32 bit little bit simple (ง'̀-'́)ง (day 53)

Disclaimer: This post is only for education only and not for causing destruction to a lived system. Be smart! In every exploit development process, the shellcode is one of the vital components to making your exploit reliable. Shellcode itself is just basically an assembly instruction that converted into opcodes (the hexadecimal thingy) "\x6a\x66\x58\x99\x6a\x01\x5b\x52\x53\x6a\x02\x89" "\xe1\xcd\x80\x89\xc6\x5f\xb0\x66\xb3\x04\x52\x56" "\x89\xe1\xcd\x80\xb0\x66\x43\x89\x54\x24\x08\xcd" "\x80\x93\x59\xb0\x3f\xcd\x80\x49\x79\xf9\xb0\x0b" "\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89" "\xe3\x52\x53\xeb\xca"; that will instruct the program what to do next after the exploitation process is done But when it comes to creating it not many people willing to devote their time to learn it, they rather to just used a precompiled shellcode for example that come from http://shell-storm.org/  because they think that is some...