Monday, September 23, 2013

CSAW Recon Challenges 2013 (Full List)


Alexander Taylor (Credit JvK, Darek, and social engineering by KD)


·         Downloaded Alexander Taylor's picture from the CSAW judges page (ataylor.png )



·         Ran pngcheck -f -v ataylor.png and got:
File: ataylor.png (274296 bytes)
  chunk IHDR at offset 0x0000c, length 13
    604 x 401 image, 24-bit RGB, non-interlaced
  chunk tEXt at offset 0x00025, length 43, keyword: These aren't the chunks you'
re looking for.
  chunk tEXt at offset 0x0005c, length 31, keyword: You can go about your busine
ss.
  chunk tEXt at offset 0x00087, length 11, keyword: Move along.
  chunk pHYs at offset 0x0009e, length 9: 11811x11811 pixels/meter (300 dpi)
  chunk xORk at offset 0x000b3, length 4:  illegal (unless recently approved) un
known, public chunk
  chunk IDAT at offset 0x000c3, length 16384
    zlib: deflated, 32K window, superfast compression
  chunk IDAT at offset 0x040cf, length 16384
  chunk IDAT at offset 0x080db, length 16384
  chunk IDAT at offset 0x0c0e7, length 16384
  chunk IDAT at offset 0x100f3, length 16384
  chunk IDAT at offset 0x140ff, length 16384
  chunk IDAT at offset 0x1810b, length 16384
  chunk IDAT at offset 0x1c117, length 16384
  chunk IDAT at offset 0x20123, length 16384
  chunk IDAT at offset 0x2412f, length 16384
  chunk IDAT at offset 0x2813b, length 16384
  chunk IDAT at offset 0x2c147, length 16384
  chunk IDAT at offset 0x30153, length 16384
  chunk IDAT at offset 0x3415f, length 16384
  chunk IDAT at offset 0x3816b, length 16384
  chunk IDAT at offset 0x3c177, length 16384
  chunk IDAT at offset 0x40183, length 11681
  chunk kTXt at offset 0x42f30, length 52:  illegal (unless recently approved) u
nknown, public chunk
  chunk IEND at offset 0x42f70, length 0
ERRORS DETECTED in ataylor.png
·         Illegal chunks? Hmmmmmm, time for a little hacker justice.
·         Used HxD to copy the data from the xORk and kTXt chunks (in hex format)
·         xORk suggested that a XOR was necessary
◦     the xORk value translated in ASCII to “CSAW”
·         Time for very messy Python!
kTXt = ''.join('28 36 38 2C 10 03 04 14 0A 15 08 14 02 07 08 18 0D 00 61 04 16 11 0B 12 00 07 61 03 0C 73 02 1F 02 1D 06 12 63 04 08 03 0B 1C 14 03 63 1D 0E 03 0A 10 04 2A 61 8F AC C1 00 00 00 00').split()
xORk = ''.join('43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57 43 53 41 57').split()
# Note that the xORk value is repeated to match the length of kTXt
for i in range(len(kTXt)):
     print(chr(int(kTXt[i], 16) ^ int(xORk[i], 16)), end="")
·         The result: key{SPECIFICATIONS SUBJECT TO CHANGE WITHOUT NOTICE}"Üí–CSAW
·         Ignore the weird shit at the end (I think I copied too many bytes in HxD?) and plug the key into the CSAW website

key{SPECIFICATIONS SUBJECT TO CHANGE WITHOUT NOTICE}



Julian Cohen (MG)

Last year Julian posted his new website to Reddit to give out the key (it was cockcab.com) so this year it's no different.  However, he posted  two new websites and we got stuck on one, deathbycats.com for a while. Until someone else noticed he had another new site:

http://omnom.nom.co/

Check out the IP instead of the domain to get the key.

We've lost the key since yesterday, but the write up here shows the key as
key{1a8024a820bdc7b31b79a2d3a9ae7c02}

Psifertex (Credit to JvK, MK, and Shada)


