Showing posts with label capture the flag. Show all posts
Showing posts with label capture the flag. Show all posts
UiTM CTF 2015 - soooomixeddd

UiTM CTF 2015 - soooomixeddd

You have been given text file contains this script. Obviously it is javascript.

<script language=javascript>document.write(unescape('%3C%73%63%72%69%70%74%20%6C%61%6E%67%75%61%67%65%3D%22%6A%61%76%61%73%63%72%69%70%74%22%3E%66%75%6E%63%74%69%6F%6E%20%64%46%28%73%29%7B%76%61%72%20%73%31%3D%75%6E%65%73%63%61%70%65%28%73%2E%73%75%62%73%74%72%28%30%2C%73%2E%6C%65%6E%67%74%68%2D%31%29%29%3B%20%76%61%72%20%74%3D%27%27%3B%66%6F%72%28%69%3D%30%3B%69%3C%73%31%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%74%2B%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%73%31%2E%63%68%61%72%43%6F%64%65%41%74%28%69%29%2D%73%2E%73%75%62%73%74%72%28%73%2E%6C%65%6E%67%74%68%2D%31%2C%31%29%29%3B%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%75%6E%65%73%63%61%70%65%28%74%29%29%3B%7D%3C%2F%73%63%72%69%70%74%3E'));dF('%264Diunm%264F%261B%264Difbe%264F%261B%264Dtdsjqu%2631uzqf%264E%2633ufyu0kbwbtdsjqu%2633%264F%261Bgvodujpo%2631tipx%60bmfsu%2639%263%3A%261B%268C%261Bbmfsu%2639%2633F%5BXIJP%5B8PCVIBEJLNW4HD4CJN66HT4UHOSRYJ%5BKJNKRYH%5BKXHSQXJ%5BMEO6THLLCIOKMHJ%5BELH%5BZFTSLRHGCDX63NKKWHTVDRH6KWLUEOJSVFDOEXJF5IL3UIPOOHTS%5BROW5H54KSHJ5UTPLFNWYUTPDGLVZHZWSSLSZEF5MDPS3YHU%5BWGO5WJ6SWNK6FV4TONRYVL%5BSYHOFEBR4XNFZXTXTRHJZF334RJZZUTPLNPO%5BDXNDHHBWWTW%5BUKO3X37CZOZ4IN7T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HJXSVH6TV5TDCH5ZDXOULL54GNO4%5BJKOIFTLFNOMX533XNN%5BYRNUVN%5BJFF6EUKS3VDTKQQKLYLS%5BYHS6FFRULOORYV4CVNOLXNOLYNW5FPN4MLCCUDR3GQCYIVUTFJ53YR%5BE%5BQFZYBM%5BQH%5BGHHS%5BVGN%5BH5PEKOGBV36CZNZ3HPWEVHNYTPLKKGF6R3DS8F%5BUYJPZ%264E%2633%263%3A%264C%261B%268E%261B%264D0tdsjqu%264F%261B%264D0ifbe%264F%261B%264Dcpez%264F%261B%261B%264Djoqvu%2631uzqf%264E%2633cvuupo%2633%2631podmjdl%264E%2633tipx%60bmfsu%2639%263%3A%2633%2631wbmvf%264E%2633Hppe%2631Mvdl%2632%2632%2632%2631%266F%60%266Fz%2633%26310%264F%261B%261B%264D0cpez%264F%261B%264D0iunm%264F1')</script>
Then we change the extension file .txt to .html. And open the file with web browser.  You will see a button "Good Luck...", press the button and pop up strings. Copy and paste to anywhere to see the whole strings.


From here you need to differentiate between Base32 and Base64, Base32 their characters mix of upper characters and numbers, while Base64 mixed with upper and lower chars and also number and other characters. Both strings will end whether = , == or nothing. So this is Base32, when we decode it, we will get php code.

So just edit to display the strings that will be deobfuscated and open the file with your browser and you will get this strings.


After that I try to decode it with base64 and got another weird string.

So after done some research of that weird strings, I got a website that mentioned about obfuscation. I dont know which language obfuscation is this. So try with php, no luck. Try with javascript. Yes!
Here is the output :
5930753472332430213333377a44754433436f6e4772415432546831734953666c3467thisisnottheanswerbutyouareNEAR 
So here just decode the hexadecimal, then got the flag.

Uniten Hack@10 Binary ex03

For this challenge, I will explain what I did to solve this challenge, eventhough it is quite easy if you really understand how the program's work.

So of course first we check whether it is packed or unpacked with PEiD.


So it shows nothing found? Means nothing to worry? Haha. So second step we do strings the program to check any weird/interesting string. Nothing interesting for me except this.


Then we try open the program with OllyDbg. And try to run the program with dummy input.


For sure got wrong. Then try to search for reference strings. But got no clue since the ouput "Wrong" and "Correct!!" did not display. So I search in Memory Map (alt + M), then double click .text.


And then searching and searching, I found this "Correct" and "Wrong" strings!


So I mark a breakpoint at the JBE instruction at 0x0119292C. So wen run the program again, and using dummy input to check whether it stops at our breakpoint marked or not?

No! It still display "Wrong" status, it means that it didn't stop at our breakpoint marked. So when we click at "Wrong" section, we can see in Hint Pane that the jump to "Wrong" section come from two address which were 0x01192915 and 0x0119292C.



So 0x0119292C is our breakpoint marked just now. And the other one is not, so we need to mark breakpoint at 0x01192915 too which is JNZ instruction. After that just dummy input to see whether it stop at our new breakpoint.

Yeah it stop at 0x01192915! From the instruction there, it compare register AX with BX, if it same then continue to the next instruction, if not go to "Wrong" section.