Navigate to last years answer (key.psifertex.com) and we're presented with this page:

We searched around a bit and found that Michael Vario is notorius for signing a bunch of other people's PGP key. So we search for "psifertex" on the MIT PGP site:  
http://pgp.mit.edu:11371/pks/lookup?search=psifertex&op=index&fingerprint=on



Follow the user ID link to: http://pgp.mit.edu:11371/pks/lookup?op=vindex&fingerprint=on&search=0x9FBEBC5EA827D636



Click on the keyID link (A827D636) to go to the PGP public key block: http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x9FBEBC5EA827D636

 Took a quick peek at the public key block in Notepad++, remove the newlines then feed that into a base64 decoder. Load that into a hex editor (such as HxD) and strip all besides a JPEG header that we found. Fix that header and extract exif data. We can now see an image, but its somewhat garbled. Here we can see something that looks like a key.



 Continue to stare at the screen for a while.. more staring.. and more staring.. Remember Michael Vario connection attempt the key "mvarioisnotmyhomeboy"

SUCCESS
key{mvarioisnotmyhomeboy}

Kevin Chung (KD)
Kevin's website shows graduation song (friends forever), key is not on his website (codekevin.com)



Cache, wayback machine are red herrings. Wayback machine does have a key, but according to Kevin that key was unintentional.

Judge page shows him winning high school forensics competition at CSAW
Navigate to https://hsf.isis.poly.edu/previous_winners/ getting there from googling CSAW High School Forensics Finalist kevin chung scroll down to Kevin chung in 2009, click the name... redirect to a key
https://hsf.isis.poly.edu/assets/uploads/pages/previous_winners/key.txt

key{who_in_the_world_is_kevin_chung}

historypeats (Credit to JvK)



historypeats is a GitHub user, with this recent change: "Removed some unnecessary key comments." https://github.com/historypeats/putscan/commit/a31512af6e8f2ae76bce11c0bd363f899e3488d1
which include:
 key{whatDidtheF0xSay?}
 


Brandon Edwards (Credit Clevernyyyy)

First Screen – Default Google Search – Notice pseudonym (drraid)




Some Recon social sites I usually visit once I find a pseudonym are:

·         Website

·         Reddit

·         LinkedIn

·         Facebook

·         GitHub

·         Etc

Find success on one of the sites:

Git Hub Screenshot – notice the huge flag (CSAW CTF Judge), he didn’t even put some stuff beforehand to hide it.


key{a959962111ea3fed179eb044d5b80407}

Odin

On IRC if you "/whois snOwDIN" you were given the hint "linked:chinesepies"

After Googling around we found nothing of importance until someone said to check to see if it was a username of a linkedin member..

Navigate to: http://www.linkedin.com/in/chinesespies

Find Eddie snowdin and a key
key{cookies_are_for_csaw}

Theodore Reed (KD)

Given prosauce.org, we are supposed to find a key.
So this one was a bit painful and took far too long because noob and whatnot.

After jacking around for a while searching for treed, teddy reed, theo reed, I decided I had lost my way and went back to his mainpage.. I proceeded to review his damn blog (all 9 pages) and all the links in those fucking pages for an hour. No key. I figure I'll check on the projects page again (http://prosauce.org/projects/) and see if I missed something. I reviewed the presentation and then loaded the video, just
like I had in the previous hour.

However, I missed checking comments on the video the previous hour



Notice there's only one comment and of course it has the key.

key{shmooconrocksglhfwithcsaw}

Monday, June 17, 2013

3dub 1 - DEF CON Quals 2013 badmedicine writeup

This challenge started off with a login page.  If you would try to login as 'admin', it would say that doing so was disabled.

So, I started up burp's proxy to see what everything that was being sent.
I then attemped to login a user other than 'admin' and noticed that it also sent a cookie.

Then I attempted to login as 'bdmin'.

Success!
It sent the cookie: '0ac8259ca0'
I then attempted 'cdmin' and received the cookie: '0bc8259ca0'

So, assuming there was a pattern, I figured the cookie for 'admin' was:  '098259ca0'

I sent a username and then edited the cookie to  '098259ca0'.


















The key is: who wants oatmeal raisin anyways twumpAdby

... I prefer chocolate chip

3dub 2

2pt challenge @ http://babysfirst.shallweplayaga.me:8041
we are given a simple login page typical username and password setup











We assumed sql so..














and....












so it is SQLinjection...we are pretty n00b over here so we used our toolkit to our advantage
SQLmap















It says there is a keys table so lets make a query to the table and grab that info
SQL(name' UNION ALL SELECT * FROM keys -- )

YAY...

3dub 4 - WRITEUP

In this challenge we were confronted with a standard Admin panel page:



Awesome page right?


If you click on "usernames.txt" you get sent to a getfile.php page that presents this page:

Well that's cool... let's change the filename GET parameter to "passwords.txt".





 So we messed around a bit and saw that the access code parameter was a md5 of the file name.

So when we changed the md5 to passwords.txt's md5 (b55dcb609a2ee6ea10518b5fd88c610e)
and the filename to passwords.txt we get access to the passwords.txt page:
Well that looked too hard (SHA  512) for our simple minds  to break. So we decided that we should just go look around a bit at other pages since we can access any page we want so we looked at the login page:


Well since there is no auth code on this page it must have been a red herring, good thing we didn't try decrypting those passwords. With only one page (that we know of) left to check we looked at the getfile.php page:

We see there is a key page that we can't access directly but instead it produces an encrypted version of the key.txt using a random seeded value as the key to encrypt as well as base64encoding the encrypted text. We went and got the encrypted string by accessing key.txt ('IC7U94oEd1fDqQvxz6ub0RQ6IdJXfbgAqV+FxpxXMnGwLplE37Hjc+X7OwruViqvDYyyI8nFjRaDmMgPWvNoFA==)

Since the string was encrypted with PHP (and our Python was bad and we should feel bad) we thought it would be easier to decode it with PHP. But first we need to get the seed value for random so that we can guess the encryption key. The seed value is based off UNIX EPOC time from the time() function in PHP. So it creates the seed based off the time the page is loaded. So we can totally guess this seed now. We get our time in EPOC minus a few hundred for sanity reasons and brute force every seed value till we get the right answer. code to win:
function aes_crypt($data,$key)
{
    // if $encrypted is HEXed, then return it to binary
  // $encrypted = pack('H*',$encrypted);


    $cyphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC);
   return base64_encode($cyphertext);
}


$base = '137135834310';
function aes_decrypt($encrypted,$key)
{
    // if $encrypted is HEXed, then return it to binary
  // $encrypted = pack('H*',$encrypted);
   srand($key);
   $actkey=rand();
    return mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$actkey,$encrypted,MCRYPT_MODE_CBC);
}



$data = 'IC7U94oEd1fDqQvxz6ub0RQ6IdJXfbgAqV+FxpxXMnGwLplE37Hjc+X7OwruViqvDYyyI8nFjRaDmMgPWvNoFA==';
$test='N8cPv8v53UiO3m1WDxnuFg==';
$i = 1371311111;
$fp = fopen('data.txt', 'w');
while ($i < 1371999999){
   print "$i<br>";
   //print aes_crypt("The flag is:",'2234');
   $decode = aes_decrypt(base64_decode($data),$i);
   //print "$decode<br>";
   $i++;
   //print time();
   fwrite($fp, "$decode\n\n");
}
fclose($fp);
 



Wednesday, June 12, 2013

Randy - 200 - bkpCTF 2013

This was a very interesting challenge. To start we downloaded and ran the executable on my Ubnutu VM.

After running the executable we assumed that the challenge was to find the password that would output a ": )".The next step was inspect the program in IdaPro and see if our assumptions were true. Some findings from examining the executable in IdaPro included:
The program fires up prints “Password” to the screen, then waits for user input. Once the user has entered the password the first check the executable does is to verify that the length of the password is 28 characters long.