So we just change the zero flag so that we can continue, then we reach to our second breakpoint where it compare the EAX register with constant value 0F(in decimal 15), JBE(Jump if below or equal), so I assume that it compare the length of the strings. If the string length below or equal to 15 then it will go to the "Wrong" section, else continue to "Correct" section. So from there we just to reverse the step to get the string.

When we reverse to our first breakpoint, we know that it compare AX and BX register, so we need to know how AX and BX get the value. From the cpu window, there are 2 functions that have been called before the comparing section happen.


So we set a breakpoint at both functions and then analyse what happen when the function is called with our dummy input.

Then we reach to the first function, and then press F7 to step into the function called.

So here are the function 1 procedure.


So we just step into the function procedure, and then return back. From my understanding, the algorithm is just encode the string input into 4 bytes. Below is C code that I translate.


Then we go to the second function. Try to understand the algorithm. Based on my understanding, the EAX register will change to 7EEF. And 60 bytes are reserve in the stack. So we check that they input the value in the stack in unordered. After input all the value in the stack, then they do XOR instruction around 0x28 (40) times.



 Then return back, and compare the AX register with BX register. So that's how the program work.

1) Encode the strings to 4 bytes, and then return it. EAX hold the values of 4 bytes then move the value EBX register.

2) Then in the second function will place some value in stack and do some XOR then return back.

3) Compare AX and BX.

I assume that our strings maybe 40 characters, why? Because it is weird to reserve bytes in stack and do XOR for 40 times.

And also at step 3, AX value always 7EEF, while BX value depends on our input. So if we can make a string that will generate a value 7EEF after it encoded, it would be nice!

So I try to reverse the encoded function, but no luck! Haha. Around 2 days I spend to reverse the algorithm. And I also put a breakpoint at first instruction in both function.

First function


Second function


Then my luck comes, when I restart the program, I try to run at each breakpoint,
 then I found interesting string at first function procedure before the program start!



"This message is encrypted with blowfish"
I just copy the strings and input it to our program.


Yeah! Finally got the answer.

So I assume all this algorithm are blowfish cipher algorithm, that is why it was hard to reverse. Haha.

But but.. my technique was not so efficient, since I was just lucky to see the strings before the program start.. But but it was fun challenge!


UTPHAX'15 - (ROUND 2) Challenge 3 - Web 1.0

Description :  http://kemboja.utphax.my/YmVjNTMwNGNmYTg0ZGIzZjFlZWY3OGI3/index.html
Point : 100

When open it just nothing in the web page. So view source and see any information.

Haa! We got something in the javascript. There are some hex string. So we decode it, and got userAgent, substr, length, getElementbyId and etc..

So we try to understand what they are doing.

Basically, it just take the value from the userAgent, for example like this :
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
And then compare that value with plaintext value which is :
The supreme art of war is to subdue the enemy without fighting.
So now if we change the userAgent value to that string, then we can proceed with the if statement here.


Then change the userAgent (User Agent Switcher for firefox) and you refresh the page and dont forget to edit the html page, because there is css element that will make it display nothing :




Just remove the "display:none" or you remove id="board" in the div tag. Then you will see a md5 hash string.


I dont know whether the md5 hash is the flag because I dont solve this challenge at that time. Haha.



UTPHAX'15 - (ROUND 2) Challenge 1 - Check The Packets!

Description : Hacker targetting an Apple computer. Give me the Apple's MAC. My email only accepting capital letters. Download the analysis file at http://kekwa.utphax.my/N2ZlNWQ4MDQwMmUxMjQ1OGQwMjRiODRl/senang1.pcap
Point : 100

So this is network forensic challenge where we need to analyze the pcap file and get the mac address of apple computer.

First step open the pcap file with wireshark, and then type this in display filter wireshark :

eth.addr
 After that you just search for "Apple" word, at packer no. 4, we got the Apple's mac address!


Thats our flag!

Flag : 00:16:CB:92:6E:DC

Wargames 2011 - Crypto 200

This challenge I refer to this post actually.

So this is how I solve this challenge, but I do not know whether answer I got was correct or not.

First we got an image, then just upload it to google and search for the same picture with keyword "cipher". So I got one image that's have the same character, and cipher name is masonic cipher.

Then search for masonic cipher, google displayed pigpen cipher, which is other name for masonic cipher, so just search for pigpen cipher.

And we get decoder for pigpen cipher here. The method of encoding is Image: Pigpen ##XX.


Then after translate all the characters, we got a new ciphered string. So based on p0pc0rn write up in this post, it was a substitute cipher. So I just tried to substitute by using first letter frequency method but the translation was quite weird so I just stop translated. Then I googling for suitable decrypter and got this site . Just paste the ciphered text we got just now and click "Solve" button.

And we got string text here.


So from the picture we just corrected the some word which we can guess. And then read the whole text, the interesting part is :

which group was ryan cleary accused or to be associated with? md5 the answer and submit the sum. that is yourflg.

So I just google about ryan cleary and got LulzSec. And it said that "md5 the answer and submit the sum." Hint in description said the flag must be in uppercase, so I dont know whether "LulzSec" need to be uppercase or the md5. So that's your flag.

[Other Method] UiTM CTF 2015 - Crypto200

You can read at this post before. At that post I was using Cryptool 2 to solve this challenge. Now I just want to show another way to solve(actually same method but do this in scripting?).

So I just found pygenere script which is useful when you want to decrypt vigenere cipher.

 You download the script and put it in the same directory with code below and save it as vigenere_dec.py.


So just compile vigenere_dec.py.


You can see "UITMCTF" is the key for the encrypted strings. After the "UITMCTF" strings, are the decrypted strings.