Then the executable makes a second call to _strlen once again to verify that the length of the password is 28 characters long.


The program then calls the keygen function and falls into the call to the wrong function if keygen returns zero and the call to the valid function if keygen returns one. It looks like the function that will need to be reversed is the keygen function.


After some inspection and remote debugging we were able to figure out some important information about the keygen function. The keygen function works as follows:

  1. Pull eight bytes from the user input and store the result in RAX
  2. Use the bottom four bytes of RAX as input to _srandom
  3. Call the _random function, and compare the return value to a number
  4. Increment r12 to grab the next four bytes of the user input

This entire algorithm is repeated a total of seven times. The first seven numbers that are compared after each reseeding of the random function were:

1. 0x7358837a
2. 0x34d8c3b53. 0x1f49456c
4. 0x1fea6614
5. 0x4e81abc76. 0x683d3f5d
7. 0x28c9a8feTherefore to find the key all we need to do is write a program that generates all possible four character printable ASCII values. Use those values as input to srandom, call random, and finally compare the result to each of the previous seven numbers to find a match. This will tell us what four characters were used as the seed at that particular point in the program. Once all seven seeds are found we should have the flag:). The solution program that we used is as follows:


Link to solution code: https://github.com/IAryan/CTFSolutions/blob/master/randySolution.c



The output of the bruteforce program reveals the flag: n0t s0 r4nd0m0 4ft3r a11!!!! 

Solution write-up by Ryan

Monday, June 10, 2013

Wolfram Beta - Misc 100 BkP 2013

This challenge had us connect to a server running a "Wolfram Beta" calculator.

The calculator asked the user for a number, then an operator, and another number.  It would then calculate the solution:


Wolfram Beta - BkP CTF 2013 Team
Wolfram Beta is a great calculator.
just put in a number at the prompt
then put in the operator
then finally the second number
and the calculation will be done INSTANTLY
no accounts necessacary, unlike some of our competition!
first num: 1
operator: +
second num: 1
Thinking...
......
Done Thinking!
2

We immediately assumed that the operator field was the vulnerable.  After several attempts, we found a way to inject code:


operator: +1; [code]; 1+

Since the server would kindly display program errors to us,  we knew it was a C# program.  After learning some C# code, we figured out how to read an entire file and print it out to the console.



key is:  at_least_its_not_a_python_jail

Mystery-100 BostonKeyParty 2013

This was your typical trivia recon challenge (what's a CTF without some movie references?). You just had to either Google keywords from the pictures or know generally about the movie.

Begin challenge --
My favorite movies!

=========================

http://imgur.com/vaEMaRU

third word, fourth letter (The Social Network)

=========================

$ bin/LLLSDLLaserControl -ok 1

second word, fourth letter (Tron Legacy)

=========================

Discovered open port 22/tcp on 205.217.153.53
Discovered open port 22/tcp on 205.217.153.62
Discovered open port 22/tcp on 205.217.153.53
Discovered open port 22/tcp on 205.217.153.62
Discovered open port 22/tcp on 205.217.153.53
Discovered open port 22/tcp on 205.217.153.62
Complete SYN Stealth Scan against 205.217.153.53 in 25.94s (1 host left)
Complete SYN Stealth Scan at 13:30, 25.94s elapsed (3380 total ports)

second word, second letter (Live Free or die hard)

=========================

mysql> use Police06_Varmland

second word, first letter (The girl with the dragon tattoo)

=========================

MPW
---
h := NewHandle(GetHandleSize(params[1]));
IF h = NIL THEN EXIT(EntryPoint);
p := params[1]^;
q := h^;

first word, fourth letter

=========================

http://goo.gl/SMWCl

first word, first letter

=========================

http://imgur.com/qEmNke2

first word, third letter

=========================

http://imgur.com/wCtboQv

first word, seventh letter (Hackers)

We didn't seem to find letters 5, 6, 7, but we had enough to spell wargXXXs so we just guessed the first thing we thought of, which of course was wargames. Thus, 100 points.

key={wargames}